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