GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#80)
by
unknown
01:19
created

Cwebp::getCommand()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Spatie\ImageOptimizer\Optimizers;
4
5
use Spatie\ImageOptimizer\Image;
6
7
class Cwebp extends BaseOptimizer
8
{
9
    public $binaryName = 'cwebp';
10
11
    public function canHandle(Image $image): bool
12
    {
13
        return in_array($image->mime(), [
14
            'image/png',
15
            'image/jpeg',
16
        ]);
17
    }
18
19
    public function getCommand(): string
20
    {
21
        $optionString = implode(' ', $this->options);
22
23
        return "\"{$this->binaryPath}{$this->binaryName}\" {$optionString}"
24
            .' '.escapeshellarg($this->imagePath)
25
            .' -o '.
26
            escapeshellarg(
27
                preg_replace(
28
                    '/'.pathinfo($this->imagePath, PATHINFO_EXTENSION).'$/',
29
                    'webp',
30
                    $this->imagePath
31
                )
32
            );
33
    }
34
}
35