ObjectAndResourceClassesInstanceofSupportable   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A supports() 0 4 2
1
<?php
2
3
declare(strict_types = 1);
4
5
/*
6
 * This file is part of the FiveLab Resource package
7
 *
8
 * (c) FiveLab
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code
12
 */
13
14
namespace FiveLab\Component\Resource\Assembler\Resolver;
15
16
/**
17
 * The supportable for check object and resource classes.
18
 *
19
 * @author Vitaliy Zhuk <[email protected]>
20
 */
21
class ObjectAndResourceClassesInstanceofSupportable implements ResourceAssemblerSupportableInterface
22
{
23
    /**
24
     * @var string
25
     */
26
    private $objectClass;
27
28
    /**
29
     * @var string
30
     */
31
    private $resourceClass;
32
33
    /**
34
     * Constructor.
35
     *
36
     * @param string $objectClass
37
     * @param string $resourceClass
38
     */
39 3
    public function __construct(string $objectClass, string $resourceClass)
40
    {
41 3
        $this->objectClass = $objectClass;
42 3
        $this->resourceClass = $resourceClass;
43 3
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48 3
    public function supports(string $objectClass, string $resourceClass): bool
49
    {
50 3
        return \is_a($objectClass, $this->objectClass, true) && \is_a($resourceClass, $this->resourceClass, true);
51
    }
52
}
53