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.

Code Duplication    Length = 72-72 lines in 2 locations

src/Rule/GreaterThan.php 1 location

@@ 18-89 (lines=72) @@
15
 *
16
 * @package Particle\Validator\Rule
17
 */
18
class GreaterThan extends Rule
19
{
20
    /**
21
     * A constant for an error message if the value is not greater than the min.
22
     */
23
    const NOT_GREATER_THAN = 'GreaterThan::NOT_GREATER_THAN';
24
25
    /**
26
     * The message templates which can be returned by this validator.
27
     *
28
     * @var array
29
     */
30
    protected $messageTemplates = [
31
        self::NOT_GREATER_THAN => '{{ name }} must be greater than {{ min }}',
32
    ];
33
34
    /**
35
     * The lower boundary.
36
     *
37
     * @var int
38
     */
39
    protected $min;
40
41
    /**
42
     * Construct the GreaterThan rule.
43
     *
44
     * @param int $min
45
     */
46
    public function __construct($min)
47
    {
48
        $this->min = $min;
49
    }
50
51
    /**
52
     * Checks whether or not $value is greater than the min for this rule.
53
     *
54
     * @param mixed $value
55
     * @return bool
56
     */
57
    public function validate($value)
58
    {
59
        return !$this->notGreaterThan($value, self::NOT_GREATER_THAN);
60
    }
61
62
    /**
63
     * Returns whether or not the value is greater than the min, and logs an error if it isn't.
64
     *
65
     * @param mixed $value
66
     * @param string $error
67
     * @return bool
68
     */
69
    protected function notGreaterThan($value, $error)
70
    {
71
        if ($value <= $this->min) {
72
            $this->error($error);
73
            return true;
74
        }
75
        return false;
76
    }
77
78
    /**
79
     * Returns the parameters that may be used in a validation message.
80
     *
81
     * @return array
82
     */
83
    protected function getMessageParameters()
84
    {
85
        return array_merge(parent::getMessageParameters(), [
86
            'min' => $this->min,
87
        ]);
88
    }
89
}
90

src/Rule/LessThan.php 1 location

@@ 18-89 (lines=72) @@
15
 *
16
 * @package Particle\Validator\Rule
17
 */
18
class LessThan extends Rule
19
{
20
    /**
21
     * A constant for an error message if the value is not less than the max.
22
     */
23
    const NOT_LESS_THAN = 'LessThan::NOT_LESS_THAN';
24
25
    /**
26
     * The message templates which can be returned by this validator.
27
     *
28
     * @var array
29
     */
30
    protected $messageTemplates = [
31
        self::NOT_LESS_THAN => '{{ name }} must be less than {{ max }}',
32
    ];
33
34
    /**
35
     * The upper boundary.
36
     *
37
     * @var int
38
     */
39
    protected $max;
40
41
    /**
42
     * Construct the LessThan rule.
43
     *
44
     * @param int $max
45
     */
46
    public function __construct($max)
47
    {
48
        $this->max = $max;
49
    }
50
51
    /**
52
     * Checks whether or not $value is less than the max for this rule.
53
     *
54
     * @param mixed $value
55
     * @return bool
56
     */
57
    public function validate($value)
58
    {
59
        return !$this->notLessThan($value, self::NOT_LESS_THAN);
60
    }
61
62
    /**
63
     * Returns whether or not the value is less than the max, and logs an error if it isn't.
64
     *
65
     * @param mixed $value
66
     * @param string $error
67
     * @return bool
68
     */
69
    protected function notLessThan($value, $error)
70
    {
71
        if ($value >= $this->max) {
72
            $this->error($error);
73
            return true;
74
        }
75
        return false;
76
    }
77
78
    /**
79
     * Returns the parameters that may be used in a validation message.
80
     *
81
     * @return array
82
     */
83
    protected function getMessageParameters()
84
    {
85
        return array_merge(parent::getMessageParameters(), [
86
            'max' => $this->max,
87
        ]);
88
    }
89
}
90