Passed
Push — master ( 649994...e6dc91 )
by Luiz Kim
02:31
created

ContractPeople   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 151
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 10
eloc 40
c 3
b 0
f 0
dl 0
loc 151
rs 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A getPeopleType() 0 3 1
A setPeopleType() 0 5 1
A setId() 0 5 1
A getPeople() 0 3 1
A getContract() 0 3 1
A setPeople() 0 5 1
A getId() 0 3 1
A setContract() 0 5 1
A setContractPercentage() 0 5 1
A getContractPercentage() 0 3 1
1
<?php
2
3
namespace ControleOnline\Entity;
4
5
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...
6
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...
7
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...
8
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...
9
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...
10
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...
11
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...
12
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...
13
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...
14
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...
15
16
/**
17
 * @ORM\Table (name="contract_people")
18
 * @ORM\EntityListeners ({ControleOnline\Listener\LogListener::class})
19
 * @ORM\Entity (repositoryClass="ControleOnline\Repository\ContractPeopleRepository")
20
 */
21
22
#[ApiResource(
23
    operations: [
24
        new Get(security: 'is_granted(\'ROLE_CLIENT\')'),
25
        new Put(
26
            security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))',
27
            validationContext: ['groups' => ['people_write']],
28
            denormalizationContext: ['groups' => ['people_write']]
29
        ),
30
        new Delete(security: 'is_granted(\'ROLE_CLIENT\')'),
31
        new Post(
32
            security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))',
33
        ),
34
        new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')'),
35
36
    ],
37
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
38
    security: 'is_granted(\'ROLE_CLIENT\')',
39
    normalizationContext: ['groups' => ['contract_people_read']],
40
    denormalizationContext: ['groups' => ['contract_people_write']]
41
)]
42
class ContractPeople
43
{
44
    /**
45
     * @ORM\Column(type="integer", nullable=false)
46
     * @ORM\Id
47
     * @ORM\GeneratedValue(strategy="IDENTITY")
48
     * @Groups("contract_read","contract_people_read")
49
     */
50
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])]
51
52
    private $id;
53
    /**
54
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Contract")
55
     * @ORM\JoinColumns({
56
     *   @ORM\JoinColumn(name="contract_id", referencedColumnName="id", nullable=false)
57
     * })
58
     * @Groups("contract_people_read")
59
     */
60
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['contract.id' => 'exact'])]
61
    private $contract;
62
    /**
63
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People", inversedBy="contractsPeople")
64
     * @ORM\JoinColumns({
65
     *   @ORM\JoinColumn(name="people_id", referencedColumnName="id", nullable=false)
66
     * })
67
     * @Groups("contract_read","contract_people_read")
68
     */
69
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['people.id' => 'exact'])]
70
71
    private $people;
72
    /**
73
     * @ORM\Column(name="people_type", type="string", columnDefinition="enum('Beneficiary', 'Witness', 'Payer', 'Provider')")
74
     * @Groups("contract_read","contract_people_read")
75
     */
76
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['people_type' => 'exact'])]
77
    private $people_type;
78
    /**
79
     * @ORM\Column(name="contract_percentage", type="float",  nullable=true)
80
     * @Groups("contract_read","contract_people_read")
81
     */
82
    private $contract_percentage;
83
84
85
    /**
86
     * Get the value of id
87
     */
88
    public function getId()
89
    {
90
        return $this->id;
91
    }
92
93
    /**
94
     * Set the value of id
95
     */
96
    public function setId($id): self
97
    {
98
        $this->id = $id;
99
100
        return $this;
101
    }
102
103
    /**
104
     * Get the value of contract
105
     */
106
    public function getContract()
107
    {
108
        return $this->contract;
109
    }
110
111
    /**
112
     * Set the value of contract
113
     */
114
    public function setContract($contract): self
115
    {
116
        $this->contract = $contract;
117
118
        return $this;
119
    }
120
121
    /**
122
     * Get the value of people
123
     */
124
    public function getPeople()
125
    {
126
        return $this->people;
127
    }
128
129
    /**
130
     * Set the value of people
131
     */
132
    public function setPeople($people): self
133
    {
134
        $this->people = $people;
135
136
        return $this;
137
    }
138
139
    /**
140
     * Get the value of people_type
141
     */
142
    public function getPeopleType()
143
    {
144
        return $this->people_type;
145
    }
146
147
    /**
148
     * Set the value of people_type
149
     */
150
    public function setPeopleType($people_type): self
151
    {
152
        $this->people_type = $people_type;
153
154
        return $this;
155
    }
156
157
    /**
158
     * Get the value of contract_percentage
159
     */
160
    public function getContractPercentage()
161
    {
162
        return $this->contract_percentage;
163
    }
164
165
    /**
166
     * Set the value of contract_percentage
167
     */
168
    public function setContractPercentage($contract_percentage): self
169
    {
170
        $this->contract_percentage = $contract_percentage;
171
172
        return $this;
173
    }
174
}
175