| Total Complexity | 56 |
| Total Lines | 667 |
| Duplicated Lines | 0 % |
| Changes | 10 | ||
| Bugs | 0 | Features | 0 |
Complex classes like People often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use People, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 32 | #[ApiResource( |
||
| 33 | operations: [ |
||
| 34 | |||
| 35 | new Get(security: 'is_granted(\'ROLE_CLIENT\')'), |
||
| 36 | new Put( |
||
| 37 | security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))', |
||
| 38 | validationContext: ['groups' => ['people_write']], |
||
| 39 | denormalizationContext: ['groups' => ['people_write']] |
||
| 40 | ), |
||
| 41 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
||
| 42 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
||
| 43 | new Post( |
||
| 44 | uriTemplate: '/people/{id}/add-user', |
||
| 45 | controller: CreateUserAction::class, |
||
| 46 | securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')', |
||
| 47 | ), |
||
| 48 | new GetCollection( |
||
| 49 | securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')', |
||
| 50 | ), |
||
| 51 | new GetCollection( |
||
| 52 | security: 'is_granted(\'IS_AUTHENTICATED_ANONYMOUSLY\')', |
||
| 53 | uriTemplate: '/people/company/default', |
||
| 54 | controller: GetDefaultCompanyAction::class |
||
| 55 | ), |
||
| 56 | new GetCollection( |
||
| 57 | uriTemplate: '/people/companies/my', |
||
| 58 | controller: GetMyCompaniesAction::class |
||
| 59 | ), |
||
| 60 | |||
| 61 | new GetCollection( |
||
| 62 | uriTemplate: '/people/professionals/close/{lat}/{lng}', |
||
| 63 | openapiContext: [], |
||
| 64 | controller: GetCloseProfessionalsAction::class |
||
| 65 | ) |
||
| 66 | ], |
||
| 67 | formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
||
| 68 | security: 'is_granted(\'ROLE_CLIENT\')', |
||
| 69 | normalizationContext: ['groups' => ['people_read']], |
||
| 70 | denormalizationContext: ['groups' => ['people_write']] |
||
| 71 | )] |
||
| 72 | class People |
||
| 73 | { |
||
| 74 | /** |
||
| 75 | * @ORM\Column(type="integer", nullable=false) |
||
| 76 | * @ORM\Id |
||
| 77 | * @ORM\GeneratedValue(strategy="IDENTITY") |
||
| 78 | * @Groups({ |
||
| 79 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", "invoice_read", |
||
| 80 | * "order_detail_status_read", "mycontract_read", |
||
| 81 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 82 | * "task_read", "task_interaction_read","coupon_read","logistic_read", |
||
| 83 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read", "productsByDay_read" |
||
| 84 | * }) |
||
| 85 | */ |
||
| 86 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
||
| 87 | |||
| 88 | private $id; |
||
| 89 | /** |
||
| 90 | * @ORM\Column(type="boolean", nullable=false) |
||
| 91 | * @Groups({ |
||
| 92 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", "invoice_read", |
||
| 93 | * "order_detail_status_read", "mycontract_read", |
||
| 94 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 95 | * "task_read", "task_interaction_read","coupon_read","logistic_read", |
||
| 96 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read", "productsByDay_read" |
||
| 97 | * }) |
||
| 98 | */ |
||
| 99 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['enable' => 'exact'])] |
||
| 100 | |||
| 101 | private $enable = 0; |
||
| 102 | |||
| 103 | /** |
||
| 104 | * @ORM\Column(type="string", length=50, nullable=false) |
||
| 105 | * @Groups({ |
||
| 106 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", "invoice_read", |
||
| 107 | * "order_detail_status_read", "mycontract_read", |
||
| 108 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 109 | * "task_read", "task_interaction_read","coupon_read","logistic_read", |
||
| 110 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read", "productsByDay_read" |
||
| 111 | * }) |
||
| 112 | */ |
||
| 113 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['name' => 'partial'])] |
||
| 114 | |||
| 115 | private $name; |
||
| 116 | /** |
||
| 117 | * @ORM\Column(type="datetime", nullable=false, columnDefinition="DATETIME") |
||
| 118 | */ |
||
| 119 | private $registerDate; |
||
| 120 | /** |
||
| 121 | * @ORM\Column(type="string", length=50, nullable=false) |
||
| 122 | * @Groups({ |
||
| 123 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", "invoice_read", |
||
| 124 | * "order_detail_status_read", "mycontract_read", |
||
| 125 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 126 | * "task_read", "task_interaction_read","coupon_read","logistic_read", |
||
| 127 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read" |
||
| 128 | * }) |
||
| 129 | */ |
||
| 130 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['alias' => 'partial'])] |
||
| 131 | |||
| 132 | private $alias; |
||
| 133 | /** |
||
| 134 | * @var string |
||
| 135 | * |
||
| 136 | * @ORM\Column(name="other_informations", type="json", nullable=true) |
||
| 137 | * @Groups({ |
||
| 138 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", "invoice_read", |
||
| 139 | * "order_detail_status_read", "mycontract_read", |
||
| 140 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 141 | * "task_read", "task_interaction_read","coupon_read","logistic_read", |
||
| 142 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read" |
||
| 143 | * }) |
||
| 144 | */ |
||
| 145 | private $otherInformations; |
||
| 146 | /** |
||
| 147 | * @ORM\Column(type="string", length=1, nullable=false) |
||
| 148 | * @Groups({ |
||
| 149 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", "invoice_read", |
||
| 150 | * "order_detail_status_read", "mycontract_read", |
||
| 151 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 152 | * "task_read", "task_interaction_read","coupon_read","logistic_read", |
||
| 153 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read" |
||
| 154 | * }) |
||
| 155 | */ |
||
| 156 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['peopleType' => 'exact'])] |
||
| 157 | |||
| 158 | private $peopleType = 'F'; |
||
| 159 | |||
| 160 | /** |
||
| 161 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\File", inversedBy="people") |
||
| 162 | * @ORM\JoinColumns({ |
||
| 163 | * @ORM\JoinColumn(name="image_id", referencedColumnName="id") |
||
| 164 | * }) |
||
| 165 | * @Groups({ |
||
| 166 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", "invoice_read", |
||
| 167 | * "order_detail_status_read", "mycontract_read", |
||
| 168 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 169 | * "task_interaction_read","coupon_read","logistic_read", |
||
| 170 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read" |
||
| 171 | * }) |
||
| 172 | */ |
||
| 173 | private $image; |
||
| 174 | /** |
||
| 175 | * @var Collection |
||
| 176 | * |
||
| 177 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\Config", mappedBy="people") |
||
| 178 | * @ORM\OrderBy({"config_key" = "ASC"}) |
||
| 179 | */ |
||
| 180 | private $config; |
||
| 181 | /** |
||
| 182 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\File") |
||
| 183 | * @ORM\JoinColumns({ |
||
| 184 | * @ORM\JoinColumn(name="alternative_image", referencedColumnName="id") |
||
| 185 | * }) |
||
| 186 | * @Groups({ |
||
| 187 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", "invoice_read", |
||
| 188 | * "order_detail_status_read", "mycontract_read", |
||
| 189 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 190 | * "task_interaction_read","coupon_read","logistic_read", |
||
| 191 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read" |
||
| 192 | * }) |
||
| 193 | */ |
||
| 194 | private $alternative_image; |
||
| 195 | /** |
||
| 196 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\File") |
||
| 197 | * @ORM\JoinColumns({ |
||
| 198 | * @ORM\JoinColumn(name="background_image", referencedColumnName="id") |
||
| 199 | * }) |
||
| 200 | * @Groups({ |
||
| 201 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", "invoice_read", |
||
| 202 | * "order_detail_status_read", "mycontract_read", |
||
| 203 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 204 | * "task_interaction_read","coupon_read","logistic_read", |
||
| 205 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read" |
||
| 206 | * }) |
||
| 207 | */ |
||
| 208 | private $background; |
||
| 209 | /** |
||
| 210 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Language", inversedBy="people") |
||
| 211 | * @ORM\JoinColumns({ |
||
| 212 | * @ORM\JoinColumn(name="language_id", referencedColumnName="id") |
||
| 213 | * }) |
||
| 214 | */ |
||
| 215 | private $language; |
||
| 216 | /** |
||
| 217 | * @var Collection |
||
| 218 | * |
||
| 219 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\PeopleLink", mappedBy="company") |
||
| 220 | */ |
||
| 221 | private $company; |
||
| 222 | |||
| 223 | /** |
||
| 224 | * @var Collection |
||
| 225 | * |
||
| 226 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\PeopleLink", mappedBy="people") |
||
| 227 | * |
||
| 228 | */ |
||
| 229 | private $link; |
||
| 230 | |||
| 231 | /** |
||
| 232 | * @var Collection |
||
| 233 | * |
||
| 234 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\User", mappedBy="people") |
||
| 235 | * @ORM\OrderBy({"username" = "ASC"}) |
||
| 236 | * @Groups({ |
||
| 237 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", |
||
| 238 | * "order_detail_status_read", "mycontract_read", |
||
| 239 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 240 | * "task_read", "task_interaction_read","coupon_read","logistic_read", |
||
| 241 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read" |
||
| 242 | * }) |
||
| 243 | */ |
||
| 244 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['user' => 'exact'])] |
||
| 245 | |||
| 246 | private $user; |
||
| 247 | /** |
||
| 248 | * @var Collection |
||
| 249 | * |
||
| 250 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\Document", mappedBy="people") |
||
| 251 | * @Groups({ |
||
| 252 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", |
||
| 253 | * "order_detail_status_read", "mycontract_read", |
||
| 254 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 255 | * "task_read", "task_interaction_read","coupon_read","logistic_read", |
||
| 256 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read" |
||
| 257 | * }) |
||
| 258 | */ |
||
| 259 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['document' => 'exact'])] |
||
| 260 | |||
| 261 | private $document; |
||
| 262 | /** |
||
| 263 | * @var Collection |
||
| 264 | * |
||
| 265 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\Address", mappedBy="people") |
||
| 266 | * @ORM\OrderBy({"nickname" = "ASC"}) |
||
| 267 | * @Groups({ |
||
| 268 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", |
||
| 269 | * "order_detail_status_read", "mycontract_read", |
||
| 270 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 271 | * "task_read", "task_interaction_read","coupon_read","logistic_read", |
||
| 272 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read" |
||
| 273 | * }) |
||
| 274 | */ |
||
| 275 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['address' => 'exact'])] |
||
| 276 | |||
| 277 | private $address; |
||
| 278 | /** |
||
| 279 | * @var Collection |
||
| 280 | * |
||
| 281 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\Phone", mappedBy="people") |
||
| 282 | * @Groups({ |
||
| 283 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", |
||
| 284 | * "order_detail_status_read", "mycontract_read", |
||
| 285 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 286 | * "task_read", "task_interaction_read","coupon_read","logistic_read", |
||
| 287 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read" |
||
| 288 | * }) |
||
| 289 | */ |
||
| 290 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['phone' => 'exact'])] |
||
| 291 | |||
| 292 | private $phone; |
||
| 293 | /** |
||
| 294 | * @var Collection |
||
| 295 | * |
||
| 296 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\Email", mappedBy="people") |
||
| 297 | * @Groups({ |
||
| 298 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", |
||
| 299 | * "order_detail_status_read", "mycontract_read", |
||
| 300 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 301 | * "task_read", "task_interaction_read","coupon_read","logistic_read", |
||
| 302 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read" |
||
| 303 | * }) |
||
| 304 | */ |
||
| 305 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['email' => 'exact'])] |
||
| 306 | |||
| 307 | private $email; |
||
| 308 | /** |
||
| 309 | * Many Peoples have Many Contracts. |
||
| 310 | * |
||
| 311 | * @ORM\OneToMany (targetEntity="ControleOnline\Entity\ContractPeople", mappedBy="people") |
||
| 312 | */ |
||
| 313 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['contractsPeople' => 'exact'])] |
||
| 314 | |||
| 315 | private $contractsPeople; |
||
| 316 | |||
| 317 | /** |
||
| 318 | * @ORM\Column(type="datetime", nullable=false, columnDefinition="DATETIME") |
||
| 319 | * @Groups({ |
||
| 320 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", "invoice_read", |
||
| 321 | * "order_detail_status_read", "mycontract_read", |
||
| 322 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 323 | * "task_read", "task_interaction_read","coupon_read","logistic_read", |
||
| 324 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read" |
||
| 325 | * }) |
||
| 326 | */ |
||
| 327 | private $foundationDate = null; |
||
| 328 | |||
| 329 | |||
| 330 | public function __construct() |
||
| 331 | { |
||
| 332 | $this->enable = 0; |
||
| 333 | $this->registerDate = new \DateTime('now'); |
||
| 334 | $this->company = new \Doctrine\Common\Collections\ArrayCollection(); |
||
| 335 | $this->config = new \Doctrine\Common\Collections\ArrayCollection(); |
||
| 336 | $this->link = new \Doctrine\Common\Collections\ArrayCollection(); |
||
| 337 | $this->user = new \Doctrine\Common\Collections\ArrayCollection(); |
||
| 338 | $this->document = new \Doctrine\Common\Collections\ArrayCollection(); |
||
| 339 | $this->address = new \Doctrine\Common\Collections\ArrayCollection(); |
||
| 340 | $this->email = new \Doctrine\Common\Collections\ArrayCollection(); |
||
| 341 | $this->phone = new \Doctrine\Common\Collections\ArrayCollection(); |
||
| 342 | $this->otherInformations = json_encode( |
||
| 343 | new stdClass() |
||
| 344 | ); |
||
| 345 | } |
||
| 346 | public function getId() |
||
| 347 | { |
||
| 348 | return $this->id; |
||
| 349 | } |
||
| 350 | |||
| 351 | |||
| 352 | public function getEnabled() |
||
| 353 | { |
||
| 354 | return $this->enable; |
||
| 355 | } |
||
| 356 | public function setEnabled($enable) |
||
| 357 | { |
||
| 358 | $this->enable = $enable ?: 0; |
||
| 359 | return $this; |
||
| 360 | } |
||
| 361 | public function setPeopleType($people_type) |
||
| 362 | { |
||
| 363 | $this->peopleType = $people_type; |
||
| 364 | return $this; |
||
| 365 | } |
||
| 366 | public function getPeopleType() |
||
| 367 | { |
||
| 368 | return $this->peopleType; |
||
| 369 | } |
||
| 370 | /** |
||
| 371 | * Set name. |
||
| 372 | */ |
||
| 373 | public function setName(string $name): self |
||
| 374 | { |
||
| 375 | $this->name = $name; |
||
| 376 | return $this; |
||
| 377 | } |
||
| 378 | /** |
||
| 379 | * Get name. |
||
| 380 | */ |
||
| 381 | public function getName(): string |
||
| 382 | { |
||
| 383 | return strtoupper($this->name); |
||
| 384 | } |
||
| 385 | public function setAlias($alias) |
||
| 386 | { |
||
| 387 | $this->alias = $alias; |
||
| 388 | return $this; |
||
| 389 | } |
||
| 390 | public function getAlias() |
||
| 391 | { |
||
| 392 | return strtoupper($this->alias); |
||
| 393 | } |
||
| 394 | public function setLanguage(Language $language = null) |
||
| 395 | { |
||
| 396 | $this->language = $language; |
||
| 397 | return $this; |
||
| 398 | } |
||
| 399 | public function getLanguage() |
||
| 400 | { |
||
| 401 | return $this->language; |
||
| 402 | } |
||
| 403 | |||
| 404 | public function getRegisterDate(): \DateTimeInterface |
||
| 405 | { |
||
| 406 | return $this->registerDate; |
||
| 407 | } |
||
| 408 | public function setRegisterDate(\DateTimeInterface $registerDate): self |
||
| 409 | { |
||
| 410 | $this->registerDate = $registerDate; |
||
| 411 | return $this; |
||
| 412 | } |
||
| 413 | /** |
||
| 414 | * Add document. |
||
| 415 | * |
||
| 416 | * @return Document |
||
| 417 | */ |
||
| 418 | public function addDocument(Document $document) |
||
| 419 | { |
||
| 420 | $this->document[] = $document; |
||
| 421 | return $this; |
||
| 422 | } |
||
| 423 | /** |
||
| 424 | * Add company. |
||
| 425 | * |
||
| 426 | * @return Company |
||
| 427 | */ |
||
| 428 | public function addCompany(People $company) |
||
| 429 | { |
||
| 430 | $this->company[] = $company; |
||
| 431 | return $this; |
||
| 432 | } |
||
| 433 | /** |
||
| 434 | * Remove company. |
||
| 435 | */ |
||
| 436 | public function removeCompany(People $company) |
||
| 437 | { |
||
| 438 | $this->company->removeElement($company); |
||
| 439 | } |
||
| 440 | /** |
||
| 441 | * Get company. |
||
| 442 | * |
||
| 443 | * @return Collection |
||
| 444 | */ |
||
| 445 | public function getCompany() |
||
| 446 | { |
||
| 447 | return $this->company; |
||
| 448 | } |
||
| 449 | /** |
||
| 450 | * Add link. |
||
| 451 | * |
||
| 452 | * @return People |
||
| 453 | */ |
||
| 454 | public function addLink(People $link) |
||
| 455 | { |
||
| 456 | $this->link[] = $link; |
||
| 457 | return $this; |
||
| 458 | } |
||
| 459 | /** |
||
| 460 | * Remove link. |
||
| 461 | * |
||
| 462 | * @param \Core\Entity\Link $link |
||
| 463 | */ |
||
| 464 | public function removeLink(People $link) |
||
| 465 | { |
||
| 466 | $this->link->removeElement($link); |
||
| 467 | } |
||
| 468 | /** |
||
| 469 | * Get link. |
||
| 470 | * |
||
| 471 | * @return Collection |
||
| 472 | */ |
||
| 473 | public function getLink() |
||
| 474 | { |
||
| 475 | return $this->link; |
||
| 476 | } |
||
| 477 | /** |
||
| 478 | * Add user. |
||
| 479 | * |
||
| 480 | * @return People |
||
| 481 | */ |
||
| 482 | public function addUser(\ControleOnline\Entity\User $user) |
||
| 483 | { |
||
| 484 | $this->user[] = $user; |
||
| 485 | return $this; |
||
| 486 | } |
||
| 487 | /** |
||
| 488 | * Remove user. |
||
| 489 | */ |
||
| 490 | public function removeUser(\ControleOnline\Entity\User $user) |
||
| 491 | { |
||
| 492 | $this->user->removeElement($user); |
||
| 493 | } |
||
| 494 | /** |
||
| 495 | * Get user. |
||
| 496 | * |
||
| 497 | * @return Collection |
||
| 498 | */ |
||
| 499 | public function getUser() |
||
| 500 | { |
||
| 501 | return $this->user; |
||
| 502 | } |
||
| 503 | /** |
||
| 504 | * Get document. |
||
| 505 | * |
||
| 506 | * @return Collection |
||
| 507 | */ |
||
| 508 | public function getDocument() |
||
| 509 | { |
||
| 510 | return $this->document; |
||
| 511 | } |
||
| 512 | /** |
||
| 513 | * Get address. |
||
| 514 | * |
||
| 515 | * @return Collection |
||
| 516 | */ |
||
| 517 | public function getAddress() |
||
| 518 | { |
||
| 519 | return $this->address; |
||
| 520 | } |
||
| 521 | /** |
||
| 522 | * Get document. |
||
| 523 | * |
||
| 524 | * @return Collection |
||
| 525 | */ |
||
| 526 | public function getPhone() |
||
| 527 | { |
||
| 528 | return $this->phone; |
||
| 529 | } |
||
| 530 | /** |
||
| 531 | * Get email. |
||
| 532 | * |
||
| 533 | * @return Collection |
||
| 534 | */ |
||
| 535 | public function getEmail() |
||
| 536 | { |
||
| 537 | return $this->email; |
||
| 538 | } |
||
| 539 | public function getContractsPeople(): Collection |
||
| 540 | { |
||
| 541 | return $this->contractsPeople; |
||
| 542 | } |
||
| 543 | public function getFoundationDate(): ?\DateTime |
||
| 544 | { |
||
| 545 | return $this->foundationDate; |
||
| 546 | } |
||
| 547 | public function setFoundationDate(\DateTimeInterface $date): self |
||
| 548 | { |
||
| 549 | $this->foundationDate = $date; |
||
| 550 | return $this; |
||
| 551 | } |
||
| 552 | public function getFullName(): string |
||
| 553 | { |
||
| 554 | if ($this->getPeopleType() == 'F') { |
||
| 555 | return trim(preg_replace('/[^A-Za-z\s]/', '', sprintf('%s %s', $this->getName(), $this->getAlias()))); |
||
| 556 | } |
||
| 557 | return trim(preg_replace('/[^A-Za-z\s]/', '', $this->getName())); |
||
| 558 | } |
||
| 559 | public function isPerson(): bool |
||
| 560 | { |
||
| 561 | return $this->getPeopleType() == 'F'; |
||
| 562 | } |
||
| 563 | public function getOneEmail(): ?Email |
||
| 564 | { |
||
| 565 | if (($email = $this->getEmail()->first()) === false) { |
||
| 566 | return null; |
||
| 567 | } |
||
| 568 | return $email; |
||
| 569 | } |
||
| 570 | public function getOneDocument(): ?Document |
||
| 571 | { |
||
| 572 | $documents = $this->getDocument()->filter(function ($peopleDocument) { |
||
| 573 | if ($peopleDocument->getPeople()->getPeopleType() == 'F') { |
||
| 574 | return $peopleDocument->getDocumentType()->getDocumentType() == 'CPF'; |
||
| 575 | } |
||
| 576 | return $peopleDocument->getDocumentType()->getDocumentType() == 'CNPJ'; |
||
| 577 | }); |
||
| 578 | return ($document = $documents->first()) === false ? null : $document; |
||
| 579 | } |
||
| 580 | public function getBirthdayAsString(): ?string |
||
| 581 | { |
||
| 582 | if ($this->getFoundationDate() instanceof \DateTimeInterface) { |
||
| 583 | return $this->getFoundationDate()->format('Y-m-d'); |
||
| 584 | } |
||
| 585 | return null; |
||
| 586 | } |
||
| 587 | /** |
||
| 588 | * Get otherInformations |
||
| 589 | * |
||
| 590 | * @return stdClass |
||
| 591 | */ |
||
| 592 | public function getOtherInformations($decode = false) |
||
| 595 | } |
||
| 596 | /** |
||
| 597 | * Set comments |
||
| 598 | * |
||
| 599 | * @param string $otherInformations |
||
| 600 | * @return Order |
||
| 601 | */ |
||
| 602 | public function addOtherInformations($key, $value) |
||
| 603 | { |
||
| 604 | $otherInformations = $this->getOtherInformations(true); |
||
| 605 | $otherInformations->{$key} = $value; |
||
| 606 | $this->otherInformations = json_encode($otherInformations); |
||
| 607 | return $this; |
||
| 608 | } |
||
| 609 | /** |
||
| 610 | * Set comments |
||
| 611 | * |
||
| 612 | * @param string $otherInformations |
||
| 613 | * @return Order |
||
| 614 | */ |
||
| 615 | public function setOtherInformations(stdClass $otherInformations) |
||
| 616 | { |
||
| 617 | $this->otherInformations = json_encode($otherInformations); |
||
| 618 | return $this; |
||
| 619 | } |
||
| 620 | /** |
||
| 621 | * Add Config. |
||
| 622 | * |
||
| 623 | * @return People |
||
| 624 | */ |
||
| 625 | public function addConfig(\ControleOnline\Entity\Config $config) |
||
| 626 | { |
||
| 627 | $this->config[] = $config; |
||
| 628 | return $this; |
||
| 629 | } |
||
| 630 | /** |
||
| 631 | * Remove Config. |
||
| 632 | */ |
||
| 633 | public function removeConfig(\ControleOnline\Entity\Config $config) |
||
| 634 | { |
||
| 635 | $this->config->removeElement($config); |
||
| 636 | } |
||
| 637 | /** |
||
| 638 | * Get config. |
||
| 639 | * |
||
| 640 | * @return Collection |
||
| 641 | */ |
||
| 642 | public function getConfig() |
||
| 643 | { |
||
| 644 | return $this->config; |
||
| 645 | } |
||
| 646 | |||
| 647 | /** |
||
| 648 | * Get }) |
||
| 649 | */ |
||
| 650 | public function getBackground() |
||
| 653 | } |
||
| 654 | |||
| 655 | /** |
||
| 656 | * Set }) |
||
| 657 | */ |
||
| 658 | public function setBackground($background): self |
||
| 659 | { |
||
| 660 | $this->background = $background; |
||
| 661 | |||
| 662 | return $this; |
||
| 663 | } |
||
| 664 | |||
| 665 | /** |
||
| 666 | * Get }) |
||
| 667 | */ |
||
| 668 | public function getImage() |
||
| 669 | { |
||
| 670 | return $this->image; |
||
| 671 | } |
||
| 672 | |||
| 673 | /** |
||
| 674 | * Set }) |
||
| 675 | */ |
||
| 676 | public function setImage($image): self |
||
| 677 | { |
||
| 678 | $this->image = $image; |
||
| 679 | |||
| 680 | return $this; |
||
| 681 | } |
||
| 682 | |||
| 683 | /** |
||
| 684 | * Get }) |
||
| 685 | */ |
||
| 686 | public function getAlternativeImage() |
||
| 687 | { |
||
| 688 | return $this->alternative_image; |
||
| 689 | } |
||
| 690 | |||
| 691 | /** |
||
| 692 | * Set }) |
||
| 693 | */ |
||
| 694 | public function setAlternativeImage($alternative_image): self |
||
| 699 | } |
||
| 700 | } |
||
| 701 |
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths