Completed
Push — master ( eb83f4...bb238e )
by Maximilian
14s
created

Content   A

Complexity

Total Complexity 23

Size/Duplication

Total Lines 257
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Importance

Changes 0
Metric Value
wmc 23
lcom 2
cbo 1
dl 0
loc 257
rs 10
c 0
b 0
f 0

23 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getId() 0 4 1
A getNode() 0 4 1
A setParentDocument() 0 6 1
A getParentDocument() 0 4 1
A setName() 0 6 1
A getName() 0 4 1
A getTitle() 0 4 1
A setTitle() 0 6 1
A getBody() 0 4 1
A setBody() 0 6 1
A getChild() 0 4 1
A setChild() 0 4 1
A getChildren() 0 4 1
A setChildren() 0 4 1
A getSingleRoute() 0 4 1
A setSingleRoute() 0 4 1
A getRoutes() 0 4 1
A setRoutes() 0 4 1
A addRoute() 0 4 1
A removeRoute() 0 4 1
A addChild() 0 4 1
A removeChild() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Symfony CMF package.
5
 *
6
 * (c) 2011-2017 Symfony CMF
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\Resources\Document;
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
class Content
22
{
23
    /**
24
     * @PHPCRODM\Id
25
     */
26
    protected $id;
27
28
    /**
29
     * @PHPCRODM\Node
30
     */
31
    protected $node;
32
33
    /**
34
     * @PHPCRODM\ParentDocument
35
     */
36
    protected $parentDocument;
37
38
    /**
39
     * @PHPCRODM\Nodename
40
     */
41
    protected $name;
42
43
    /**
44
     * @PHPCRODM\Field(type="string")
45
     */
46
    protected $title;
47
48
    /**
49
     * @PHPCRODM\Child()
50
     *
51
     * @var Content
52
     */
53
    protected $child;
54
55
    /**
56
     * @PHPCRODM\Children()
57
     *
58
     * @var ArrayCollection|Content[]
59
     */
60
    protected $children;
61
62
    /**
63
     * @PHPCRODM\ReferenceOne(targetDocument="Sonata\DoctrinePHPCRAdminBundle\Tests\Resources\Document\Content")
64
     *
65
     * @var Content
66
     */
67
    protected $singleRoute;
68
69
    /**
70
     * @PHPCRODM\ReferenceMany(targetDocument="Sonata\DoctrinePHPCRAdminBundle\Tests\Resources\Document\Content")
71
     *
72
     * @var ArrayCollection|Content[]
73
     */
74
    protected $routes;
75
76
    public function __construct()
77
    {
78
        $this->children = new ArrayCollection();
79
        $this->routes = new ArrayCollection();
80
    }
81
82
    /**
83
     * @return mixed
84
     */
85
    public function getId()
86
    {
87
        return $this->id;
88
    }
89
90
    /**
91
     * Gets the underlying PHPCR node of this content.
92
     *
93
     * @return NodeInterface
94
     */
95
    public function getNode()
96
    {
97
        return $this->node;
98
    }
99
100
    /**
101
     * Sets the parent document.
102
     *
103
     * @param object $parent the parent document
104
     */
105
    public function setParentDocument($parent)
106
    {
107
        $this->parentDocument = $parent;
108
109
        return $this;
110
    }
111
112
    /**
113
     * Gets the parent document.
114
     *
115
     * @return object
116
     */
117
    public function getParentDocument()
118
    {
119
        return $this->parentDocument;
120
    }
121
122
    /**
123
     * Sets the document name.
124
     *
125
     * @param string $name
126
     */
127
    public function setName($name)
128
    {
129
        $this->name = $name;
130
131
        return $this;
132
    }
133
134
    /**
135
     * Gets the document name.
136
     *
137
     * @return string
138
     */
139
    public function getName()
140
    {
141
        return $this->name;
142
    }
143
144
    /**
145
     * @return string
146
     */
147
    public function getTitle()
148
    {
149
        return $this->title;
150
    }
151
152
    /**
153
     * @param string $title
154
     */
155
    public function setTitle($title)
156
    {
157
        $this->title = $title;
158
159
        return $this;
160
    }
161
162
    /**
163
     * @return string
164
     */
165
    public function getBody()
166
    {
167
        return $this->body;
0 ignored issues
show
Bug introduced by ElectricMaxxx
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...
168
    }
169
170
    /**
171
     * @param string $body
172
     *
173
     * @return Content
174
     */
175
    public function setBody($body)
176
    {
177
        $this->body = $body;
178
179
        return $this;
180
    }
181
182
    /**
183
     * @return Content
184
     */
185
    public function getChild()
186
    {
187
        return $this->child;
188
    }
189
190
    /**
191
     * @param mixed $child
192
     */
193
    public function setChild($child)
194
    {
195
        $this->child = $child;
196
    }
197
198
    /**
199
     * @return mixed
200
     */
201
    public function getChildren()
202
    {
203
        return $this->children;
204
    }
205
206
    /**
207
     * @param mixed $children
208
     */
209
    public function setChildren($children)
210
    {
211
        $this->children = $children;
212
    }
213
214
    /**
215
     * @return mixed
216
     */
217
    public function getSingleRoute()
218
    {
219
        return $this->singleRoute;
220
    }
221
222
    /**
223
     * @param mixed $singleRoute
224
     */
225
    public function setSingleRoute($singleRoute)
226
    {
227
        $this->singleRoute = $singleRoute;
228
    }
229
230
    /**
231
     * @return ArrayCollection|Content[]
232
     */
233
    public function getRoutes()
234
    {
235
        return $this->routes;
236
    }
237
238
    /**
239
     * @param ArrayCollection|Content[] $routes
240
     */
241
    public function setRoutes($routes)
242
    {
243
        $this->routes = $routes;
244
    }
245
246
    /**
247
     * @param $route
248
     */
249
    public function addRoute($route)
250
    {
251
        $this->routes->add($route);
252
    }
253
254
    /**
255
     * @param $route
256
     */
257
    public function removeRoute($route)
258
    {
259
        $this->routes->removeElement($route);
260
    }
261
262
    /**
263
     * @param $child
264
     */
265
    public function addChild($child)
266
    {
267
        $this->children->add($child);
268
    }
269
270
    /**
271
     * @param $child
272
     */
273
    public function removeChild($child)
274
    {
275
        $this->children->removeElement($child);
276
    }
277
}
278