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.

CommonAssertionsTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A assertArrayOf() 0 14 3
1
<?php
2
3
namespace Inspector\Foundation\Test;
4
5
use PHPUnit_Framework_ExpectationFailedException;
6
7
/**
8
 * @author Kabir Baidhya
9
 */
10
trait CommonAssertionsTrait
11
{
12
13
    /**
14
     * Asserts to make sure an array is an array of instances of the provided class.
15
     *
16
     * @param string $expectedClass The fully-qualified classname
17
     * @param array $array
18
     * @throws PHPUnit_Framework_ExpectationFailedException
19
     */
20
    protected function assertArrayOf($expectedClass, array $array)
21
    {
22
        foreach ($array as $item) {
23
            $assert = (is_a($item, $expectedClass));
24
            if ($assert === false) {
25
                throw new PHPUnit_Framework_ExpectationFailedException(
26
                    sprintf(
27
                        'Failed asserting that the the given array is an array of instances of \'%s\'.',
28
                        $expectedClass
29
                    )
30
                );
31
            }
32
        }
33
    }
34
}
35