supports()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 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