PropertyActiveStrictTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 31
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isActive() 0 4 1
A setActive() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the zibios/sharep.
7
 *
8
 * (c) Zbigniew Ślązak
9
 */
10
11
namespace App\Entity\Traits;
12
13
use ApiPlatform\Core\Annotation as OA;
14
use Doctrine\ORM\Mapping as ORM;
15
use Gedmo\Mapping\Annotation as Gedmo;
16
use Symfony\Component\Serializer\Annotation as SA;
17
use Symfony\Component\Validator\Constraints as Assert;
18
19
trait PropertyActiveStrictTrait
20
{
21
    /**
22
     * @var bool Is active. Default false.
23
     * @ORM\Column(name="active", type="boolean", nullable=false)
24
     * @Assert\NotNull()
25
     * @OA\ApiProperty(
26
     *    attributes={
27
     *        "swagger_context"={
28
     *            "example"=false
29
     *        }
30
     *     }
31
     * )
32
     * @Gedmo\Versioned
33
     * @OA\ApiFilter(ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter::class)
34
     * @SA\Groups({"read", "write"})
35
     */
36
    private $active = false;
37
38 1
    public function isActive(): bool
39
    {
40 1
        return $this->active;
41
    }
42
43 1
    public function setActive(bool $active): self
44
    {
45 1
        $this->active = $active;
46
47 1
        return $this;
48
    }
49
}
50