| Conditions | 4 |
| Paths | 5 |
| Total Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 19 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | 40 | public function send($payload) |
|
| 31 | { |
||
| 32 | 40 | if (!is_string($payload)) { |
|
| 33 | 4 | throw new InvalidArgumentException(sprintf( |
|
| 34 | 4 | 'Expects a string, got: (%s) %s.', |
|
| 35 | 3 | gettype($payload), json_encode($payload) |
|
| 36 | 3 | )); |
|
| 37 | } |
||
| 38 | |||
| 39 | 36 | $cmd = sprintf( |
|
| 40 | 36 | $this->transporter_cmd, |
|
| 41 | 27 | escapeshellarg($payload), |
|
| 42 | 36 | $this->url // urlencode($this->url) |
|
| 43 | 27 | ); |
|
| 44 | |||
| 45 | 36 | if (!$this->debug) { |
|
| 46 | 8 | $cmd .= ' > /dev/null 2>&1 &'; |
|
| 47 | // $cmd .= ' >&- 2>&- &'; |
||
| 48 | 6 | } |
|
| 49 | |||
| 50 | 36 | exec($cmd, $output, $return_var); |
|
| 51 | |||
| 52 | 28 | if ($return_var != 0) { |
|
|
|
|||
| 53 | 4 | $this->handleError($return_var, $output); |
|
| 54 | 3 | } |
|
| 55 | |||
| 56 | 28 | return $return_var == 0; |
|
| 57 | } |
||
| 58 | } |
||
| 59 |