Completed
Push — v2 ( e6c7b3...40717e )
by Beñat
06:35
created

Error::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Stack Exchange Api Client library.
5
 *
6
 * Copyright (c) 2014-2016 Beñat Espiña <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace BenatEspina\StackExchangeApiClient\Model;
13
14
/**
15
 * Class error model class.
16
 *
17
 * @author Beñat Espiña <[email protected]>
18
 */
19
class Error implements Model
20
{
21
    protected $id;
22
    protected $name;
23
    protected $description;
24
25
    public static function fromJson(array $data)
26
    {
27
        $instance = new self();
28
        $instance
29
            ->setId(array_key_exists('error_id', $data) ? $data['error_id'] : null)
30
            ->setName(array_key_exists('error_name', $data) ? $data['error_name'] : null)
31
            ->setDescription(array_key_exists('description', $data) ? $data['description'] : null);
32
33
        return $instance;
34
    }
35
36
    public static function fromProperties($id, $name, $description)
37
    {
38
        $instance = new self();
39
        $instance
40
            ->setId($id)
41
            ->setName($name)
42
            ->setDescription($description);
43
44
        return $instance;
45
    }
46
47
    public function getId()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
48
    {
49
        return $this->id;
50
    }
51
52
    public function setId($id)
53
    {
54
        $this->id = $id;
55
56
        return $this;
57
    }
58
59
    public function getName()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
60
    {
61
        return $this->name;
62
    }
63
64
    public function setName($name)
65
    {
66
        $this->name = $name;
67
68
        return $this;
69
    }
70
71
    public function getDescription()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
72
    {
73
        return $this->description;
74
    }
75
76
    public function setDescription($description)
77
    {
78
        $this->description = $description;
79
80
        return $this;
81
    }
82
}
83