Application::setApacheConfig()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
/**
4
 * This file is part of the Deploy module for webcms2.
5
 * Copyright (c) @see LICENSE
6
 */
7
8
namespace WebCMS\DeployModule\Entity;
9
10
use Doctrine\ORM\Mapping as ORM;
11
12
/**
13
 * Application entity holds information about deployed app.
14
 * 
15
 * @ORM\Entity
16
 * @author Tomáš Voslař <tomas.voslar at webcook.cz>
17
 */
18
class Application extends \WebCMS\Entity\Entity
19
{
20
    /**
21
     * Name of the application.
22
     * 
23
     * @ORM\Column(name="`name`",unique=true)
24
     * @var string
25
     */
26
    private $name;
27
28
    /**
29
     * Application's path.
30
     * 
31
     * @ORM\Column()
32
     * @var string
33
     */
34
    private $path;
35
36
    /**
37
     * Name of the application database.
38
     * 
39
     * @ORM\Column(name="`database`")
40
     * @var string
41
     */
42
    private $database;
43
44
    /**
45
     * Prouction servers associated to application.
46
     * 
47
     * @orm\ManyToMany(targetEntity="Server", inversedBy="servers")
48
     * @var \Doctrine\Common\Collections\ArrayCollection<Server>
49
     */
50
    private $servers;
51
52
    /**
53
     * Apache config for virtual host.
54
     * 
55
     * @ORM\Column(type="text")
56
     * @var text
57
     */
58
    private $apacheConfig;
59
60
    /**
61
     * Constructs entity class with init of servers array collection.
62
     */
63 7
    public function __construct()
64
    {
65 7
        $this->servers = new \Doctrine\Common\Collections\ArrayCollection;
66 7
    }
67
68
    /**
69
     * Gets the value of name.
70
     *
71
     * @return string
72
     */
73 6
    public function getName()
74
    {
75 6
        return $this->name;
76
    }
77
78
    /**
79
     * Sets the value of name.
80
     *
81
     * @param string $name the name
82
     *
83
     * @return self
84
     */
85 6
    public function setName($name)
86
    {
87 6
        $this->name = $name;
88
89 6
        return $this;
90
    }
91
92
    /**
93
     * Gets the value of Path.
94
     *
95
     * @return string
96
     */
97 6
    public function getPath()
98
    {
99 6
        return $this->path;
100
    }
101
102
    /**
103
     * Sets the value of Path.
104
     *
105
     * @param string $path the path name
106
     *
107
     * @return self
108
     */
109 6
    public function setPath($path)
110
    {
111 6
        $this->path = $path;
112
113 6
        return $this;
114
    }
115
116
    /**
117
     * Gets the value of Database.
118
     *
119
     * @return string
120
     */
121 6
    public function getDatabase()
122
    {
123 6
        return $this->database;
124
    }
125
126
    /**
127
     * Sets the value of Database.
128
     *
129
     * @param string $database the database name
130
     *
131
     * @return self
132
     */
133 6
    public function setDatabase($database)
134
    {
135 6
        $this->database = $database;
136
137 6
        return $this;
138
    }
139
140
    /**
141
     * Gets the value of servers.
142
     *
143
     * @return \Doctrine\Common\Collections\ArrayCollection
144
     */
145 6
    public function getServers()
146
    {
147 6
        return $this->servers;
148
    }
149
150
151
    /**
152
     * Sets the value of server.
153
     *
154
     * @param Server $server the server
155
     *
156
     * @return void
157
     */
158 5
    public function addServer(Server $server)
159
    {
160 5
        $server->addApplication($this);
161 5
        $this->servers->add($server);
162 5
    }
163
164
    /**
165
     * Removes single element from collection.
166
     * 
167
     * @param  Server $server serve to remove
168
     * 
169
     * @return void
170
     */
171 1
    public function removeServer(Server $server)
172
    {
173 1
        $this->servers->removeElement($server);
174 1
    }
175
176
    /**
177
     * Clears servers collection.
178
     * 
179
     * @return void
180
     */
181 3
    public function removeServers()
182
    {
183 3
        $this->servers->clear();
184 3
    }
185
186
    /**
187
     * Gets the value of apacheConfig.
188
     *
189
     * @return text
190
     */
191 5
    public function getApacheConfig()
192
    {
193 5
        return $this->apacheConfig;
194
    }
195
196
    /**
197
     * Sets the value of apacheConfig.
198
     *
199
     * @param text $apacheConfig the apache config
200
     *
201
     * @return self
202
     */
203 6
    public function setApacheConfig($apacheConfig)
204
    {
205 6
        $this->apacheConfig = $apacheConfig;
206
207 6
        return $this;
208
    }
209
}
210