PropertyNameStrictTrait::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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