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

WatermarkFilter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 14
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A windowsPath() 0 3 1
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