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 ( e2083f...36ba15 )
by Berry
03:22
created

IsArray::validate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php
2
/**
3
 * Particle.
4
 *
5
 * @link      http://github.com/particle-php for the canonical source repository
6
 * @copyright Copyright (c) 2005-2015 Particle (http://particle-php.com)
7
 * @license   https://github.com/particle-php/validator/blob/master/LICENSE New BSD License
8
 */
9
namespace Particle\Validator\Rule;
10
11
use Particle\Validator\Rule;
12
13
/**
14
 * This rule is for validating if a value is an array.
15
 *
16
 * @package Particle\Validator\Rule
17
 */
18
class IsArray extends Rule
19
{
20
    /**
21
     * A constant that will be used when the value does not represent an integer value.
22
     */
23
    const NOT_AN_ARRAY = 'IsArray::NOT_AN_ARRAY';
24
25
    /**
26
     * The message templates which can be returned by this validator.
27
     *
28
     * @var array
29
     */
30
    protected $messageTemplates = [
31
        self::NOT_AN_ARRAY => '{{ name }} must be an array',
32
    ];
33
34
    /**
35
     * Validates if $value is an array.
36
     *
37
     * @param mixed $value
38
     * @return bool
39
     */
40 6
    public function validate($value)
41
    {
42 6
        if (is_array($value)) {
43 2
            return true;
44
        }
45
46 4
        return $this->error(self::NOT_AN_ARRAY);
47
    }
48
}
49