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.

JsonHelper   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

Changes 11
Bugs 5 Features 5
Metric Value
wmc 6
c 11
b 5
f 5
lcom 2
cbo 2
dl 0
loc 60
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getDecoder() 0 7 2
A getEncoder() 0 7 2
A encode() 0 4 1
A decode() 0 4 1
1
<?php
2
/**
3
 * Helper for works with json serializes
4
 *
5
 * @author Kachit
6
 * @package Kachit\Helper
7
 */
8
namespace Kachit\Helper;
9
10
use Kachit\Helper\Json\Encoder;
11
use Kachit\Helper\Json\Decoder;
12
13
class JsonHelper
14
{
15
    /**
16
     * @var Decoder
17
     */
18
    protected $decoder;
19
20
    /**
21
     * @var Encoder
22
     */
23
    protected $encoder;
24
25
    /**
26
     * Get decoder
27
     *
28
     * @return Decoder
29
     */
30
    public function getDecoder()
31
    {
32
        if (empty($this->decoder)) {
33
            $this->decoder = new Decoder();
34
        }
35
        return $this->decoder;
36
    }
37
38
    /**
39
     * Get encoder
40
     *
41
     * @return Encoder
42
     */
43
    public function getEncoder()
44
    {
45
        if (empty($this->encoder)) {
46
            $this->encoder = new Encoder();
47
        }
48
        return $this->encoder;
49
    }
50
51
    /**
52
     * Encode value to json string
53
     *
54
     * @param mixed $value
55
     * @return string
56
     */
57
    public function encode($value)
58
    {
59
        return $this->getEncoder()->encode($value);
60
    }
61
62
    /**
63
     * Decode json string to value
64
     *
65
     * @param string $jsonString
66
     * @return mixed
67
     */
68
    public function decode($jsonString)
69
    {
70
        return $this->getDecoder()->decode($jsonString);
71
    }
72
}