Passed
Push — master ( ecb751...b15917 )
by Daniel
06:52
created

ComponentPosition   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 26
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getSortCollection() 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\Core;
15
16
use ApiPlatform\Core\Annotation\ApiResource;
17
use Doctrine\Common\Collections\Collection;
18
use Silverback\ApiComponentsBundle\Annotation as Silverback;
19
use Silverback\ApiComponentsBundle\Entity\Utility\IdTrait;
20
use Silverback\ApiComponentsBundle\Entity\Utility\TimestampedTrait;
21
use Silverback\ApiComponentsBundle\Validator\Constraints as AcbAssert;
22
use Symfony\Component\Validator\Constraints as Assert;
23
24
/**
25
 * @author Daniel West <[email protected]>
26
 *
27
 * @Silverback\Timestamped
28
 * @ApiResource(attributes={"order"={"sortValue"="ASC"}})
29
 * @AcbAssert\ComponentPosition
30
 */
31
class ComponentPosition
32
{
33
    use IdTrait;
34
    use TimestampedTrait;
35
36
    /**
37
     * @Assert\NotNull()
38
     */
39
    public ComponentCollection $componentCollection;
40
41
    /**
42
     * @Assert\NotNull()
43
     */
44
    public AbstractComponent $component;
45
46
    /**
47
     * @Assert\NotNull()
48
     */
49
    public int $sortValue = 0;
50
51
    /**
52
     * @return Collection|AbstractComponent[]|null
53
     */
54
    public function getSortCollection(): ?Collection
55
    {
56
        return $this->componentCollection->componentPositions;
57
    }
58
}
59