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.

InstanceOfPredicate   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 35
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 4 1
A getType() 0 4 1
1
<?php
2
/**
3
 * This file is part of the predicates package.
4
 *
5
 * Copyright (c) dutekvejin
6
 *
7
 * For full copyright and license information, please refer to the LICENSE file,
8
 * located at the package root folder.
9
 */
10
11
namespace Dutek\Predicate;
12
13
/**
14
 * Predicate implementation that returns true if the input is an instanceof the type stored in this predicate.
15
 *
16
 * @package Dutek\Predicate
17
 * @author Dušan Vejin <[email protected]>
18
 */
19
final class InstanceOfPredicate implements Predicate
20
{
21
    protected $type;
22
23
    /**
24
     * InstanceOdPredicate constructor.
25
     *
26
     * @param string $type The type to check for.
27
     */
28 3
    public function __construct(string $type)
29
    {
30 3
        $this->type = $type;
31 3
    }
32
33
    /**
34
     * Gets the type to compare to.
35
     *
36
     * @return string The type.
37
     */
38 1
    public function getType() : string
39
    {
40 1
        return $this->type;
41
    }
42
43
    /**
44
     * Evaluates the predicate returning true if the input value is of the correct type.
45
     *
46
     * @param mixed $value The input value
47
     * @return bool true if input is of stored type.
48
     */
49 2
    public function __invoke($value) : bool
50
    {
51 2
        return $value instanceof $this->type;
52
    }
53
}
54