Completed
Pull Request — master (#3)
by Aymen
02:00
created

Error::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 2
1
<?php
2
3
namespace Fnayou\InstapushPHP\Model;
4
5
/**
6
 * Class Error.
7
 */
8
class Error implements FromArrayInterface
9
{
10
    /** @var string */
11
    private $message;
12
13
    /** @var string */
14
    private $status;
15
16
    /**
17
     * @param string $message
18
     * @param string $status
19
     */
20
    public function __construct(
21
        string $message,
22
        string $status
23
    ) {
24
        $this
25
            ->setMessage($message)
26
            ->setStatus($status);
27
    }
28
29
    /**
30
     * @return string
31
     */
32
    public function getMessage()
33
    {
34
        return $this->message;
35
    }
36
37
    /**
38
     * @param string $message
39
     *
40
     * @return $this;
0 ignored issues
show
Documentation introduced by
The doc-type $this; could not be parsed: Expected "|" or "end of type", but got ";" at position 5. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
41
     */
42
    public function setMessage(string $message)
43
    {
44
        $this->message = $message;
45
46
        return $this;
47
    }
48
49
    /**
50
     * @return string
51
     */
52
    public function getStatus()
53
    {
54
        return $this->status;
55
    }
56
57
    /**
58
     * @param string $status
59
     *
60
     * @return $this
61
     */
62
    public function setStatus(string $status)
63
    {
64
        $this->status = $status;
65
66
        return $this;
67
    }
68
69
    /**
70
     * {@inheritdoc}
71
     */
72
    public static function fromArray(array $data)
73
    {
74
        return new static(
75
            $data['msg'],
76
            $data['status']
77
        );
78
    }
79
}
80