Document   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 37
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createObjectNodeBased() 0 4 1
A createArrayNodeBased() 0 4 1
A setProperty() 0 13 2
1
<?php
2
3
namespace Saxulum\JsonDocument;
4
5
class Document
6
{
7
    /**
8
     * @return ObjectNodeBasedDocument
9
     */
10
    public static function createObjectNodeBased()
11
    {
12
        return new ObjectNodeBasedDocument();
13
    }
14
15
    /**
16
     * @return ArrayNodeBasedDocument
17
     */
18
    public static function createArrayNodeBased()
19
    {
20
        return new ArrayNodeBasedDocument();
21
    }
22
23
    /**
24
     * @param object $object
25
     * @param string $property
26
     * @param mixed  $value
27
     */
28
    public static function setProperty($object, $property, $value)
29
    {
30
        static $reflection;
31
32
        if (null === $reflection) {
33
            $reflection = new \ReflectionClass('Saxulum\JsonDocument\AbstractNode');
34
        }
35
36
        $pRef = $reflection->getProperty($property);
37
        $pRef->setAccessible(true);
38
        $pRef->setValue($object, $value);
39
        $pRef->setAccessible(false);
40
    }
41
}
42