Test Setup Failed
Push — develop ( 47a494...4bd721 )
by Daniel
04:03
created

Collection   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 97
Duplicated Lines 0 %

Test Coverage

Coverage 58.81%

Importance

Changes 0
Metric Value
dl 0
loc 97
ccs 10
cts 17
cp 0.5881
rs 10
c 0
b 0
f 0
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A setCollection() 0 3 1
A postLoad() 0 1 1
A setResource() 0 3 1
A setPerPage() 0 3 1
A getTitle() 0 3 1
A getCollection() 0 3 1
A setTitle() 0 3 1
A getResource() 0 3 1
A getPerPage() 0 3 1
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
     * @ORM\Column(nullable=true)
33
     * @Groups({"component", "content"})
34
     * @var string|null
35
     */
36
    private $title;
37
38
    /**
39
     * @var array|\Traversable
40 1
     * @Groups({"component_read", "content_read"})
41
     */
42 1
    private $collection;
43
44
    /**
45
     * @return string
46
     */
47
    public function getResource(): string
48 2
    {
49
        return $this->resource;
50 2
    }
51 2
52
    /**
53
     * @param string $resource
54
     */
55
    public function setResource(string $resource): void
56 1
    {
57
        $this->resource = $resource;
58 1
    }
59
60
    /**
61
     * @return int
62
     */
63
    public function getPerPage(): int
64 1
    {
65
        return $this->perPage;
66 1
    }
67 1
68
    /**
69
     * @param int $perPage
70
     */
71
    public function setPerPage(int $perPage): void
72
    {
73
        $this->perPage = $perPage;
74
    }
75
76
    /**
77
     * @return null|string
78
     */
79
    public function getTitle(): ?string
80
    {
81
        return $this->title;
82
    }
83
84
    /**
85
     * @param null|string $title
86
     */
87
    public function setTitle(?string $title): void
88
    {
89
        $this->title = $title;
90
    }
91
92
    /**
93
     * @return array|\Traversable
94
     */
95
    public function getCollection()
96
    {
97
        return $this->collection;
98
    }
99
100
    /**
101
     * @param array|\Traversable $collection
102
     */
103
    public function setCollection($collection): void
104
    {
105
        $this->collection = $collection;
106
    }
107
108
    /**
109
     * @ORM\PostLoad()
110
     */
111
    public function postLoad() {
112
113
    }
114
}
115