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

BaseScalar::__sleep()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
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\Invocations\Directive\BaseDirectivesContainer;
13
use Railt\SDL\Contracts\Definitions\ScalarDefinition;
14
use Railt\SDL\Contracts\Type;
15
16
/**
17
 * Class BaseScalar
18
 */
19
abstract class BaseScalar extends BaseTypeDefinition implements ScalarDefinition
20
{
21
    use BaseDirectivesContainer;
22
23
    /**
24
     * Object type name
25
     */
26
    protected const TYPE_NAME = Type::SCALAR;
27
28
    /**
29
     * @return string
30
     */
31 567
    public function getTypeName(): string
32
    {
33 567
        return static::TYPE_NAME;
34
    }
35
36
    /**
37
     * @param mixed $value
38
     * @return bool
39
     */
40 318
    public function isCompatible($value): bool
41
    {
42 318
        return true;
43
    }
44
45
    /**
46
     * @return array
47
     */
48 1222
    public function __sleep(): array
49
    {
50 1222
        return \array_merge(parent::__sleep(), [
51
            // trait HasDirectives
52 1222
            'directives',
53
        ]);
54
    }
55
}
56