Completed
Push — master ( 42db1b...a35559 )
by Paweł
16s
created

ContentListItem   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 118
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 92%

Importance

Changes 0
Metric Value
wmc 11
lcom 0
cbo 3
dl 0
loc 118
ccs 23
cts 25
cp 0.92
rs 10
c 0
b 0
f 0

11 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getId() 0 4 1
A getContentList() 0 4 1
A setContentList() 0 4 1
A getContent() 0 4 1
A setContent() 0 4 1
A getPosition() 0 4 1
A setPosition() 0 4 1
A isSticky() 0 4 1
A getSticky() 0 4 1
A setSticky() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Superdesk Web Publisher Content List Component.
7
 *
8
 * Copyright 2016 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 2016 Sourcefabric z.ú
14
 * @license http://www.superdesk.org/license
15
 */
16
17
namespace SWP\Component\ContentList\Model;
18
19
use SWP\Component\Common\Model\EnableableTrait;
20
use SWP\Component\Common\Model\SoftDeletableTrait;
21
use SWP\Component\Common\Model\TimestampableTrait;
22
23
class ContentListItem implements ContentListItemInterface
24
{
25
    use TimestampableTrait, SoftDeletableTrait, EnableableTrait;
26
27
    /**
28
     * @var mixed
29
     */
30
    protected $id;
31
32
    /**
33
     * @var ContentListInterface
34
     */
35
    protected $contentList;
36
37
    /**
38
     * @var ListContentInterface
39
     */
40
    protected $content;
41
42
    /**
43
     * @var int
44
     */
45
    protected $position;
46
47
    /**
48
     * @var bool
49
     */
50
    protected $sticky = false;
51
52
    /**
53
     * ContentListItem constructor.
54
     */
55 7
    public function __construct()
56
    {
57 7
        $this->createdAt = new \DateTime();
58 7
        $this->position = 0;
59
    }
60
61
    /**
62
     * {@inheritdoc}
63 4
     */
64
    public function getId()
65 4
    {
66
        return $this->id;
67
    }
68
69
    /**
70
     * {@inheritdoc}
71 4
     */
72
    public function getContentList(): ContentListInterface
73 4
    {
74
        return $this->contentList;
75
    }
76
77
    /**
78
     * {@inheritdoc}
79 7
     */
80
    public function setContentList(ContentListInterface $contentList = null)
81 7
    {
82 7
        $this->contentList = $contentList;
83
    }
84
85
    /**
86
     * {@inheritdoc}
87 1
     */
88
    public function getContent(): ListContentInterface
89 1
    {
90
        return $this->content;
91
    }
92
93
    /**
94
     * {@inheritdoc}
95 7
     */
96
    public function setContent(ListContentInterface $content)
97 7
    {
98 7
        $this->content = $content;
99
    }
100
101
    /**
102
     * {@inheritdoc}
103
     */
104
    public function getPosition()
105
    {
106
        return $this->position;
107
    }
108
109
    /**
110
     * {@inheritdoc}
111 7
     */
112
    public function setPosition(int $position)
113 7
    {
114 7
        $this->position = $position;
115
    }
116
117
    /**
118
     * {@inheritdoc}
119 1
     */
120
    public function isSticky(): bool
121 1
    {
122
        return $this->sticky;
123
    }
124
125
    /**
126
     * {@inheritdoc}
127 5
     */
128
    public function getSticky(): bool
129 5
    {
130 5
        return $this->sticky;
131
    }
132
133
    /**
134
     * {@inheritdoc}
135
     */
136
    public function setSticky(bool $sticky)
137
    {
138
        $this->sticky = $sticky;
139
    }
140
}
141