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.
Completed
Push — master ( 0c6bcd...b3f485 )
by Andy
11s
created

PortDefinition::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 8
loc 8
ccs 0
cts 6
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * @package: chapi
4
 *
5
 * @author: bthapaliya
6
 * @since: 2016-10-16
7
 *
8
 */
9
namespace Chapi\Entity\Marathon\AppEntity;
10
11
use Chapi\Entity\Marathon\MarathonEntityUtils;
12
13
class PortDefinition implements \JsonSerializable
14
{
15
    const DIC = self::class;
16
    public $port = 0;
17
18
    public $protocol = 'tcp';
19
20
    public $name = null;
21
22
    public $labels = null;
23
24 5
    public function __construct($data = [])
25
    {
26 5
        MarathonEntityUtils::setAllPossibleProperties((array) $data, $this);
27 5
        if (isset($data['labels'])) {
28 1
            $this->labels = (object) $data['labels'];
29
        } else {
30 4
            $this->labels = (object) [];
31
        }
32 5
    }
33
34
    /**
35
     * @inheritdoc
36
     */
37 View Code Duplication
    public function jsonSerialize()
38
    {
39
        $return = (array) $this;
40
        $return = array_filter($return, function ($value, $key) {
0 ignored issues
show
Unused Code introduced by
The parameter $key is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
41
            return !is_null($value);
42
        }, ARRAY_FILTER_USE_BOTH);
43
        return $return;
44
    }
45
}
46