ResourceAttributeMetadata   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 103
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 11
lcom 0
cbo 0
dl 0
loc 103
rs 10
c 0
b 0
f 0

11 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getName() 0 4 1
A getDescription() 0 4 1
A setDescription() 0 4 1
A isRequired() 0 4 1
A setRequired() 0 4 1
A getType() 0 4 1
A setType() 0 4 1
A getOriginalType() 0 4 1
A setOriginalType() 0 4 1
A __sleep() 0 10 1
1
<?php
2
3
/*
4
 * This file is part of the "elao/api-resources-metadata" package.
5
 *
6
 * Copyright (C) 2016 Elao
7
 *
8
 * @author Elao <[email protected]>
9
 */
10
11
namespace Elao\ApiResourcesMetadata\Attribute;
12
13
final class ResourceAttributeMetadata
14
{
15
    /**
16
     * @var string
17
     *
18
     * @internal Public in order to reduce the size of the class' serialized representation.
19
     */
20
    public $name;
21
22
    /**
23
     * @var string
24
     *
25
     * @internal Public in order to reduce the size of the class' serialized representation.
26
     */
27
    public $description;
28
29
    /**
30
     * @var bool
31
     *
32
     * @internal Public in order to reduce the size of the class' serialized representation.
33
     */
34
    public $required = true;
35
36
    /**
37
     * @var string
38
     *
39
     * @internal Public in order to reduce the size of the class' serialized representation.
40
     */
41
    public $type;
42
43
    /**
44
     * @var string
45
     *
46
     * @internal Public in order to reduce the size of the class' serialized representation.
47
     */
48
    public $originalType;
49
50
    public function __construct(string $name)
51
    {
52
        $this->name = $name;
53
    }
54
55
    public function getName()
56
    {
57
        return $this->name;
58
    }
59
60
    public function getDescription()
61
    {
62
        return $this->description;
63
    }
64
65
    public function setDescription(string $description)
66
    {
67
        $this->description = $description;
68
    }
69
70
    public function isRequired(): bool
71
    {
72
        return $this->required;
73
    }
74
75
    public function setRequired(bool $required)
76
    {
77
        $this->required = $required;
78
    }
79
80
    public function getType()
81
    {
82
        return $this->type;
83
    }
84
85
    public function setType(string $type)
86
    {
87
        $this->type = $type;
88
    }
89
90
    public function getOriginalType()
91
    {
92
        return $this->originalType;
93
    }
94
95
    public function setOriginalType(string $originalType)
96
    {
97
        $this->originalType = $originalType;
98
    }
99
100
    /**
101
     * Returns the names of the properties that should be serialized.
102
     *
103
     * @return string[]
104
     */
105
    public function __sleep()
106
    {
107
        return [
108
            'name',
109
            'description',
110
            'required',
111
            'type',
112
            'originalType',
113
        ];
114
    }
115
}
116