Passed
Push — master ( e67af9...64baeb )
by Luiz Kim
09:26 queued 01:57
created

Module::getColor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 1
c 2
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace ControleOnline\Entity;
4
5
use ApiPlatform\Metadata\GetCollection;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\GetCollection was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use ApiPlatform\Metadata\Get;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Get was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use ApiPlatform\Metadata\ApiResource;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\ApiResource was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use ApiPlatform\Metadata\Delete;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Delete was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use ApiPlatform\Metadata\Post;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Post was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use ApiPlatform\Metadata\Put;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Put was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Doctrine\ORM\Mapping as ORM;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\Mapping was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Symfony\Component\Serializer\Annotation\Groups;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Serializer\Annotation\Groups was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
14
15
/**
16
 * Module
17
 *
18
 * @ORM\EntityListeners ({App\Listener\LogListener::class})
19
 * @ORM\Table (name="module", uniqueConstraints={@ORM\UniqueConstraint (name="UX_MODULE_NAME", columns={"name"})})
20
 * @ORM\Entity
21
 * @ORM\Entity (repositoryClass="ControleOnline\Repository\ModuleRepository")
22
 */
23
#[ApiResource(
24
    operations: [
25
        new Get(security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))'),
26
        new Put(
27
            security: 'is_granted(\'ROLE_CLIENT\')',
28
            denormalizationContext: ['groups' => ['module_write']]
29
        ),
30
        new Delete(security: 'is_granted(\'ROLE_CLIENT\')'),
31
        new Post(security: 'is_granted(\'ROLE_CLIENT\')'),
32
        new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')')
33
    ],
34
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
35
    normalizationContext: ['groups' => ['module_read']],
36
    denormalizationContext: ['groups' => ['module_write']]
37
)]
38
class Module
39
{
40
    /**
41
     * @var int
42
     *
43
     * @ORM\Column(name="id", type="integer", nullable=false)
44
     * @ORM\Id
45
     * @ORM\GeneratedValue(strategy="IDENTITY")
46
     * @Groups({"menu_read","module_read"}) 
47
     */
48
    private $id;
49
    /**
50
     * @var string
51
     *
52
     * @ORM\Column(name="name", type="string", length=100, nullable=false)
53
     * @Groups({"menu_read","module_read","module_write"})  
54
     */
55
    private $name;
56
    /**
57
     * @var string
58
     *
59
     * @ORM\Column(name="color", type="string", length=50, nullable=false, options={"default"="'$primary'"})
60
     * @Groups({"menu_read","module_read","module_write"})   
61
     */
62
    private $color = '$primary';
63
    /**
64
     * @var string
65
     *
66
     * @ORM\Column(name="icon", type="string", length=50, nullable=false)
67
     * @Groups({"menu_read","module_read","module_write"})   
68
     */
69
    private $icon;
70
    /**
71
     * @var string|null
72
     *
73
     * @ORM\Column(name="description", type="string", length=255, nullable=true, options={"default"="NULL"})
74
     * @Groups({"menu_read","module_read","module_write"})   
75
     */
76
    private $description = NULL;
77
    /**
78
     * Get the value of id
79
     */
80
    public function getId(): int
81
    {
82
        return $this->id;
83
    }
84
    /**
85
     * Get the value of name
86
     */
87
    public function getName(): string
88
    {
89
        return $this->name;
90
    }
91
    /**
92
     * Set the value of name
93
     */
94
    public function setName(string $name): self
95
    {
96
        $this->name = $name;
97
        return $this;
98
    }
99
    /**
100
     * Get the value of color
101
     */
102
    public function getColor(): string
103
    {
104
        return $this->color;
105
    }
106
    /**
107
     * Set the value of color
108
     */
109
    public function setColor(string $color): self
110
    {
111
        $this->color = $color;
112
        return $this;
113
    }
114
    /**
115
     * Get the value of icon
116
     */
117
    public function getIcon(): string
118
    {
119
        return $this->icon;
120
    }
121
    /**
122
     * Set the value of icon
123
     */
124
    public function setIcon(string $icon): self
125
    {
126
        $this->icon = $icon;
127
        return $this;
128
    }
129
    /**
130
     * Get the value of description
131
     */
132
    public function getDescription(): ?string
133
    {
134
        return $this->description;
135
    }
136
    /**
137
     * Set the value of description
138
     */
139
    public function setDescription(?string $description): self
140
    {
141
        $this->description = $description;
142
        return $this;
143
    }
144
}
145