CmsArticle   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setAuthor() 0 3 1
A addComment() 0 4 1
1
<?php
2
3
namespace Doctrine\Tests\Models\CMS;
4
5
/**
6
 * @Document
7
 */
8
class CmsArticle
9
{
10
    /** @Id */
11
    public $id;
12
    /** @Field(type="string") */
13
    public $topic;
14
    /** @Field(type="string") */
15
    public $text;
16
    /** @ReferenceOne(targetDocument="CmsUser") */
17
    public $user;
18
    public $comments;
19
    /** @Version */
20
    public $version;
21
22
    /** @Attachments */
23
    public $attachments;
24
    
25
    public function setAuthor(CmsUser $author) {
26
        $this->user = $author;
27
    }
28
29
    public function addComment(CmsComment $comment) {
30
        $this->comments[] = $comment;
31
        $comment->setArticle($this);
32
    }
33
}
34