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
Push — master ( 778cb5...da20d7 )
by Freek
01:40
created

InvalidManipulation   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 31
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A invalidWidth() 0 4 1
A invalidHeight() 0 4 1
A invalidParameter() 0 8 1
A formatValues() 0 9 1
1
<?php
2
3
namespace Spatie\Image\Exceptions;
4
5
use Exception;
6
7
class InvalidManipulation extends Exception
8
{
9
    public static function invalidWidth(int $width)
10
    {
11
        return new self("Width should be a positive number. `{$width}` given");
12
    }
13
14
    public static function invalidHeight(int $height)
15
    {
16
        return new self("Height should be a positive number. `{$height}` given");
17
    }
18
19
    public static function invalidParameter(string $name, $invalidValue, array $validValues)
20
    {
21
        $validValues = self::formatValues($validValues);
22
23
        $name = ucfirst($name);
24
25
        return new self("{$name} should be one of {$validValues}. `{$invalidValue}` given");
26
    }
27
28
    protected static function formatValues(array $values): string
29
    {
30
        $quotedValues = array_map(function(string $value) {
31
            return "`{$value}`";
32
        }, $values);
33
34
        return implode(', ', $quotedValues);
35
36
    }
37
}