Completed
Push — develop ( ec695f...e5c98c )
by Narcotic
23s
created

Hash::cleanUpArray()   B

Complexity

Conditions 7
Paths 2

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 56

Importance

Changes 4
Bugs 0 Features 0
Metric Value
c 4
b 0
f 0
dl 0
loc 14
ccs 0
cts 11
cp 0
rs 8.2222
cc 7
eloc 10
nc 2
nop 1
crap 56
1
<?php
2
/**
3
 * Hash class file
4
 */
5
6
namespace Graviton\DocumentBundle\Entity;
7
8
/**
9
 * Special type for hash fields
10
 *
11
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
12
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
13
 * @link     http://swisscom.ch
14
 */
15
class Hash extends \ArrayObject implements \JsonSerializable
16
{
17
18
    /**
19
     * Specify data which should be serialized to JSON
20
     *
21
     * @return object
22
     */
23
    public function jsonSerialize()
24
    {
25
        $data = $this->getArrayCopy();
26
        if (empty($data)) {
27
            return (object) [];
28
        }
29
30
        return $data;
31
    }
32
}
33