| Total Complexity | 56 |
| Total Lines | 626 |
| Duplicated Lines | 0 % |
| Changes | 7 | ||
| 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" |
||
| 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" |
||
| 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" |
||
| 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_read", "task_interaction_read","coupon_read","logistic_read", |
||
| 170 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read" |
||
| 171 | * }) |
||
| 172 | */ |
||
| 173 | private $file; |
||
| 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 | */ |
||
| 187 | private $alternativeFile; |
||
| 188 | /** |
||
| 189 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\File") |
||
| 190 | * @ORM\JoinColumns({ |
||
| 191 | * @ORM\JoinColumn(name="background_image", referencedColumnName="id") |
||
| 192 | * }) |
||
| 193 | */ |
||
| 194 | private $backgroundFile; |
||
| 195 | /** |
||
| 196 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Language", inversedBy="people") |
||
| 197 | * @ORM\JoinColumns({ |
||
| 198 | * @ORM\JoinColumn(name="language_id", referencedColumnName="id") |
||
| 199 | * }) |
||
| 200 | */ |
||
| 201 | private $language; |
||
| 202 | /** |
||
| 203 | * @var Collection |
||
| 204 | * |
||
| 205 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\PeopleLink", mappedBy="company") |
||
| 206 | */ |
||
| 207 | private $company; |
||
| 208 | |||
| 209 | /** |
||
| 210 | * @var Collection |
||
| 211 | * |
||
| 212 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\PeopleLink", mappedBy="people") |
||
| 213 | * |
||
| 214 | */ |
||
| 215 | private $link; |
||
| 216 | |||
| 217 | /** |
||
| 218 | * @var Collection |
||
| 219 | * |
||
| 220 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\User", mappedBy="people") |
||
| 221 | * @ORM\OrderBy({"username" = "ASC"}) |
||
| 222 | * @Groups({ |
||
| 223 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", "invoice_read", |
||
| 224 | * "order_detail_status_read", "mycontract_read", |
||
| 225 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 226 | * "task_read", "task_interaction_read","coupon_read","logistic_read", |
||
| 227 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read" |
||
| 228 | * }) |
||
| 229 | */ |
||
| 230 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['user' => 'exact'])] |
||
| 231 | |||
| 232 | private $user; |
||
| 233 | /** |
||
| 234 | * @var Collection |
||
| 235 | * |
||
| 236 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\Document", mappedBy="people") |
||
| 237 | * @Groups({ |
||
| 238 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", "invoice_read", |
||
| 239 | * "order_detail_status_read", "mycontract_read", |
||
| 240 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 241 | * "task_read", "task_interaction_read","coupon_read","logistic_read", |
||
| 242 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read" |
||
| 243 | * }) |
||
| 244 | */ |
||
| 245 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['document' => 'exact'])] |
||
| 246 | |||
| 247 | private $document; |
||
| 248 | /** |
||
| 249 | * @var Collection |
||
| 250 | * |
||
| 251 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\Address", mappedBy="people") |
||
| 252 | * @ORM\OrderBy({"nickname" = "ASC"}) |
||
| 253 | * @Groups({ |
||
| 254 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", "invoice_read", |
||
| 255 | * "order_detail_status_read", "mycontract_read", |
||
| 256 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 257 | * "task_read", "task_interaction_read","coupon_read","logistic_read", |
||
| 258 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read" |
||
| 259 | * }) |
||
| 260 | */ |
||
| 261 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['address' => 'exact'])] |
||
| 262 | |||
| 263 | private $address; |
||
| 264 | /** |
||
| 265 | * @var Collection |
||
| 266 | * |
||
| 267 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\Phone", mappedBy="people") |
||
| 268 | * @Groups({ |
||
| 269 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", "invoice_read", |
||
| 270 | * "order_detail_status_read", "mycontract_read", |
||
| 271 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 272 | * "task_read", "task_interaction_read","coupon_read","logistic_read", |
||
| 273 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read" |
||
| 274 | * }) |
||
| 275 | */ |
||
| 276 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['phone' => 'exact'])] |
||
| 277 | |||
| 278 | private $phone; |
||
| 279 | /** |
||
| 280 | * @var Collection |
||
| 281 | * |
||
| 282 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\Email", mappedBy="people") |
||
| 283 | * @Groups({ |
||
| 284 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", "invoice_read", |
||
| 285 | * "order_detail_status_read", "mycontract_read", |
||
| 286 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 287 | * "task_read", "task_interaction_read","coupon_read","logistic_read", |
||
| 288 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read" |
||
| 289 | * }) |
||
| 290 | */ |
||
| 291 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['email' => 'exact'])] |
||
| 292 | |||
| 293 | private $email; |
||
| 294 | /** |
||
| 295 | * Many Peoples have Many Contracts. |
||
| 296 | * |
||
| 297 | * @ORM\OneToMany (targetEntity="ControleOnline\Entity\ContractPeople", mappedBy="people") |
||
| 298 | */ |
||
| 299 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['contractsPeople' => 'exact'])] |
||
| 300 | |||
| 301 | private $contractsPeople; |
||
| 302 | |||
| 303 | /** |
||
| 304 | * @ORM\Column(type="datetime", nullable=false, columnDefinition="DATETIME") |
||
| 305 | * @Groups({ |
||
| 306 | * "category_read","order_read", "document_read", "email_read", "people_read","people_write", "invoice_read", |
||
| 307 | * "order_detail_status_read", "mycontract_read", |
||
| 308 | * "my_contract_item_read", "mycontractpeople_read", |
||
| 309 | * "task_read", "task_interaction_read","coupon_read","logistic_read", |
||
| 310 | * "pruduct_read","queue_read","display_read","notifications_read","people_provider_read" |
||
| 311 | * }) |
||
| 312 | */ |
||
| 313 | private $foundationDate = null; |
||
| 314 | |||
| 315 | |||
| 316 | public function __construct() |
||
| 317 | { |
||
| 318 | $this->enable = 0; |
||
| 319 | $this->registerDate = new \DateTime('now'); |
||
| 320 | $this->company = new \Doctrine\Common\Collections\ArrayCollection(); |
||
| 321 | $this->config = new \Doctrine\Common\Collections\ArrayCollection(); |
||
| 322 | $this->link = new \Doctrine\Common\Collections\ArrayCollection(); |
||
| 323 | $this->user = new \Doctrine\Common\Collections\ArrayCollection(); |
||
| 324 | $this->document = new \Doctrine\Common\Collections\ArrayCollection(); |
||
| 325 | $this->address = new \Doctrine\Common\Collections\ArrayCollection(); |
||
| 326 | $this->email = new \Doctrine\Common\Collections\ArrayCollection(); |
||
| 327 | $this->phone = new \Doctrine\Common\Collections\ArrayCollection(); |
||
| 328 | $this->otherInformations = json_encode( |
||
| 329 | new stdClass() |
||
| 330 | ); |
||
| 331 | } |
||
| 332 | public function getId() |
||
| 333 | { |
||
| 334 | return $this->id; |
||
| 335 | } |
||
| 336 | |||
| 337 | |||
| 338 | public function getEnabled() |
||
| 339 | { |
||
| 340 | return $this->enable; |
||
| 341 | } |
||
| 342 | public function setEnabled($enable) |
||
| 343 | { |
||
| 344 | $this->enable = $enable ?: 0; |
||
| 345 | return $this; |
||
| 346 | } |
||
| 347 | public function setPeopleType($people_type) |
||
| 348 | { |
||
| 349 | $this->peopleType = $people_type; |
||
| 350 | return $this; |
||
| 351 | } |
||
| 352 | public function getPeopleType() |
||
| 353 | { |
||
| 354 | return $this->peopleType; |
||
| 355 | } |
||
| 356 | /** |
||
| 357 | * Set name. |
||
| 358 | */ |
||
| 359 | public function setName(string $name): self |
||
| 360 | { |
||
| 361 | $this->name = $name; |
||
| 362 | return $this; |
||
| 363 | } |
||
| 364 | /** |
||
| 365 | * Get name. |
||
| 366 | */ |
||
| 367 | public function getName(): string |
||
| 368 | { |
||
| 369 | return strtoupper($this->name); |
||
| 370 | } |
||
| 371 | public function setAlias($alias) |
||
| 372 | { |
||
| 373 | $this->alias = $alias; |
||
| 374 | return $this; |
||
| 375 | } |
||
| 376 | public function getAlias() |
||
| 377 | { |
||
| 378 | return strtoupper($this->alias); |
||
| 379 | } |
||
| 380 | public function setFile(File $file = null) |
||
| 381 | { |
||
| 382 | $this->file = $file; |
||
| 383 | return $this; |
||
| 384 | } |
||
| 385 | public function getFile() |
||
| 386 | { |
||
| 387 | return $this->file; |
||
| 388 | } |
||
| 389 | public function setAlternativeFile(File $alternative_file = null) |
||
| 390 | { |
||
| 391 | $this->alternativeFile = $alternative_file; |
||
| 392 | return $this; |
||
| 393 | } |
||
| 394 | public function getAlternativeFile() |
||
| 395 | { |
||
| 396 | return $this->alternativeFile; |
||
| 397 | } |
||
| 398 | public function getBackgroundFile() |
||
| 399 | { |
||
| 400 | return $this->backgroundFile; |
||
| 401 | } |
||
| 402 | public function setBackgroundFile(File $backgroundFile = null) |
||
| 403 | { |
||
| 404 | $this->backgroundFile = $backgroundFile; |
||
| 405 | return $this; |
||
| 406 | } |
||
| 407 | public function setLanguage(Language $language = null) |
||
| 408 | { |
||
| 409 | $this->language = $language; |
||
| 410 | return $this; |
||
| 411 | } |
||
| 412 | public function getLanguage() |
||
| 413 | { |
||
| 414 | return $this->language; |
||
| 415 | } |
||
| 416 | |||
| 417 | public function getRegisterDate(): \DateTimeInterface |
||
| 418 | { |
||
| 419 | return $this->registerDate; |
||
| 420 | } |
||
| 421 | public function setRegisterDate(\DateTimeInterface $registerDate): self |
||
| 422 | { |
||
| 423 | $this->registerDate = $registerDate; |
||
| 424 | return $this; |
||
| 425 | } |
||
| 426 | /** |
||
| 427 | * Add document. |
||
| 428 | * |
||
| 429 | * @return Document |
||
| 430 | */ |
||
| 431 | public function addDocument(Document $document) |
||
| 432 | { |
||
| 433 | $this->document[] = $document; |
||
| 434 | return $this; |
||
| 435 | } |
||
| 436 | /** |
||
| 437 | * Add company. |
||
| 438 | * |
||
| 439 | * @return Company |
||
| 440 | */ |
||
| 441 | public function addCompany(People $company) |
||
| 442 | { |
||
| 443 | $this->company[] = $company; |
||
| 444 | return $this; |
||
| 445 | } |
||
| 446 | /** |
||
| 447 | * Remove company. |
||
| 448 | */ |
||
| 449 | public function removeCompany(People $company) |
||
| 450 | { |
||
| 451 | $this->company->removeElement($company); |
||
| 452 | } |
||
| 453 | /** |
||
| 454 | * Get company. |
||
| 455 | * |
||
| 456 | * @return Collection |
||
| 457 | */ |
||
| 458 | public function getCompany() |
||
| 459 | { |
||
| 460 | return $this->company; |
||
| 461 | } |
||
| 462 | /** |
||
| 463 | * Add link. |
||
| 464 | * |
||
| 465 | * @return People |
||
| 466 | */ |
||
| 467 | public function addLink(People $link) |
||
| 468 | { |
||
| 469 | $this->link[] = $link; |
||
| 470 | return $this; |
||
| 471 | } |
||
| 472 | /** |
||
| 473 | * Remove link. |
||
| 474 | * |
||
| 475 | * @param \Core\Entity\Link $link |
||
| 476 | */ |
||
| 477 | public function removeLink(People $link) |
||
| 478 | { |
||
| 479 | $this->link->removeElement($link); |
||
| 480 | } |
||
| 481 | /** |
||
| 482 | * Get link. |
||
| 483 | * |
||
| 484 | * @return Collection |
||
| 485 | */ |
||
| 486 | public function getLink() |
||
| 487 | { |
||
| 488 | return $this->link; |
||
| 489 | } |
||
| 490 | /** |
||
| 491 | * Add user. |
||
| 492 | * |
||
| 493 | * @return People |
||
| 494 | */ |
||
| 495 | public function addUser(\ControleOnline\Entity\User $user) |
||
| 496 | { |
||
| 497 | $this->user[] = $user; |
||
| 498 | return $this; |
||
| 499 | } |
||
| 500 | /** |
||
| 501 | * Remove user. |
||
| 502 | */ |
||
| 503 | public function removeUser(\ControleOnline\Entity\User $user) |
||
| 504 | { |
||
| 505 | $this->user->removeElement($user); |
||
| 506 | } |
||
| 507 | /** |
||
| 508 | * Get user. |
||
| 509 | * |
||
| 510 | * @return Collection |
||
| 511 | */ |
||
| 512 | public function getUser() |
||
| 513 | { |
||
| 514 | return $this->user; |
||
| 515 | } |
||
| 516 | /** |
||
| 517 | * Get document. |
||
| 518 | * |
||
| 519 | * @return Collection |
||
| 520 | */ |
||
| 521 | public function getDocument() |
||
| 522 | { |
||
| 523 | return $this->document; |
||
| 524 | } |
||
| 525 | /** |
||
| 526 | * Get address. |
||
| 527 | * |
||
| 528 | * @return Collection |
||
| 529 | */ |
||
| 530 | public function getAddress() |
||
| 531 | { |
||
| 532 | return $this->address; |
||
| 533 | } |
||
| 534 | /** |
||
| 535 | * Get document. |
||
| 536 | * |
||
| 537 | * @return Collection |
||
| 538 | */ |
||
| 539 | public function getPhone() |
||
| 540 | { |
||
| 541 | return $this->phone; |
||
| 542 | } |
||
| 543 | /** |
||
| 544 | * Get email. |
||
| 545 | * |
||
| 546 | * @return Collection |
||
| 547 | */ |
||
| 548 | public function getEmail() |
||
| 549 | { |
||
| 550 | return $this->email; |
||
| 551 | } |
||
| 552 | public function getContractsPeople(): Collection |
||
| 553 | { |
||
| 554 | return $this->contractsPeople; |
||
| 555 | } |
||
| 556 | public function getFoundationDate(): ?\DateTime |
||
| 557 | { |
||
| 558 | return $this->foundationDate; |
||
| 559 | } |
||
| 560 | public function setFoundationDate(\DateTimeInterface $date): self |
||
| 561 | { |
||
| 562 | $this->foundationDate = $date; |
||
| 563 | return $this; |
||
| 564 | } |
||
| 565 | public function getFullName(): string |
||
| 566 | { |
||
| 567 | if ($this->getPeopleType() == 'F') { |
||
| 568 | return trim(preg_replace('/[^A-Za-z\s]/', '', sprintf('%s %s', $this->getName(), $this->getAlias()))); |
||
| 569 | } |
||
| 570 | return trim(preg_replace('/[^A-Za-z\s]/', '', $this->getName())); |
||
| 571 | } |
||
| 572 | public function isPerson(): bool |
||
| 573 | { |
||
| 574 | return $this->getPeopleType() == 'F'; |
||
| 575 | } |
||
| 576 | public function getOneEmail(): ?Email |
||
| 577 | { |
||
| 578 | if (($email = $this->getEmail()->first()) === false) { |
||
| 579 | return null; |
||
| 580 | } |
||
| 581 | return $email; |
||
| 582 | } |
||
| 583 | public function getOneDocument(): ?Document |
||
| 584 | { |
||
| 585 | $documents = $this->getDocument()->filter(function ($peopleDocument) { |
||
| 586 | if ($peopleDocument->getPeople()->getPeopleType() == 'F') { |
||
| 587 | return $peopleDocument->getDocumentType()->getDocumentType() == 'CPF'; |
||
| 588 | } |
||
| 589 | return $peopleDocument->getDocumentType()->getDocumentType() == 'CNPJ'; |
||
| 590 | }); |
||
| 591 | return ($document = $documents->first()) === false ? null : $document; |
||
| 592 | } |
||
| 593 | public function getBirthdayAsString(): ?string |
||
| 594 | { |
||
| 595 | if ($this->getFoundationDate() instanceof \DateTimeInterface) { |
||
| 596 | return $this->getFoundationDate()->format('Y-m-d'); |
||
| 597 | } |
||
| 598 | return null; |
||
| 599 | } |
||
| 600 | /** |
||
| 601 | * Get otherInformations |
||
| 602 | * |
||
| 603 | * @return stdClass |
||
| 604 | */ |
||
| 605 | public function getOtherInformations($decode = false) |
||
| 608 | } |
||
| 609 | /** |
||
| 610 | * Set comments |
||
| 611 | * |
||
| 612 | * @param string $otherInformations |
||
| 613 | * @return Order |
||
| 614 | */ |
||
| 615 | public function addOtherInformations($key, $value) |
||
| 621 | } |
||
| 622 | /** |
||
| 623 | * Set comments |
||
| 624 | * |
||
| 625 | * @param string $otherInformations |
||
| 626 | * @return Order |
||
| 627 | */ |
||
| 628 | public function setOtherInformations(stdClass $otherInformations) |
||
| 629 | { |
||
| 630 | $this->otherInformations = json_encode($otherInformations); |
||
| 631 | return $this; |
||
| 632 | } |
||
| 633 | /** |
||
| 634 | * Add Config. |
||
| 635 | * |
||
| 636 | * @return People |
||
| 637 | */ |
||
| 638 | public function addConfig(\ControleOnline\Entity\Config $config) |
||
| 639 | { |
||
| 640 | $this->config[] = $config; |
||
| 641 | return $this; |
||
| 642 | } |
||
| 643 | /** |
||
| 644 | * Remove Config. |
||
| 645 | */ |
||
| 646 | public function removeConfig(\ControleOnline\Entity\Config $config) |
||
| 649 | } |
||
| 650 | /** |
||
| 651 | * Get config. |
||
| 652 | * |
||
| 653 | * @return Collection |
||
| 654 | */ |
||
| 655 | public function getConfig() |
||
| 658 | } |
||
| 659 | } |
||
| 660 |
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