| Total Complexity | 5 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class WatermarkFilter extends FFMpegWatermarkFilter |
||
| 12 | { |
||
| 13 | protected $path; |
||
| 14 | |||
| 15 | public function __construct($watermarkPath, array $coordinates = [], $priority = 0) |
||
| 16 | { |
||
| 17 | parent::__construct($watermarkPath, $coordinates, $priority); |
||
| 18 | |||
| 19 | $this->path = $watermarkPath; |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Gets the commands from the base filter and normalizes the path. |
||
| 24 | * |
||
| 25 | * @return array |
||
| 26 | */ |
||
| 27 | protected function getCommands() |
||
| 28 | { |
||
| 29 | $commands = parent::getCommands(); |
||
| 30 | |||
| 31 | $commands[1] = str_replace($this->path, static::normalizePath($this->path), $commands[1]); |
||
| 32 | |||
| 33 | return $commands; |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Normalizes the path when running on Windows. |
||
| 38 | * |
||
| 39 | * @param string $path |
||
| 40 | * @return string |
||
| 41 | */ |
||
| 42 | public static function normalizePath(string $path): string |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Replaces the slashes and escapes the colon. |
||
| 51 | * |
||
| 52 | * @param string $path |
||
| 53 | * @return string |
||
| 54 | */ |
||
| 55 | public static function normalizeWindowsPath(string $path): string |
||
| 62 | } |
||
| 63 | } |
||
| 64 |