Article   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getId() 0 4 1
A getTitle() 0 4 1
A setTitle() 0 4 1
A getBody() 0 4 1
A setBody() 0 4 1
A getCreated() 0 4 1
A getTags() 0 4 1
A addTag() 0 4 1
1
<?php
2
3
namespace Documents;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
7
/**
8
 * @Document(indexed=true)
9
 */
10
class Article
11
{
12
    /** @Id(type="string") */
13
    protected $id;
14
    /** @Field(type="string") */
15
    protected $title;
16
    /** @Field(type="string", indexed=true) */
17
    protected $slug;
18
    /** @Field(type="string") */
19
    protected $body;
20
    /** @Field(type="datetime") */
21
    protected $created;
22
    /** @EmbedMany(targetDocument="Documents\Tag") */
23
    protected $tags;
24
25
    public function __construct()
26
    {
27
        $this->tags = new ArrayCollection();
28
        $this->created = new \DateTime("now");
29
    }
30
31
    public function getId()
32
    {
33
        return $this->id;
34
    }
35
36
    public function getTitle()
37
    {
38
        return $this->title;
39
    }
40
41
    public function setTitle($title)
42
    {
43
        $this->title = $title;
44
    }
45
46
    public function getBody()
47
    {
48
        return $this->body;
49
    }
50
51
    public function setBody($body)
52
    {
53
        $this->body = $body;
54
    }
55
56
    public function getCreated()
57
    {
58
        return $this->created;
59
    }
60
61
    public function getTags()
62
    {
63
        return $this->tags;
64
    }
65
66
    public function addTag($tag)
67
    {
68
        $this->tags[] = new Tag($tag);
69
    }
70
}