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

Application::getTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
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
use Fnayou\InstapushPHP\Model\FromArrayInterface;
14
15
/**
16
 * Model Application.
17
 */
18
class Application implements FromArrayInterface
19
{
20
    /** @var string */
21
    private $title;
22
23
    /** @var string */
24
    private $appId;
25
26
    /** @var string */
27
    private $appSecret;
28
29
    /**
30
     * @param string $title
31
     * @param string $appId
32
     * @param string $appSecret
33
     */
34
    public function __construct(
35
        string $title,
36
        string $appId = null,
37
        string $appSecret = null
38
    ) {
39
        $this
40
            ->setTitle($title)
41
            ->setAppId($appId)
42
            ->setAppSecret($appSecret);
43
    }
44
45
    /**
46
     * @return string
47
     */
48
    public function getTitle()
49
    {
50
        return $this->title;
51
    }
52
53
    /**
54
     * @param string $title
55
     *
56
     * @return $this
57
     */
58
    public function setTitle(string $title)
59
    {
60
        $this->title = $title;
61
62
        return $this;
63
    }
64
65
    /**
66
     * @return string
67
     */
68
    public function getAppId()
69
    {
70
        return $this->appId;
71
    }
72
73
    /**
74
     * @param string $appId
75
     *
76
     * @return $this
77
     */
78
    public function setAppId(string $appId)
79
    {
80
        $this->appId = $appId;
81
82
        return $this;
83
    }
84
85
    /**
86
     * @return string
87
     */
88
    public function getAppSecret()
89
    {
90
        return $this->appSecret;
91
    }
92
93
    /**
94
     * @param string $appSecret
95
     *
96
     * @return $this
97
     */
98
    public function setAppSecret(string $appSecret)
99
    {
100
        $this->appSecret = $appSecret;
101
102
        return $this;
103
    }
104
105
    /**
106
     * {@inheritdoc}
107
     */
108
    public static function fromArray(array $data)
109
    {
110
        return new static(
111
            $data['title'],
112
            $data['appID'],
113
            $data['appSecret']
114
        );
115
    }
116
}
117