Test Failed
Push — master ( 91db11...1ff1d8 )
by Kirill
02:16
created

ObjectDefinition   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 55.56%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 4
dl 0
loc 41
ccs 5
cts 9
cp 0.5556
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 4 1
A instanceOf() 0 7 2
A isRenderable() 0 4 1
A isInputable() 0 4 1
1
<?php
2
/**
3
 * This file is part of Railt package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
declare(strict_types=1);
9
10
namespace Railt\Reflection\Definition;
11
12
use Railt\Reflection\Contracts\Definition\ObjectDefinition as ObjectDefinitionInterface;
13
use Railt\Reflection\Contracts\Definition\TypeDefinition;
14
use Railt\Reflection\Contracts\TypeInterface;
15
use Railt\Reflection\Definition\Behaviour\HasFields;
16
use Railt\Reflection\Definition\Behaviour\HasInterfaces;
17
use Railt\Reflection\Type;
18
use Railt\Reflection\AbstractTypeDefinition;
19
20
/**
21
 * Class ObjectDefinition
22
 */
23
class ObjectDefinition extends AbstractTypeDefinition implements ObjectDefinitionInterface
24
{
25
    use HasInterfaces;
26
    use HasFields;
27
28
    /**
29
     * @return TypeInterface
30
     */
31 1
    public static function getType(): TypeInterface
32
    {
33 1
        return Type::of(Type::OBJECT);
34
    }
35
36
    /**
37
     * @param TypeDefinition $definition
38
     * @return bool
39
     */
40 1
    public function instanceOf($definition): bool
41
    {
42
        // Return a positive response if the parent type (like Object or Interface)
43
        // can implement the desired type.
44 1
        return $this->isImplements($definition) ||
45 1
            parent::instanceOf($definition);
46
    }
47
48
    /**
49
     * @return bool
50
     */
51
    public function isRenderable(): bool
52
    {
53
        return true;
54
    }
55
56
    /**
57
     * @return bool
58
     */
59
    public function isInputable(): bool
60
    {
61
        return false;
62
    }
63
}
64