AbstractCategoryArticleMessage   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getCategoryId() 0 4 1
A setCategoryId() 0 4 1
A getArticleIds() 0 4 1
A setArticleIds() 0 4 1
A build() 0 7 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Yproximite\Api\Message\Article;
5
6
use Yproximite\Api\Message\MessageInterface;
7
use Yproximite\Api\Message\SiteAwareMessageTrait;
8
9
/**
10
 * Class AbstractCategoryArticleMessage
11
 */
12
abstract class AbstractCategoryArticleMessage implements MessageInterface
13
{
14
    use SiteAwareMessageTrait;
15
16
    /**
17
     * @var int
18
     */
19
    private $categoryId;
20
21
    /**
22
     * @var int[]
23
     */
24
    private $articleIds = [];
25
26
    /**
27
     * @return int
28
     */
29
    public function getCategoryId(): int
30
    {
31
        return $this->categoryId;
32
    }
33
34
    /**
35
     * @param int $categoryId
36
     */
37
    public function setCategoryId(int $categoryId)
38
    {
39
        $this->categoryId = $categoryId;
40
    }
41
42
    /**
43
     * @return int[]
44
     */
45
    public function getArticleIds(): array
46
    {
47
        return $this->articleIds;
48
    }
49
50
    /**
51
     * @param int[] $articleIds
52
     */
53
    public function setArticleIds(array $articleIds)
54
    {
55
        $this->articleIds = $articleIds;
56
    }
57
58
    /**
59
     * {@inheritdoc}
60
     */
61
    public function build()
62
    {
63
        return [
64
            'category' => $this->getCategoryId(),
65
            'articles' => $this->getArticleIds(),
66
        ];
67
    }
68
}
69