Completed
Pull Request — 2.x (#521)
by Maximilian
01:46
created

Content::setTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Sonata Project package.
5
 *
6
 * (c) Thomas Rabaix <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sonata\DoctrinePHPCRAdminBundle\Tests\Fixtures\App\Document\PHPCR;
13
14
use Doctrine\Common\Collections\ArrayCollection;
15
use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM;
16
use PHPCR\NodeInterface;
17
18
/**
19
 * @PHPCRODM\Document(referenceable=true)
20
21
 */
22
class Content
23
{
24
    /**
25
     * @PHPCRODM\Id
26
     */
27
    protected $id;
28
29
    /**
30
     * @PHPCRODM\Node
31
     */
32
    protected $node;
33
34
    /**
35
     * @PHPCRODM\ParentDocument
36
     */
37
    protected $parentDocument;
38
39
    /**
40
     * @PHPCRODM\Nodename
41
     */
42
    protected $name;
43
44
    /**
45
     * @PHPCRODM\Field(type="string")
46
     */
47
    protected $title;
48
49
    /**
50
     * @PHPCRODM\Child()
51
     *
52
     * @var Content
53
     */
54
    protected $child;
55
56
    /**
57
     * @PHPCRODM\Children()
58
     *
59
     * @var ArrayCollection|Content[]
60
     */
61
    protected $children;
62
63
    /**
64
     * @PHPCRODM\ReferenceOne(targetDocument="Sonata\DoctrinePHPCRAdminBundle\Tests\Fixtures\App\Document\PHPCR\Content")
65
     *
66
     * @var Content
67
     */
68
    protected $singleRoute;
69
70
    /**
71
     * @PHPCRODM\ReferenceMany(targetDocument="Sonata\DoctrinePHPCRAdminBundle\Tests\Fixtures\App\Document\PHPCR\Content")
72
     *
73
     * @var ArrayCollection|Content[]
74
     */
75
    protected $routes;
76
77
    public function __construct()
78
    {
79
        $this->children = new ArrayCollection();
80
        $this->routes = new ArrayCollection();
81
    }
82
83
    /**
84
     * @return mixed
85
     */
86
    public function getId()
87
    {
88
        return $this->id;
89
    }
90
91
    /**
92
     * Gets the underlying PHPCR node of this content.
93
     *
94
     * @return NodeInterface
95
     */
96
    public function getNode()
97
    {
98
        return $this->node;
99
    }
100
101
    /**
102
     * Sets the parent document.
103
     *
104
     * @param object $parent the parent document
105
     */
106
    public function setParentDocument($parent)
107
    {
108
        $this->parentDocument = $parent;
109
110
        return $this;
111
    }
112
113
    /**
114
     * Gets the parent document.
115
     *
116
     * @return object
117
     */
118
    public function getParentDocument()
119
    {
120
        return $this->parentDocument;
121
    }
122
123
    /**
124
     * Sets the document name.
125
     *
126
     * @param string $name
127
     */
128
    public function setName($name)
129
    {
130
        $this->name = $name;
131
132
        return $this;
133
    }
134
135
    /**
136
     * Gets the document name.
137
     *
138
     * @return string
139
     */
140
    public function getName()
141
    {
142
        return $this->name;
143
    }
144
145
    /**
146
     * @return string
147
     */
148
    public function getTitle()
149
    {
150
        return $this->title;
151
    }
152
153
    /**
154
     * @param string $title
155
     */
156
    public function setTitle($title)
157
    {
158
        $this->title = $title;
159
160
        return $this;
161
    }
162
163
    /**
164
     * @return string
165
     */
166
    public function getBody()
167
    {
168
        return $this->body;
0 ignored issues
show
Bug introduced by
The property body does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
169
    }
170
171
    /**
172
     * @param string $body
173
     *
174
     * @return Content
175
     */
176
    public function setBody($body)
177
    {
178
        $this->body = $body;
179
180
        return $this;
181
    }
182
183
    /**
184
     * @return Content
185
     */
186
    public function getChild()
187
    {
188
        return $this->child;
189
    }
190
191
    /**
192
     * @param mixed $child
193
     */
194
    public function setChild($child)
195
    {
196
        $this->child = $child;
197
    }
198
199
    /**
200
     * @return mixed
201
     */
202
    public function getChildren()
203
    {
204
        return $this->children;
205
    }
206
207
    /**
208
     * @param mixed $children
209
     */
210
    public function setChildren($children)
211
    {
212
        $this->children = $children;
213
    }
214
215
    /**
216
     * @return mixed
217
     */
218
    public function getSingleRoute()
219
    {
220
        return $this->singleRoute;
221
    }
222
223
    /**
224
     * @param mixed $singleRoute
225
     */
226
    public function setSingleRoute($singleRoute)
227
    {
228
        $this->singleRoute = $singleRoute;
229
    }
230
231
    /**
232
     * @return ArrayCollection|Content[]
233
     */
234
    public function getRoutes()
235
    {
236
        return $this->routes;
237
    }
238
239
    /**
240
     * @param ArrayCollection|Content[] $routes
241
     */
242
    public function setRoutes($routes)
243
    {
244
        $this->routes = $routes;
245
    }
246
247
    /**
248
     * @param $route
249
     */
250
    public function addRoute($route)
251
    {
252
        $this->routes->add($route);
253
    }
254
255
    /**
256
     * @param $route
257
     */
258
    public function removeRoute($route)
259
    {
260
        $this->routes->removeElement($route);
261
    }
262
263
    /**
264
     * @param $child
265
     */
266
    public function addChild($child)
267
    {
268
        $this->children->add($child);
269
    }
270
271
    /**
272
     * @param $child
273
     */
274
    public function removeChild($child)
275
    {
276
        $this->children->removeElement($child);
277
    }
278
}
279