Organization::setSlug()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace App\Model;
4
5
abstract class Organization implements \JsonSerializable
6
{
7
    /** @var string **/
8
    protected $name;
9
    /** @var string **/
10
    protected $slug;
11
    /** @var string **/
12
    protected $type;
13
    /** @var string **/
14
    protected $description;
15
    /** @var \DateTime **/
16
    protected $createdAt;
17
    /** @var \DateTime **/
18
    protected $updatedAt;
19
    
20
    const TYPE_ASSOCIATION = 'association';
21
    const TYPE_SMALL_COMPANY = 'small_company';
22
    const TYPE_MEDIUM_COMPANY = 'medium_company';
23
24 3
    public static function getTypes(): array
25
    {
26
        return [
27 3
            self::TYPE_ASSOCIATION,
28 3
            self::TYPE_SMALL_COMPANY,
29 3
            self::TYPE_MEDIUM_COMPANY
30
        ];
31
    }
32
    
33 5
    public function setName(string $name): Organization
34
    {
35 5
        $this->name = $name;
36
37 5
        return $this;
38
    }
39
40 1
    public function getName(): string
41
    {
42 1
        return $this->name;
43
    }
44
45 5
    public function setSlug(string $slug): Organization
46
    {
47 5
        $this->slug = $slug;
48
49 5
        return $this;
50
    }
51
52 1
    public function getSlug(): string
53
    {
54 1
        return $this->slug;
55
    }
56
    
57 5
    public function setType(string $type): Organization
58
    {
59 5
        $this->type = $type;
60
        
61 5
        return $this;
62
    }
63
    
64 1
    public function getType(): string
65
    {
66 1
        return $this->type;
67
    }
68
69 5
    public function setDescription(string $description): Organization
70
    {
71 5
        $this->description = $description;
72
73 5
        return $this;
74
    }
75
76 1
    public function getDescription(): string
77
    {
78 1
        return $this->description;
79
    }
80
81 3
    public function setCreatedAt(\DateTime $createdAt): Organization
82
    {
83 3
        $this->createdAt = $createdAt;
84
85 3
        return $this;
86
    }
87
88
    public function getCreatedAt(): \DateTime
89
    {
90
        return $this->createdAt;
91
    }
92
93 3
    public function setUpdatedAt(\DateTime $updatedAt): Organization
94
    {
95 3
        $this->updatedAt = $updatedAt;
96
97 3
        return $this;
98
    }
99
100
    public function getUpdatedAt(): \DateTime
101
    {
102
        return $this->updatedAt;
103
    }
104
    
105
    public function jsonSerialize(): array
106
    {
107
        return [
108
            'id' => $this->id,
109
            'name' => $this->name,
110
            'slug' => $this->slug,
111
            'description' => $this->description,
112
            'type' => $this->type,
113
            'created_at' => $this->createdAt,
114
            'updated_at' => $this->updatedAt
115
        ];
116
    }
117
}