Completed
Push — master ( 36d725...742cf9 )
by Paweł
20s queued 10s
created

ArticlesAwareTrait   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 46
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getArticles() 0 4 1
A setArticles() 0 4 1
A addArticle() 0 4 1
A getArticlesUpdatedAt() 0 4 1
A setArticlesUpdatedAt() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Superdesk Web Publisher Content Bundle.
5
 *
6
 * Copyright 2017 Sourcefabric z.ú. 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 2017 Sourcefabric z.ú
12
 * @license http://www.superdesk.org/license
13
 */
14
15
namespace SWP\Bundle\ContentBundle\Model;
16
17
use Doctrine\Common\Collections\Collection;
18
19
trait ArticlesAwareTrait
20
{
21
    /**
22
     * @var Collection
23
     */
24
    protected $articles;
25
26
    /**
27
     * @var \DateTime
28
     */
29
    protected $articlesUpdatedAt;
30
31
    /**
32
     * @return Collection
33
     */
34
    public function getArticles(): Collection
35
    {
36
        return $this->articles;
37
    }
38
39
    /**
40
     * @param Collection $articles
41
     */
42
    public function setArticles(Collection $articles): void
43
    {
44
        $this->articles = $articles;
45
    }
46
47
    /**
48
     * @param ArticleInterface $article
49
     */
50
    public function addArticle(ArticleInterface $article): void
51
    {
52
        $this->articles->add($article);
53
    }
54
55
    public function getArticlesUpdatedAt(): ?\DateTime
56
    {
57
        return $this->articlesUpdatedAt;
58
    }
59
60
    public function setArticlesUpdatedAt(\DateTime $articlesUpdatedAt): void
61
    {
62
        $this->articlesUpdatedAt = $articlesUpdatedAt;
63
    }
64
}
65