PropertyNameStrictTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A setName() 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 PropertyNameStrictTrait
20
{
21
    /**
22
     * @var string
23
     * @ORM\Column(name="name", type="string", length=255, nullable=false)
24
     * @Assert\NotBlank()
25
     * @OA\ApiProperty(
26
     *    attributes={
27
     *        "swagger_context"={
28
     *            "example"="Test Name"
29
     *        }
30
     *     }
31
     * )
32
     * @Gedmo\Versioned
33
     * @OA\ApiFilter(ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\SearchFilter::class, strategy="partial")
34
     * @SA\Groups({"read", "write"})
35
     */
36
    private $name = '';
37
38
    public function getName(): string
39
    {
40
        return $this->name;
41
    }
42
43
    public function setName(string $name): self
44
    {
45
        $this->name = trim($name);
46
47
        return $this;
48
    }
49
}
50