GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

AbstractMeta   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 91
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
lcom 1
cbo 1
dl 0
loc 91
rs 10
c 1
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getKey() 0 4 1
A setKey() 0 6 1
A getValue() 0 4 1
A setValue() 0 6 1
A toArray() 0 10 1
A __toString() 0 15 3
1
<?php
2
3
namespace Application\Entity;
4
5
/**
6
 * Abstract Meta.
7
 *
8
 * Some default methods for a meta entity (id, key and value)
9
 *
10
 * @author Borut Balažek <[email protected]>
11
 */
12
class AbstractMeta extends AbstractBasicEntity
13
{
14
    /**
15
     * @var string
16
     */
17
    protected $key;
18
19
    /**
20
     * @var string
21
     */
22
    protected $value;
23
24
    /*** Key ***/
25
    /**
26
     * @return string
27
     */
28
    public function getKey()
29
    {
30
        return $this->key;
31
    }
32
33
    /**
34
     * @param string $key
35
     *
36
     * @return AbstractMeta
37
     */
38
    public function setKey($key)
39
    {
40
        $this->key = $key;
41
42
        return $this;
43
    }
44
45
    /*** Value ***/
46
    /**
47
     * @return string
48
     */
49
    public function getValue()
50
    {
51
        return $this->value;
52
    }
53
54
    /**
55
     * @param string $value
56
     *
57
     * @return AbstractMeta
58
     */
59
    public function setValue($value)
60
    {
61
        $this->value = $value;
62
63
        return $this;
64
    }
65
66
    /**
67
     * Returns data in array.
68
     *
69
     * @return array
70
     */
71
    public function toArray()
72
    {
73
        return array(
74
            'id' => $this->getId(),
75
            'key' => $this->getKey(),
76
            'value' => $this->getValue(),
77
            'time_created' => $this->getTimeCreated()->format(DATE_ATOM),
78
            'time_updated' => $this->getTimeUpdated()->format(DATE_ATOM),
79
        );
80
    }
81
82
    /**
83
     * Converts the key and value to string.
84
     *
85
     * @return string
86
     */
87
    public function __toString()
88
    {
89
        $data = array();
90
        $key = $this->getKey();
91
        $value = $this->getValue();
92
93
        // Prevent double encoding
94
        if ($value[0] == '{' || $value[0] == '[') {
95
            $value = json_decode($value);
96
        }
97
98
        $data[$key] = $value;
99
100
        return json_encode($data);
101
    }
102
}
103