Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Pull Request — master (#957)
by Henrique
02:19
created

LengthException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 37
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A chooseTemplate() 0 15 4
1
<?php
2
3
/*
4
 * This file is part of Respect/Validation.
5
 *
6
 * (c) Alexandre Gomes Gaigalas <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the "LICENSE.md"
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Respect\Validation\Exceptions;
15
16
class LengthException extends ValidationException
17
{
18
    public const BOTH = 'both';
19
    public const LOWER = 'lower';
20
    public const GREATER = 'greater';
21
    public const EXACT = 'exact';
22
23
    public static $defaultTemplates = [
24
        self::MODE_DEFAULT => [
25
            self::BOTH => '{{name}} must have a length between {{minValue}} and {{maxValue}}',
26
            self::LOWER => '{{name}} must have a length greater than {{minValue}}',
27
            self::GREATER => '{{name}} must have a length lower than {{maxValue}}',
28
            self::EXACT => '{{name}} must have a length of {{maxValue}}',
29
        ],
30
        self::MODE_NEGATIVE => [
31
            self::BOTH => '{{name}} must not have a length between {{minValue}} and {{maxValue}}',
32
            self::LOWER => '{{name}} must not have a length greater than {{minValue}}',
33
            self::GREATER => '{{name}} must not have a length lower than {{maxValue}}',
34
            self::EXACT => '{{name}} must not have a length of {{maxValue}}',
35
        ],
36
    ];
37
38
    protected function chooseTemplate(): string
39
    {
40
        if (!$this->getParam('minValue')) {
41
            return static::GREATER;
42
        }
43
44
        if (!$this->getParam('maxValue')) {
45
            return static::LOWER;
46
        }
47
48
        if ($this->getParam('minValue') == $this->getParam('maxValue')) {
49
            return self::EXACT;
50
        }
51
52
        return static::BOTH;
53
    }
54
}
55