ItemsTrait   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 49
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setTotal() 0 3 1
A addItem() 0 3 1
A getCount() 0 3 1
A getTotal() 0 3 1
A setCount() 0 3 1
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