You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PiFaceCommand.php 672B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: robin
  5. * Date: 11/24/15
  6. * Time: 5:17 PM
  7. */
  8. namespace App\Http\Business\Commands;
  9. class PiFaceCommand extends AbstractCommand
  10. {
  11. /**
  12. * @return bool
  13. */
  14. public function exec()
  15. {
  16. $data = $this->_command->getData();
  17. $args = [
  18. 'camotion-pifaceo'
  19. ];
  20. foreach ($data["Commands"] as $cmd) {
  21. $args[] = escapeshellarg("--" . $cmd);
  22. }
  23. $cli = implode(' ', $args);
  24. $code = 0;
  25. $output = [];
  26. exec($cli, $output, $code);
  27. if ($code != 0) {
  28. abort(500, "PiFace failed with code " . $code);
  29. }
  30. }
  31. }