ApiError::fromArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
/**
3
 * This file is part of the fnayou/instapush-php project.
4
 *
5
 * Copyright (c) 2017. Aymen FNAYOU <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Fnayou\InstapushPHP\Model;
12
13
/**
14
 * Class ApiError.
15
 */
16
class ApiError implements FromArrayInterface
17
{
18
    /** @var string */
19
    private $message;
20
21
    /** @var string */
22
    private $status;
23
24
    /**
25
     * @param string $message
26
     * @param string $status
27
     */
28
    public function __construct(
29
        string $message,
30
        string $status
31
    ) {
32
        $this
33
            ->setMessage($message)
34
            ->setStatus($status);
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function getMessage()
41
    {
42
        return $this->message;
43
    }
44
45
    /**
46
     * @param string $message
47
     *
48
     * @return $this
49
     */
50
    public function setMessage(string $message)
51
    {
52
        $this->message = $message;
53
54
        return $this;
55
    }
56
57
    /**
58
     * @return string
59
     */
60
    public function getStatus()
61
    {
62
        return $this->status;
63
    }
64
65
    /**
66
     * @param string $status
67
     *
68
     * @return $this
69
     */
70
    public function setStatus(string $status)
71
    {
72
        $this->status = $status;
73
74
        return $this;
75
    }
76
77
    /**
78
     * {@inheritdoc}
79
     */
80
    public static function fromArray(array $data)
81
    {
82
        return new static(
83
            $data['msg'],
84
            $data['status']
85
        );
86
    }
87
}
88