Completed
Push — master ( 530ce9...1b2ae5 )
by Paweł
23:42 queued 20:31
created

Article   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 144
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 12
c 2
b 0
f 0
lcom 2
cbo 2
dl 0
loc 144
rs 10

11 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A getTitle() 0 4 1
A setTitle() 0 8 1
A getSlug() 0 4 1
A setSlug() 0 6 1
A getContent() 0 4 1
A setContent() 0 6 1
A setRoute() 0 6 1
A getRoute() 0 4 1
A setParent() 0 10 2
A getParent() 0 4 1
1
<?php
2
3
/**
4
 * This file is part of the Superdesk Web Publisher Content Bundle.
5
 *
6
 * Copyright 2015 Sourcefabric z.u. and contributors.
7
 *
8
 * For the full copyright and license information, please see the
9
 * AUTHORS and LICENSE files distributed with this source code.
10
 *
11
 * @copyright 2015 Sourcefabric z.ú.
12
 * @license http://www.superdesk.org/license
13
 */
14
namespace SWP\Bundle\ContentBundle\Document;
15
16
use Behat\Transliterator\Transliterator;
17
use Doctrine\ODM\PHPCR\Exception\InvalidArgumentException;
18
19
class Article
20
{
21
    /**
22
     * @var int
23
     */
24
    protected $id;
25
26
    /**
27
     * @var string
28
     */
29
    protected $title;
30
31
    /**
32
     * @var string
33
     */
34
    protected $content;
35
36
    /**
37
     * @var string
38
     */
39
    protected $slug;
40
41
    /**
42
     * @var Route
43
     */
44
    protected $route;
45
46
    /**
47
     * @var object
48
     */
49
    protected $parent;
50
51
    /**
52
     * Gets the value of id.
53
     *
54
     * @return int
55
     */
56
    public function getId()
57
    {
58
        return $this->id;
59
    }
60
61
    /**
62
     * Gets the value of title.
63
     *
64
     * @return string
65
     */
66
    public function getTitle()
67
    {
68
        return $this->title;
69
    }
70
71
    /**
72
     * Sets the value of title.
73
     *
74
     * @param string $title the title
75
     *
76
     * @return self
77
     */
78
    public function setTitle($title)
79
    {
80
        $this->title = $title;
81
82
        $this->setSlug(Transliterator::urlize($this->title));
83
84
        return $this;
85
    }
86
87
    /**
88
     * Gets the value of slug.
89
     *
90
     * @return string
91
     */
92
    public function getSlug()
93
    {
94
        return $this->slug;
95
    }
96
97
    /**
98
     * Sets the value of slug.
99
     *
100
     * @param string $slug the slug
101
     *
102
     * @return self
103
     */
104
    public function setSlug($slug)
105
    {
106
        $this->slug = $slug;
107
108
        return $this;
109
    }
110
111
    /**
112
     * Gets the value of content.
113
     *
114
     * @return string
115
     */
116
    public function getContent()
117
    {
118
        return $this->content;
119
    }
120
121
    /**
122
     * Sets the value of content.
123
     *
124
     * @param string $content the content
125
     *
126
     * @return self
127
     */
128
    public function setContent($content)
129
    {
130
        $this->content = $content;
131
132
        return $this;
133
    }
134
135
    public function setRoute(Route $route)
136
    {
137
        $this->route = $route;
138
139
        return $this;
140
    }
141
142
    public function getRoute()
143
    {
144
        return $this->route;
145
    }
146
147
    public function setParent($parent)
148
    {
149
        if (!is_object($parent)) {
150
            throw new InvalidArgumentException('Parent must be an object '.gettype($parent).' given.');
151
        }
152
153
        $this->parent = $parent;
154
155
        return $this;
156
    }
157
158
    public function getParent()
159
    {
160
        return $this->parent;
161
    }
162
}
163