Completed
Push — master ( 413f40...5bdd54 )
by André
23:42 queued 11:32
created

JsonObject::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
/**
4
 * File containing the Json Object class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Publish\Core\REST\Common\Output\Generator\Json;
10
11
/**
12
 * Json object.
13
 *
14
 * Special JSON object (\stdClass) implementation, which allows to access the
15
 * parent object it is assigned to again.
16
 */
17
class JsonObject
18
{
19
    /**
20
     * Reference to the parent node.
21
     *
22
     * @var \eZ\Publish\Core\REST\Common\Output\Generator\Json\JsonObject
23
     */
24
    protected $_ref_parent;
25
26
    /**
27
     * Construct from optional parent node.
28
     *
29
     * @param mixed $_ref_parent
30
     */
31
    public function __construct($_ref_parent = null)
32
    {
33
        $this->_ref_parent = $_ref_parent;
34
    }
35
36
    /**
37
     * Get Parent of current node.
38
     *
39
     * @return \eZ\Publish\Core\REST\Common\Output\Generator\Json\JsonObject
40
     */
41
    public function getParent()
42
    {
43
        return $this->_ref_parent;
44
    }
45
}
46