Completed
Pull Request — master (#506)
by Paweł
21:46 queued 11:28
created

ExternalArticle::setArticle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Superdesk Web Publisher Core Bundle.
7
 *
8
 * Copyright 2018 Sourcefabric z.ú. and contributors.
9
 *
10
 * For the full copyright and license information, please see the
11
 * AUTHORS and LICENSE files distributed with this source code.
12
 *
13
 * @copyright 2018 Sourcefabric z.ú
14
 * @license http://www.superdesk.org/license
15
 */
16
17
namespace SWP\Bundle\CoreBundle\Model;
18
19
use SWP\Component\MultiTenancy\Model\TenantAwareTrait;
20
use SWP\Component\OutputChannel\Model\ExternalArticle as BaseExternalArticle;
21
22
class ExternalArticle extends BaseExternalArticle implements ExternalArticleInterface
23
{
24
    use TenantAwareTrait;
25
26
    /**
27
     * @var TenantInterface
28
     */
29
    protected $tenant;
30
31
    /**
32
     * @var ArticleInterface
33
     */
34
    protected $article;
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function __construct(ArticleInterface $article, string $externalId, string $status)
40
    {
41
        $this->setArticle($article);
42
        $this->setExternalId($externalId);
43
        $this->setStatus($status);
44
45
        parent::__construct();
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function getArticle(): ArticleInterface
52
    {
53
        return $this->article;
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59
    public function setArticle(ArticleInterface $article): void
60
    {
61
        $this->article = $article;
62
        $article->setExternalArticle($this);
63
    }
64
65
    /**
66
     * {@inheritdoc}
67
     */
68
    public function getTenant(): TenantInterface
69
    {
70
        return $this->tenant;
71
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76
    public function setTenant(TenantInterface $tenant): void
77
    {
78
        $this->tenant = $tenant;
79
    }
80
}
81