Completed
Push — master ( dee7d0...3607c7 )
by Chris
02:30
created

SafeNodeFactory::createNodeFromValue()   C

Complexity

Conditions 7
Paths 15

Size

Total Lines 27
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 10.5454

Importance

Changes 0
Metric Value
dl 0
loc 27
ccs 7
cts 12
cp 0.5833
rs 6.7272
c 0
b 0
f 0
cc 7
eloc 14
nc 15
nop 3
crap 10.5454
1
<?php declare(strict_types=1);
2
3
namespace DaveRandom\Jom;
4
5
final class SafeNodeFactory extends NodeFactory
6
{
7
    /**
8
     * @inheritdoc
9
     */
10 64
    public function createVectorNodeFromValue($value, ?Document $doc, int $flags): ?Node
11
    {
12 64
        if (\is_object($value)) {
13 64
            return $this->createObjectNodeFromPropertyMap($value, $doc, $flags);
14
        }
15
16 64
        if (\is_array($value)) {
17 64
            return $this->createArrayNodeFromPackedArray($value, $doc, $flags);
18
        }
19
20
        return null;
21
    }
22
}
23