ItemsTrait::addItem()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: siim
5
 * Date: 31.01.19
6
 * Time: 9:45
7
 */
8
9
namespace Sf4\Api\Dto\Traits;
10
11
use Doctrine\Common\Collections\ArrayCollection;
12
use Sf4\Api\Dto\DtoInterface;
13
14
trait ItemsTrait
15
{
16
    /** @var ArrayCollection $items */
17
    protected $items;
18
19
    /** @var int $total */
20
    protected $total = 0;
21
22
    /** @var int $count */
23
    protected $count = 0;
24
25
    /**
26
     * @param DtoInterface $dto
27
     */
28
    public function addItem(DtoInterface $dto): void
29
    {
30
        $this->items->add($dto);
31
    }
32
33
    /**
34
     * @return int
35
     */
36
    public function getTotal(): int
37
    {
38
        return $this->total;
39
    }
40
41
    /**
42
     * @param int $total
43
     */
44
    public function setTotal(int $total): void
45
    {
46
        $this->total = $total;
47
    }
48
49
    /**
50
     * @return int
51
     */
52
    public function getCount(): int
53
    {
54
        return $this->count;
55
    }
56
57
    /**
58
     * @param int $count
59
     */
60
    public function setCount(int $count): void
61
    {
62
        $this->count = $count;
63
    }
64
}
65