Passed
Push — master ( a8ea98...ccb0bf )
by SignpostMarv
03:21
created

RememberDaftObjectData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
ccs 3
cts 3
cp 1
crap 1
1
<?php
2
/**
3
* Base daft objects.
4
*
5
* @author SignpostMarv
6
*/
7
declare(strict_types=1);
8
9
namespace SignpostMarv\DaftObject;
10
11
abstract class DaftWriteableObjectMemoryTree extends DaftObjectMemoryTree implements DaftNestedWriteableObjectTree
12
{
13
    use TraitRememberDaftObject;
14
    use TraitWriteableTree;
15
16 112
    protected function RememberDaftObjectData(DefinesOwnIdPropertiesInterface $object) : void
17
    {
18 112
        static::ThrowIfNotType($object, DaftNestedWriteableObject::class, 1, __METHOD__);
19
20 112
        parent::RememberDaftObjectData($object);
21 112
    }
22
23
    /**
24
    * @param DaftObject|string $object
25
    */
26 114
    protected static function ThrowIfNotType(
27
        $object,
28
        string $type,
29
        int $argument,
30
        string $function
31
    ) : void {
32 114
        if ( ! is_a($object, DaftNestedWriteableObject::class, is_string($object))) {
33 2
            throw new DaftObjectRepositoryTypeByClassMethodAndTypeException(
34 2
                $argument,
35 2
                static::class,
36 2
                $function,
37 2
                DaftNestedWriteableObject::class,
38 2
                is_string($object) ? $object : get_class($object)
39
            );
40
        }
41
42 112
        parent::ThrowIfNotType($object, $type, $argument, $function);
43 112
    }
44
}
45