Completed
Push — v2 ( d0d63b...85e3cb )
by Daniel
04:19
created

Collection   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 13
dl 0
loc 52
ccs 0
cts 15
cp 0
rs 10
c 3
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setDefaultQueryParameters() 0 5 1
A getPerPage() 0 3 1
A getDefaultQueryParameters() 0 3 1
A setResourceClass() 0 5 1
A setPerPage() 0 5 1
A getResourceClass() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the Silverback API Component Bundle Project
5
 *
6
 * (c) Daniel West <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Silverback\ApiComponentBundle\Entity\Component;
15
16
use Doctrine\ORM\Mapping as ORM;
17
use Silverback\ApiComponentBundle\Entity\Core\AbstractComponent;
18
use Symfony\Component\Validator\Constraints as Assert;
19
20
/**
21
 * @author Daniel West <[email protected]>
22
 * @ORM\Entity
23
 */
24
class Collection extends AbstractComponent
25
{
26
    /**
27
     * @ORM\Column(nullable=false)
28
     * @Assert\NotNull(message="The resource class for a collection component is required")
29
     */
30
    private string $resourceClass;
31
32
    /**
33
     * @ORM\Column(type="integer", nullable=true)
34
     */
35
    private ?int $perPage;
36
37
    /**
38
     * @ORM\Column(type="array", nullable=true)
39
     */
40
    private ?array $defaultQueryParameters;
41
42
    public function getResourceClass(): string
43
    {
44
        return $this->resourceClass;
45
    }
46
47
    public function setResourceClass(string $resourceClass): self
48
    {
49
        $this->resourceClass = $resourceClass;
50
51
        return $this;
52
    }
53
54
    public function getPerPage(): ?int
55
    {
56
        return $this->perPage;
57
    }
58
59
    public function setPerPage(?int $perPage): self
60
    {
61
        $this->perPage = $perPage;
62
63
        return $this;
64
    }
65
66
    public function getDefaultQueryParameters(): ?array
67
    {
68
        return $this->defaultQueryParameters;
69
    }
70
71
    public function setDefaultQueryParameters(?array $defaultQueryParameters): self
72
    {
73
        $this->defaultQueryParameters = $defaultQueryParameters;
74
75
        return $this;
76
    }
77
}
78