AmbassadorMember::setDescription()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace AppBundle\Entity\Infrasctucture;
4
5
use AppBundle\Entity\User;
6
use Doctrine\ORM\Mapping as ORM;
7
use JMS\Serializer\Annotation as Serializer;
8
9
/**
10
 * @author Vehsamrak
11
 * @ORM\MappedSuperclass
12
 */
13
abstract class AmbassadorMember
14
{
15
16
    /**
17
     * @ORM\Id
18
     * @ORM\ManyToOne(targetEntity="AppBundle\Entity\User")
19
     * @ORM\JoinColumn(name="user_id", referencedColumnName="login")
20
     * @Serializer\Accessor("getUserLogin")
21
     * @Serializer\Type("string")
22
     * @Serializer\SerializedName("login")
23
     */
24
    protected $user;
25
26
    /**
27
     * @var string
28
     * @ORM\Column(name="short_description", type="text", nullable=false)
29
     * @Serializer\SerializedName("short_description")
30
     */
31
    protected $shortDescription;
32
33
    /**
34
     * @var string
35
     * @ORM\Column(name="description", type="text", nullable=true)
36
     */
37
    protected $description;
38
39
    /**
40
     * @var Ambassador
41
     * @Serializer\Exclude
42
     */
43
    protected $ambassador;
44
45 7
    public function __construct(
46
        Ambassador $ambassador,
47
        User $user,
48
        string $shortDescription = '',
49
        string $description = null
50
    ) {
51 7
        $this->user = $user;
52 7
        $this->ambassador = $ambassador;
53 7
        $this->shortDescription = $shortDescription;
54 7
        $this->description = $description;
55 7
    }
56
57 1
    public function setShortDescription(string $shortDescription)
58
    {
59 1
        $this->shortDescription = $shortDescription;
60 1
    }
61
62 1
    public function setDescription(string $description)
63
    {
64 1
        $this->description = $description;
65 1
    }
66
67 8
    public function getUserLogin(): string
68
    {
69 8
        return $this->user->getLogin();
70
    }
71
}
72