Passed
Push — master ( 114e37...c14d71 )
by SignpostMarv
02:54
created

RememberDaftObjectData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 9.4285
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 TraitWriteableTree;
14
15 88
    protected function RememberDaftObjectData(DefinesOwnIdPropertiesInterface $object) : void
16
    {
17 88
        static::ThrowIfNotType($object, DaftNestedWriteableObject::class, 1, __METHOD__);
18
19 88
        parent::RememberDaftObjectData($object);
20 88
    }
21
22
    /**
23
    * @param DaftObject|string $object
24
    */
25 102
    protected static function ThrowIfNotType(
26
        $object,
27
        string $type,
28
        int $argument,
29
        string $function
30
    ) : void {
31 102
        if ( ! is_a($object, DaftNestedWriteableObject::class, is_string($object))) {
32 2
            throw new DaftObjectRepositoryTypeByClassMethodAndTypeException(
33 2
                $argument,
34 2
                static::class,
35 2
                $function,
36 2
                DaftNestedWriteableObject::class,
37 2
                is_string($object) ? $object : get_class($object)
38
            );
39
        }
40
41 100
        parent::ThrowIfNotType($object, $type, $argument, $function);
42 100
    }
43
}
44