Passed
Pull Request — master (#265)
by Pascal
02:18
created

WatermarkFilter::windowsPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace ProtoneMedia\LaravelFFMpeg\Filters;
4
5
use FFMpeg\Filters\Video\WatermarkFilter as FFMpegWatermarkFilter;
6
7
/**
8
 * Partly based on this PR:
9
 * https://github.com/PHP-FFMpeg/PHP-FFMpeg/pull/754/files
10
 */
11
class WatermarkFilter extends FFMpegWatermarkFilter
12
{
13
    public function __construct($watermarkPath, array $coordinates = [], $priority = 0)
14
    {
15
        parent::__construct($watermarkPath, $coordinates, $priority);
16
17
        if (windows_os()) {
18
            $this->watermarkPath = static::windowsPath($watermarkPath);
0 ignored issues
show
Bug introduced by
The property watermarkPath is declared private in FFMpeg\Filters\Video\WatermarkFilter and cannot be accessed from this context.
Loading history...
19
        }
20
    }
21
22
    private static function windowsPath(string $path): string
23
    {
24
        return '"' . str_replace('/', '\\', $path) . '"';
25
    }
26
}
27