Json   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 20
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A merge() 0 5 1
A jsonSerialize() 0 4 1
1
<?php
2
/**
3
 * Webino (http://webino.sk)
4
 *
5
 * @link        https://github.com/webino/WebinoDraw for the canonical source repository
6
 * @copyright   Copyright (c) 2012-2017 Webino, s. r. o. (http://webino.sk)
7
 * @author      Peter Bačinský <[email protected]>
8
 * @license     BSD-3-Clause
9
 */
10
namespace WebinoDraw\Ajax;
11
12
use ArrayObject;
13
use WebinoDraw\Stdlib\ArrayMergeInterface;
14
15
/**
16
 *
17
 */
18
class Json extends ArrayObject implements ArrayMergeInterface
19
{
20
    /**
21
     * @param array $array
22
     * @return self
23
     */
24
    public function merge(array $array)
25
    {
26
        $this->exchangeArray(array_replace_recursive($this->getArrayCopy(), $array));
27
        return $this;
28
    }
29
30
    /**
31
     * @return string
32
     */
33
    public function jsonSerialize()
34
    {
35
        return json_encode($this->getArrayCopy());
36
    }
37
}
38