Passed
Push — develop ( 32fbc0...1b1d1e )
by Daniel
05:39
created

Collection::setPerPage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Silverback\ApiComponentBundle\Entity\Content\Component\Collection;
4
5
use ApiPlatform\Core\Annotation\ApiResource;
6
use Doctrine\ORM\Mapping as ORM;
7
use Silverback\ApiComponentBundle\Entity\Content\Component\AbstractComponent;
8
use Symfony\Component\Serializer\Annotation\Groups;
9
10
/**
11
 * @ORM\Entity()
12
 * @ApiResource()
13
 * @author Daniel West <[email protected]>
14
 */
15
class Collection extends AbstractComponent
16
{
17
    /**
18
     * @ORM\Column()
19
     * @Groups({"component", "content"})
20
     * @var string
21
     */
22
    private $resource;
23
24
    /**
25
     * @ORM\Column(type="integer")
26
     * @Groups({"component", "content"})
27
     * @var int
28
     */
29
    private $perPage = 12;
30
31
    /**
32
     * @var array|\Traversable
33
     * @Groups({"component_read", "content_read"})
34
     */
35
    private $collection;
36
37
    /**
38
     * @return string
39
     */
40 1
    public function getResource(): string
41
    {
42 1
        return $this->resource;
43
    }
44
45
    /**
46
     * @param string $resource
47
     */
48 1
    public function setResource(string $resource): void
49
    {
50 1
        $this->resource = $resource;
51 1
    }
52
53
    /**
54
     * @return int
55
     */
56 1
    public function getPerPage(): int
57
    {
58 1
        return $this->perPage;
59
    }
60
61
    /**
62
     * @param int $perPage
63
     */
64 1
    public function setPerPage(int $perPage): void
65
    {
66 1
        $this->perPage = $perPage;
67 1
    }
68
69
    /**
70
     * @return array|\Traversable
71
     */
72
    public function getCollection()
73
    {
74
        return $this->collection;
75
    }
76
77
    /**
78
     * @param array|\Traversable $collection
79
     */
80
    public function setCollection($collection): void
81
    {
82
        $this->collection = $collection;
83
    }
84
85
    /**
86
     * @ORM\PostLoad()
87
     */
88
    public function postLoad() {
89
90
    }
91
}
92