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

Error   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 0
dl 0
loc 72
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getMessage() 0 4 1
A setMessage() 0 6 1
A getStatus() 0 4 1
A setStatus() 0 6 1
A fromArray() 0 7 1
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