Passed
Push — master ( 457869...26d7e0 )
by Luiz Kim
02:20
created

Config   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 189
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 11
eloc 44
c 4
b 0
f 0
dl 0
loc 189
rs 10

11 Methods

Rating   Name   Duplication   Size   Complexity  
A setConfigKey() 0 4 1
A getId() 0 3 1
A getVisibility() 0 3 1
A getPeople() 0 3 1
A getModule() 0 3 1
A setVisibility() 0 4 1
A setPeople() 0 4 1
A getConfigKey() 0 3 1
A setConfigValue() 0 4 1
A getConfigValue() 0 3 1
A setModule() 0 5 1
1
<?php
2
3
namespace ControleOnline\Entity;
4
5
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Doctrine\Orm\Filter\SearchFilter 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 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...
7
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...
8
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...
9
use ApiPlatform\Metadata\ApiProperty;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\ApiProperty 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\ApiFilter;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\ApiFilter 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 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...
13
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...
14
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...
15
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...
16
17
/**
18
 * @ORM\EntityListeners ({ControleOnline\Listener\LogListener::class})
19
 * @ORM\Table (name="config", uniqueConstraints={@ORM\UniqueConstraint (name="people_id", columns={"people_id","config_key"})})
20
 * @ORM\Entity (repositoryClass="ControleOnline\Repository\ConfigRepository")
21
 */
22
#[ApiResource(
23
    operations: [
24
        new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'),
25
        new Delete(security: 'is_granted(\'ROLE_CLIENT\')'),
26
        new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')'),
27
        new Post(security: 'is_granted(\'ROLE_CLIENT\')'),
28
        new Put(
29
            security: 'is_granted(\'ROLE_CLIENT\')',
30
            denormalizationContext: ['groups' => ['config_write']]
31
        ),
32
        new GetCollection(
33
            security: 'is_granted(\'IS_AUTHENTICATED_ANONYMOUSLY\')',
34
            uriTemplate: '/configs/app-config',
35
            controller: \App\Controller\GetAppConfigAction::class
36
        )
37
    ],
38
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
39
    normalizationContext: ['groups' => ['config_read']],
40
    denormalizationContext: ['groups' => ['config_write']]
41
)]
42
class Config
43
{
44
    /**
45
     * @var integer
46
     *
47
     * @ORM\Column(name="id", type="integer", nullable=false)
48
     * @ORM\Id
49
     * @ORM\GeneratedValue(strategy="IDENTITY")
50
     * @Groups({"config_read"}) 
51
     */
52
    private $id;
53
    /**
54
     * @var \ControleOnline\Entity\People
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\People 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...
55
     *
56
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People")
57
     * @ORM\JoinColumns({
58
     *   @ORM\JoinColumn(name="people_id", referencedColumnName="id")
59
     * })
60
     * @Groups({"config_read","config_write"}) 
61
     */
62
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['people' => 'exact'])]
63
64
    private $people;
65
    /**
66
     * @var string
67
     *
68
     * @ORM\Column(name="config_key", type="string", length=255, nullable=false)
69
     * @Groups({"config_read","config_write"}) 
70
     */
71
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['config_key' => 'exact'])]
72
73
    private $config_key;
74
    /**
75
     * @var string
76
     *
77
     * @ORM\Column(name="visibility", type="string", length=255, nullable=false)
78
     * @Groups({"config_read","config_write"}) 
79
80
     */
81
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['visibility' => 'exact'])]
82
83
    private $visibility;
84
    /**
85
     * @var string
86
     *
87
     * @ORM\Column(name="config_value", type="string", length=255, nullable=false)
88
     * @Groups({"config_read","config_write"}) 
89
     */
90
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['config_value' => 'exact'])]
91
92
    private $config_value;
93
    /**
94
     * @var \ControleOnline\Entity\Module
95
     *
96
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Module")
97
     * @ORM\JoinColumns({
98
     *   @ORM\JoinColumn(name="module_id", referencedColumnName="id")
99
     * })
100
     * @Groups({"config_read","config_write"}) 
101
     */
102
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['module' => 'exact'])]
103
    private $module;
104
105
    /**
106
     * Get id
107
     *
108
     * @return integer
109
     */
110
    public function getId()
111
    {
112
        return $this->id;
113
    }
114
    /**
115
     * Set people
116
     *
117
     * @param \ControleOnline\Entity\People $people
118
     * @return PeopleConfigKey
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\PeopleConfigKey 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...
119
     */
120
    public function setPeople(People $people = null)
121
    {
122
        $this->people = $people;
123
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type ControleOnline\Entity\Config which is incompatible with the documented return type ControleOnline\Entity\PeopleConfigKey.
Loading history...
124
    }
125
    /**
126
     * Get people
127
     *
128
     * @return \ControleOnline\Entity\People
129
     */
130
    public function getPeople()
131
    {
132
        return $this->people;
133
    }
134
    /**
135
     * Set config_key
136
     *
137
     * @param string config_key
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\config_key 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...
138
     * @return PeopleConfigKey
139
     */
140
    public function setConfigKey($config_key)
141
    {
142
        $this->config_key = $config_key;
143
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type ControleOnline\Entity\Config which is incompatible with the documented return type ControleOnline\Entity\PeopleConfigKey.
Loading history...
144
    }
145
    /**
146
     * Get config_key
147
     *
148
     * @return string
149
     */
150
    public function getConfigKey()
151
    {
152
        return $this->config_key;
153
    }
154
    /**
155
     * Set visibility
156
     *
157
     * @param string visibility
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\visibility 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...
158
     * @return Config
159
     */
160
    public function setVisibility($visibility)
161
    {
162
        $this->visibility = $visibility;
163
        return $this;
164
    }
165
    /**
166
     * Get visibility
167
     *
168
     * @return string
169
     */
170
    public function getVisibility()
171
    {
172
        return $this->visibility;
173
    }
174
    /**
175
     * Set config_value
176
     *
177
     * @param string config_value
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\config_value 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...
178
     * @return PeopleConfigKey
179
     */
180
    public function setConfigValue($config_value)
181
    {
182
        $this->config_value = $config_value;
183
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type ControleOnline\Entity\Config which is incompatible with the documented return type ControleOnline\Entity\PeopleConfigKey.
Loading history...
184
    }
185
    /**
186
     * Get config_value
187
     *
188
     * @return string
189
     */
190
    public function getConfigValue()
191
    {
192
        return $this->config_value;
193
    }
194
195
    /**
196
     * Get the value of module
197
     */
198
    public function getModule()
199
    {
200
        return $this->module;
201
    }
202
203
    /**
204
     * Set the value of module
205
     */
206
    public function setModule($module): self
207
    {
208
        $this->module = $module;
209
210
        return $this;
211
    }
212
}
213