Collection   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 24
dl 0
loc 63
ccs 0
cts 20
cp 0
rs 10
c 1
b 0
f 0
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getResourceIri() 0 3 1
A setCollection() 0 5 1
A getPerPage() 0 3 1
A setPerPage() 0 5 1
A setResourceIri() 0 5 1
A getCollection() 0 3 1
A setDefaultQueryParameters() 0 5 1
A getDefaultQueryParameters() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the Silverback API Components 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\ApiComponentsBundle\Entity\Component;
15
16
use ApiPlatform\Metadata\ApiProperty;
17
use Doctrine\ORM\Mapping as ORM;
18
use Silverback\ApiComponentsBundle\Entity\Core\AbstractComponent;
19
use Silverback\ApiComponentsBundle\Validator\Constraints as AcbAssert;
20
use Symfony\Component\Validator\Constraints as Assert;
21
22
/**
23
 * @author Daniel West <[email protected]>
24
 */
25
#[ORM\Entity]
26
class Collection extends AbstractComponent
27
{
28
    #[ORM\Column(nullable: false)]
29
    #[Assert\NotNull(message: 'The resource iri for a collection component is required')]
30
    #[AcbAssert\ResourceIri]
31
    private ?string $resourceIri;
32
33
    #[ORM\Column(nullable: true, type: 'integer')]
34
    private ?int $perPage = null;
35
36
    #[ORM\Column(nullable: true, type: 'json')]
37
    private ?array $defaultQueryParameters = null;
38
39
    #[ApiProperty(writable: false)]
40
    private ?array $collection = null;
41
42
    public function getResourceIri(): ?string
43
    {
44
        return $this->resourceIri;
45
    }
46
47
    public function setResourceIri(?string $resourceIri): self
48
    {
49
        $this->resourceIri = $resourceIri;
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
    public function getCollection(): ?array
79
    {
80
        return $this->collection;
81
    }
82
83
    public function setCollection(?array $collection): self
84
    {
85
        $this->collection = $collection;
86
87
        return $this;
88
    }
89
}
90