| Total Complexity | 4 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 19 | class FFMpegListener extends EventEmitter implements ListenerInterface |
||
| 20 | { |
||
| 21 | /** @var string */ |
||
| 22 | private $event; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * FFMpegListener constructor. |
||
| 26 | * @param string $event |
||
| 27 | */ |
||
| 28 | public function __construct($event = 'listen') |
||
| 29 | { |
||
| 30 | $this->event = $event; |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Handle the output of a ProcessRunner |
||
| 35 | * |
||
| 36 | * @param string $type The data type, one of Process::ERR, Process::OUT constants |
||
| 37 | * @param string $data The output |
||
| 38 | */ |
||
| 39 | public function handle($type, $data) |
||
| 40 | { |
||
| 41 | foreach (explode(PHP_EOL, $data) as $line) { |
||
| 42 | $this->emit($this->event, [$line]); |
||
| 43 | } |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * An array of events that should be forwarded to BinaryInterface |
||
| 48 | * |
||
| 49 | * @return array |
||
| 50 | */ |
||
| 51 | public function forwardedEvents() |
||
| 54 | } |
||
| 55 | } |