Article::getId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 1
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Khepin\Fixture\Document;
4
5
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
6
use Doctrine\Common\Collections\ArrayCollection;
7
8
/**
9
 * @ODM\Document
10
 */
11
class Article
12
{
13
    /**
14
     * @ODM\Id
15
     */
16
    private $id;
17
18
    /**
19
     * @ODM\String
20
     */
21
    private $title;
22
23
    /**
24
     * @ODM\EmbedOne(targetDocument="Author")
25
     */
26
    private $author;
27
28
    /**
29
     * @ODM\EmbedMany(targetDocument="Tag")
30
     */
31
    private $tags;
32
33
    /**
34
     * @ODM\String
35
     * @var type
36
     */
37
    private $content;
38
39
    public function __construct()
40
    {
41
        $this->comments = new ArrayCollection;
0 ignored issues
show
Bug introduced by
The property comments 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...
42
    }
43
44
    public function getId()
45
    {
46
        return $this->id;
47
    }
48
49
    public function getTitle()
50
    {
51
        return $this->title;
52
    }
53
54
    public function setTitle($title)
55
    {
56
        $this->title = $title;
57
    }
58
59
    public function getContent()
60
    {
61
        return $this->content;
62
    }
63
64
    public function setContent($content)
65
    {
66
        $this->content = $content;
67
    }
68
69
    public function getAuthor()
70
    {
71
        return $this->author;
72
    }
73
74
    public function setAuthor(Author $author)
75
    {
76
        $this->author = $author;
77
    }
78
79
    public function getTags()
80
    {
81
        return $this->tags;
82
    }
83
84
    public function addTags(Tag $tag)
85
    {
86
        $this->tags[] = $tag;
87
    }
88
}
89