Completed
Push — master ( 5ac91e...39483e )
by Kirill
38:30
created

BaseInput::isCompatible()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 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\SDL\Base\Definitions;
11
12
use Railt\SDL\Base\Dependent\Argument\BaseArgumentsContainer;
13
use Railt\SDL\Base\Invocations\Directive\BaseDirectivesContainer;
14
use Railt\SDL\Contracts\Definitions\InputDefinition;
15
use Railt\SDL\Contracts\Invocations\InputInvocation;
16
use Railt\SDL\Contracts\Type;
17
18
/**
19
 * Class BaseInput
20
 */
21
abstract class BaseInput extends BaseTypeDefinition implements InputDefinition
22
{
23
    use BaseArgumentsContainer;
24
    use BaseDirectivesContainer;
25
26
    /**
27
     * Input type name
28
     */
29
    protected const TYPE_NAME = Type::INPUT;
30
31
    /**
32
     * @param mixed $value
33
     * @return bool
34
     */
35 282
    public function isCompatible($value): bool
36
    {
37 282
        return $value instanceof InputInvocation;
38
    }
39
40
    /**
41
     * @return array
42
     */
43 1012
    public function __sleep(): array
44
    {
45 1012
        return \array_merge(parent::__sleep(), [
46
            // trait HasArguments
47 1012
            'arguments',
48
49
            // trait HasDirectives
50
            'directives',
51
        ]);
52
    }
53
}
54