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