Alias::getSource()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace Samurai\Alias;
3
4
use Balloon\Mapper\IArrayCastable;
5
6
/**
7
 * Class Alias
8
 * @package Samurai\alias
9
 * @author Raphaël Lefebvre <[email protected]>
10
 */
11
class Alias implements IArrayCastable
12
{
13
    /**
14
     * @var string
15
     */
16
    private $name;
17
18
    /**
19
     * @var string
20
     */
21
    private $description;
22
23
    /**
24
     * @var string
25
     */
26
    private $package;
27
28
    /**
29
     * @var string
30
     */
31
    private $version;
32
33
    /**
34
     * @var string
35
     */
36
    private $source;
37
38
    /**
39
     * Getter of $name
40
     *
41
     * @return string
42
     */
43 38
    public function getName()
44
    {
45 38
        return $this->name;
46
    }
47
48
    /**
49
     * Setter of $name
50
     *
51
     * @param string $name
52
     */
53 61
    public function setName($name)
54
    {
55 61
        $this->name = (string)$name;
56 61
    }
57
58
    /**
59
     * Getter of $description
60
     *
61
     * @return string
62
     */
63 14
    public function getDescription()
64
    {
65 14
        return $this->description;
66
    }
67
68
    /**
69
     * Setter of $description
70
     *
71
     * @param string $description
72
     */
73 49
    public function setDescription($description)
74
    {
75 49
        $this->description = (string)$description;
76 49
    }
77
78
    /**
79
     * Getter of $package
80
     *
81
     * @return string
82
     */
83 42
    public function getPackage()
84
    {
85 42
        return $this->package;
86
    }
87
88
    /**
89
     * Setter of $package
90
     *
91
     * @param string $package
92
     */
93 70
    public function setPackage($package)
94
    {
95 70
        $this->package = (string)$package;
96 70
    }
97
98
    /**
99
     * Getter of $version
100
     *
101
     * @return string
102
     */
103 26
    public function getVersion()
104
    {
105 26
        return $this->version;
106
    }
107
108
    /**
109
     * Setter of $version
110
     *
111
     * @param string $version
112
     */
113 54
    public function setVersion($version)
114
    {
115 54
        $this->version = (string)$version;
116 54
    }
117
118
    /**
119
     * Getter of $source
120
     *
121
     * @return string
122
     */
123 12
    public function getSource()
124
    {
125 12
        return $this->source;
126
    }
127
128
    /**
129
     * Setter of $source
130
     *
131
     * @param string $source
132
     */
133 32
    public function setSource($source)
134
    {
135 32
        $this->source = (string)$source;
136 32
    }
137
138
    /**
139
     * @return array
140
     */
141 18
    public function toArray()
142
    {
143 18
        return get_object_vars($this);
144
    }
145
146
    /**
147
     * @return string
148
     */
149
    public function __toString(){
150
        return $this->getDescription()
151
        . ' ('
152
        . trim($this->getPackage() . ' ' . $this->getVersion())
153
        . ')';
154
    }
155
}
156