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   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 30
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A setType() 0 12 2
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