| Total Complexity | 8 |
| Total Lines | 71 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | class Capture |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * @var string |
||
| 22 | */ |
||
| 23 | private $video; |
||
| 24 | /** |
||
| 25 | * @var string|null |
||
| 26 | */ |
||
| 27 | private $audio; |
||
| 28 | /** |
||
| 29 | * @var bool |
||
| 30 | */ |
||
| 31 | private $screen; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Camera constructor. |
||
| 35 | * @param string $video |
||
| 36 | * @param string|null $audio |
||
| 37 | * @param bool $screen |
||
| 38 | */ |
||
| 39 | public function __construct(string $video, string $audio = null, $screen = false) |
||
| 40 | { |
||
| 41 | $this->video = $video; |
||
| 42 | $this->audio = $audio; |
||
| 43 | $this->screen = $screen; |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @return array |
||
| 48 | */ |
||
| 49 | public function linux(): array |
||
| 50 | { |
||
| 51 | return [$this->video, ['f' => $this->screen ? 'x11grab' : 'v4l2']]; |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @return array |
||
| 56 | */ |
||
| 57 | public function windows(): array |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @return array |
||
| 69 | */ |
||
| 70 | public function osX(): array |
||
| 71 | { |
||
| 72 | return [$this->video, ['f' => 'avfoundation']]; |
||
| 73 | } |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @throw Runtime exception |
||
| 77 | */ |
||
| 78 | public function unknown() |
||
| 79 | { |
||
| 80 | throw new RuntimeException("Unknown operating system! It cannot run the camera on this platform"); |
||
| 81 | } |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @return array |
||
| 85 | */ |
||
| 86 | public function getOptions(): array |
||
| 89 | } |
||
| 90 | } |