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
Pull Request — master (#22)
by Rik
02:05
created

TypeCheckerTrait::setType()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 2
eloc 7
nc 2
nop 1
1
<?php
2
3
namespace Rb\Specification\Doctrine\Helper;
4
5
use Rb\Specification\Doctrine\Exception\InvalidArgumentException;
6
7
trait TypeCheckerTrait
8
{
9
    /**
10
     * @var string[]
11
     */
12
    protected $validTypes;
13
14
    /**
15
     * @var string
16
     */
17
    private $type;
18
19
    /**
20
     * @param string $type
21
     *
22
     * @throws InvalidArgumentException
23
     */
24
    public function setType($type)
25
    {
26
        if (! in_array($type, $this->validTypes, true)) {
27
            throw new InvalidArgumentException(sprintf(
28
                '"%s" is not a valid type! Valid types: %s',
29
                $type,
30
                implode(', ', $this->validTypes)
31
            ));
32
        }
33
34
        $this->type = $type;
35
    }
36
}
37