Total Complexity | 80 |
Total Lines | 1025 |
Duplicated Lines | 0 % |
Changes | 24 | ||
Bugs | 0 | Features | 0 |
Complex classes like Order 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 Order, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
31 | #[ApiResource( |
||
32 | operations: [ |
||
33 | new Get( |
||
34 | security: 'is_granted(\'ROLE_CLIENT\')', |
||
35 | ), |
||
36 | new GetCollection( |
||
37 | security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')', |
||
38 | ), |
||
39 | new Post( |
||
40 | security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')', |
||
41 | validationContext: ['groups' => ['order_write']], |
||
42 | denormalizationContext: ['groups' => ['order_write']] |
||
43 | ), |
||
44 | new Put( |
||
45 | security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))', |
||
46 | validationContext: ['groups' => ['order_write']], |
||
47 | denormalizationContext: ['groups' => ['order_write']] |
||
48 | ), |
||
49 | ], |
||
50 | formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
||
51 | normalizationContext: ['groups' => ['order_read']], |
||
52 | denormalizationContext: ['groups' => ['order_write']] |
||
53 | )] |
||
54 | #[ApiFilter(filterClass: OrderFilter::class, properties: ['alterDate' => 'DESC'])] |
||
55 | |||
56 | |||
57 | class Order |
||
58 | { |
||
59 | /** |
||
60 | * @var integer |
||
61 | * |
||
62 | * @ORM\Column(name="id", type="integer", nullable=false) |
||
63 | * @ORM\Id |
||
64 | * @ORM\GeneratedValue(strategy="IDENTITY") |
||
65 | * @Groups({"order_read","company_expense_read","task_read","coupon_read","logistic_read","order_invoice_read"}) |
||
66 | */ |
||
67 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
||
68 | |||
69 | private $id; |
||
70 | |||
71 | /** |
||
72 | * @var \ControleOnline\Entity\People |
||
73 | * |
||
74 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People") |
||
75 | * @ORM\JoinColumns({ |
||
76 | * @ORM\JoinColumn(name="client_id", referencedColumnName="id") |
||
77 | * }) |
||
78 | * @Groups({"order_read","order_write", "invoice_read", "task_read"}) |
||
79 | */ |
||
80 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['client' => 'exact'])] |
||
81 | |||
82 | private $client; |
||
83 | |||
84 | /** |
||
85 | * @var \DateTimeInterface |
||
86 | * @ORM\Column(name="order_date", type="datetime", nullable=false, columnDefinition="DATETIME") |
||
87 | * @Groups({"order_read","order_write"}) |
||
88 | */ |
||
89 | #[ApiFilter(DateFilter::class, properties: ['orderDate'])] |
||
90 | |||
91 | private $orderDate; |
||
92 | |||
93 | /** |
||
94 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\OrderProduct", mappedBy="order", cascade={"persist"}) |
||
95 | * @Groups({"order_read","order_write"}) |
||
96 | */ |
||
97 | private $orderProducts; |
||
98 | |||
99 | /** |
||
100 | * @var \Doctrine\Common\Collections\Collection |
||
101 | * |
||
102 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\OrderInvoice", mappedBy="order") |
||
103 | */ |
||
104 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['invoice' => 'exact'])] |
||
105 | private $invoice; |
||
106 | |||
107 | /** |
||
108 | * @var \Doctrine\Common\Collections\Collection |
||
109 | * |
||
110 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\Task", mappedBy="order") |
||
111 | */ |
||
112 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['task' => 'exact'])] |
||
113 | |||
114 | private $task; |
||
115 | |||
116 | /** |
||
117 | * @var \Doctrine\Common\Collections\Collection |
||
118 | * |
||
119 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\OrderInvoiceTax", mappedBy="order") |
||
120 | */ |
||
121 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['invoiceTax' => 'exact'])] |
||
122 | |||
123 | private $invoiceTax; |
||
124 | |||
125 | /** |
||
126 | * @ORM\Column(name="alter_date", type="datetime", nullable=false) |
||
127 | * @Groups({"display_read","order_read","order_write"}) |
||
128 | */ |
||
129 | |||
130 | #[ApiFilter(DateFilter::class, properties: ['alterDate'])] |
||
131 | |||
132 | private $alterDate; |
||
133 | |||
134 | |||
135 | /** |
||
136 | * @var \ControleOnline\Entity\Status |
||
137 | * |
||
138 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Status") |
||
139 | * @ORM\JoinColumns({ |
||
140 | * @ORM\JoinColumn(name="status_id", referencedColumnName="id") |
||
141 | * }) |
||
142 | * @Groups({"display_read","order_read","order_write"}) |
||
143 | */ |
||
144 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['status' => 'exact'])] |
||
145 | |||
146 | private $status; |
||
147 | |||
148 | /** |
||
149 | * @var string |
||
150 | * |
||
151 | * @ORM\Column(name="order_type", type="string", nullable=true) |
||
152 | * @Groups({"display_read","order_read","order_write"}) |
||
153 | */ |
||
154 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['orderType' => 'exact'])] |
||
155 | |||
156 | private $orderType = 'Online'; |
||
157 | |||
158 | |||
159 | /** |
||
160 | * @var string |
||
161 | * |
||
162 | * @ORM\Column(name="app", type="string", nullable=true) |
||
163 | * @Groups({"display_read","order_read","order_write"}) |
||
164 | */ |
||
165 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['app' => 'exact'])] |
||
166 | |||
167 | private $app = 'Manual'; |
||
168 | |||
169 | /** |
||
170 | * @var string |
||
171 | * |
||
172 | * @ORM\Column(name="other_informations", type="json", nullable=true) |
||
173 | * @Groups({"order_read","order_write"}) |
||
174 | */ |
||
175 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['otherInformations' => 'exact'])] |
||
176 | |||
177 | private $otherInformations; |
||
178 | |||
179 | /** |
||
180 | * @var \ControleOnline\Entity\Order |
||
181 | * |
||
182 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Order") |
||
183 | * @ORM\JoinColumns({ |
||
184 | * @ORM\JoinColumn(name="main_order_id", referencedColumnName="id") |
||
185 | * }) |
||
186 | */ |
||
187 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['mainOrder' => 'exact'])] |
||
188 | |||
189 | private $mainOrder; |
||
190 | |||
191 | |||
192 | /** |
||
193 | * @var integer |
||
194 | * |
||
195 | * @ORM\Column(name="main_order_id", type="integer", nullable=true) |
||
196 | * @Groups({"order_read","order_write"}) |
||
197 | */ |
||
198 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['mainOrderId' => 'exact'])] |
||
199 | |||
200 | private $mainOrderId; |
||
201 | |||
202 | |||
203 | |||
204 | /** |
||
205 | * @var \ControleOnline\Entity\People |
||
206 | * |
||
207 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People") |
||
208 | * @ORM\JoinColumns({ |
||
209 | * @ORM\JoinColumn(name="payer_people_id", referencedColumnName="id") |
||
210 | * }) |
||
211 | * @Groups({"order_read","order_write","task_read","invoice_read"}) |
||
212 | */ |
||
213 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['payer' => 'exact'])] |
||
214 | |||
215 | private $payer; |
||
216 | |||
217 | /** |
||
218 | * @var \ControleOnline\Entity\People |
||
219 | * |
||
220 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People") |
||
221 | * @ORM\JoinColumns({ |
||
222 | * @ORM\JoinColumn(name="provider_id", referencedColumnName="id") |
||
223 | * }) |
||
224 | * @Groups({"order_read","order_write","invoice_read", "task_read"}) |
||
225 | */ |
||
226 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['provider' => 'exact'])] |
||
227 | |||
228 | private $provider; |
||
229 | |||
230 | |||
231 | |||
232 | |||
233 | |||
234 | /** |
||
235 | * @var \ControleOnline\Entity\Address |
||
236 | * |
||
237 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Address") |
||
238 | * @ORM\JoinColumns({ |
||
239 | * @ORM\JoinColumn(name="address_origin_id", referencedColumnName="id") |
||
240 | * }) |
||
241 | */ |
||
242 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['addressOrigin' => 'exact'])] |
||
243 | |||
244 | private $addressOrigin; |
||
245 | |||
246 | /** |
||
247 | * @var \ControleOnline\Entity\Address |
||
248 | * |
||
249 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Address") |
||
250 | * @ORM\JoinColumns({ |
||
251 | * @ORM\JoinColumn(name="address_destination_id", referencedColumnName="id") |
||
252 | * }) |
||
253 | */ |
||
254 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['addressDestination' => 'exact'])] |
||
255 | |||
256 | private $addressDestination; |
||
257 | |||
258 | /** |
||
259 | * @var \ControleOnline\Entity\People |
||
260 | * |
||
261 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People") |
||
262 | * @ORM\JoinColumns({ |
||
263 | * @ORM\JoinColumn(name="retrieve_contact_id", referencedColumnName="id") |
||
264 | * }) |
||
265 | */ |
||
266 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['retrieveContact' => 'exact'])] |
||
267 | |||
268 | private $retrieveContact; |
||
269 | |||
270 | /** |
||
271 | * @var \ControleOnline\Entity\People |
||
272 | * |
||
273 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People") |
||
274 | * @ORM\JoinColumns({ |
||
275 | * @ORM\JoinColumn(name="delivery_contact_id", referencedColumnName="id") |
||
276 | * }) |
||
277 | */ |
||
278 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['deliveryContact' => 'exact'])] |
||
279 | |||
280 | private $deliveryContact; |
||
281 | |||
282 | |||
283 | /** |
||
284 | * @var float |
||
285 | * |
||
286 | * @ORM\Column(name="price", type="float", nullable=false) |
||
287 | * @Groups({"order_read","order_write"}) |
||
288 | */ |
||
289 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['price' => 'exact'])] |
||
290 | |||
291 | private $price = 0; |
||
292 | |||
293 | |||
294 | |||
295 | /** |
||
296 | * @var string |
||
297 | * |
||
298 | * @ORM\Column(name="comments", type="string", nullable=true) |
||
299 | * @Groups({"order_read","order_write"}) |
||
300 | */ |
||
301 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['comments' => 'exact'])] |
||
302 | |||
303 | private $comments; |
||
304 | |||
305 | /** |
||
306 | * @var boolean |
||
307 | * |
||
308 | * @ORM\Column(name="notified", type="boolean") |
||
309 | */ |
||
310 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['notified' => 'exact'])] |
||
311 | |||
312 | private $notified = false; |
||
313 | |||
314 | /** |
||
315 | * @var \Doctrine\Common\Collections\Collection |
||
316 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\OrderTracking", mappedBy="order") |
||
317 | * @ApiSubresource() |
||
318 | */ |
||
319 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['tracking' => 'exact'])] |
||
320 | |||
321 | private $tracking; |
||
322 | |||
323 | |||
324 | |||
325 | /** |
||
326 | * @var \Doctrine\Common\Collections\Collection |
||
327 | * |
||
328 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\OrderQueue", mappedBy="order") |
||
329 | * @Groups({"order_read","order_write"}) |
||
330 | */ |
||
331 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['orderQueue' => 'exact'])] |
||
332 | |||
333 | private $orderQueue; |
||
334 | |||
335 | |||
336 | |||
337 | public function __construct() |
||
338 | { |
||
339 | $this->orderDate = new \DateTime('now'); |
||
340 | $this->alterDate = new \DateTime('now'); |
||
341 | $this->invoiceTax = new ArrayCollection(); |
||
342 | $this->invoice = new ArrayCollection(); |
||
343 | $this->tracking = new ArrayCollection(); |
||
344 | $this->task = new ArrayCollection(); |
||
345 | $this->orderQueue = new ArrayCollection(); |
||
346 | $this->orderProducts = new ArrayCollection(); |
||
347 | // $this->parkingDate = new \DateTime('now'); |
||
348 | $this->otherInformations = json_encode(new stdClass()); |
||
349 | } |
||
350 | |||
351 | public function resetId() |
||
352 | { |
||
353 | $this->id = null; |
||
354 | $this->orderDate = new \DateTime('now'); |
||
355 | $this->alterDate = new \DateTime('now'); |
||
356 | // $this->parkingDate = new \DateTime('now'); |
||
357 | } |
||
358 | |||
359 | /** |
||
360 | * Get id |
||
361 | * |
||
362 | * @return integer |
||
363 | */ |
||
364 | public function getId() |
||
365 | { |
||
366 | return $this->id; |
||
367 | } |
||
368 | |||
369 | /** |
||
370 | * Set status |
||
371 | * |
||
372 | * @param \ControleOnline\Entity\Status $status |
||
373 | * @return Order |
||
374 | */ |
||
375 | public function setStatus(\ControleOnline\Entity\Status $status = null) |
||
376 | { |
||
377 | $this->status = $status; |
||
378 | |||
379 | return $this; |
||
380 | } |
||
381 | |||
382 | /** |
||
383 | * Get status |
||
384 | * |
||
385 | * @return \ControleOnline\Entity\Status |
||
386 | */ |
||
387 | public function getStatus() |
||
388 | { |
||
389 | return $this->status; |
||
390 | } |
||
391 | |||
392 | /** |
||
393 | * Set client |
||
394 | * |
||
395 | * @param \ControleOnline\Entity\People $client |
||
396 | * @return Order |
||
397 | */ |
||
398 | public function setClient(\ControleOnline\Entity\People $client = null) |
||
399 | { |
||
400 | $this->client = $client; |
||
401 | |||
402 | return $this; |
||
403 | } |
||
404 | |||
405 | /** |
||
406 | * Get client |
||
407 | * |
||
408 | * @return \ControleOnline\Entity\People |
||
409 | */ |
||
410 | public function getClient() |
||
411 | { |
||
412 | return $this->client; |
||
413 | } |
||
414 | |||
415 | /** |
||
416 | * Set provider |
||
417 | * |
||
418 | * @param \ControleOnline\Entity\People $provider |
||
419 | * @return Order |
||
420 | */ |
||
421 | public function setProvider(\ControleOnline\Entity\People $provider = null) |
||
422 | { |
||
423 | $this->provider = $provider; |
||
424 | |||
425 | return $this; |
||
426 | } |
||
427 | |||
428 | /** |
||
429 | * Get provider |
||
430 | * |
||
431 | * @return \ControleOnline\Entity\People |
||
432 | */ |
||
433 | public function getProvider() |
||
434 | { |
||
435 | return $this->provider; |
||
436 | } |
||
437 | |||
438 | /** |
||
439 | * Set price |
||
440 | * |
||
441 | * @param float $price |
||
442 | * @return Order |
||
443 | */ |
||
444 | public function setPrice($price) |
||
445 | { |
||
446 | $this->price = $price; |
||
447 | |||
448 | return $this; |
||
449 | } |
||
450 | |||
451 | /** |
||
452 | * Get price |
||
453 | * |
||
454 | * @return float |
||
455 | */ |
||
456 | public function getPrice() |
||
457 | { |
||
458 | return $this->price; |
||
459 | } |
||
460 | |||
461 | |||
462 | /** |
||
463 | * Set addressOrigin |
||
464 | * |
||
465 | * @param \ControleOnline\Entity\Address $address_origin |
||
466 | * @return Order |
||
467 | */ |
||
468 | public function setAddressOrigin(\ControleOnline\Entity\Address $address_origin = null) |
||
473 | } |
||
474 | |||
475 | /** |
||
476 | * Get addressOrigin |
||
477 | * |
||
478 | * @return \ControleOnline\Entity\Address |
||
479 | */ |
||
480 | public function getAddressOrigin() |
||
481 | { |
||
482 | return $this->addressOrigin; |
||
483 | } |
||
484 | |||
485 | /** |
||
486 | * Set addressDestination |
||
487 | * |
||
488 | * @param \ControleOnline\Entity\Address $address_destination |
||
489 | * @return Order |
||
490 | */ |
||
491 | public function setAddressDestination(\ControleOnline\Entity\Address $address_destination = null) |
||
492 | { |
||
493 | $this->addressDestination = $address_destination; |
||
494 | |||
495 | return $this; |
||
496 | } |
||
497 | |||
498 | /** |
||
499 | * Get quote |
||
500 | * |
||
501 | * @return \ControleOnline\Entity\Address |
||
502 | */ |
||
503 | public function getAddressDestination() |
||
504 | { |
||
505 | return $this->addressDestination; |
||
506 | } |
||
507 | |||
508 | /** |
||
509 | * Get retrieveContact |
||
510 | * |
||
511 | * @return \ControleOnline\Entity\People |
||
512 | */ |
||
513 | public function getRetrieveContact() |
||
514 | { |
||
515 | return $this->retrieveContact; |
||
516 | } |
||
517 | |||
518 | /** |
||
519 | * Set retrieveContact |
||
520 | * |
||
521 | * @param \ControleOnline\Entity\People $retrieve_contact |
||
522 | * @return Order |
||
523 | */ |
||
524 | public function setRetrieveContact(\ControleOnline\Entity\People $retrieve_contact = null) |
||
525 | { |
||
526 | $this->retrieveContact = $retrieve_contact; |
||
527 | |||
528 | return $this; |
||
529 | } |
||
530 | |||
531 | /** |
||
532 | * Get deliveryContact |
||
533 | * |
||
534 | * @return \ControleOnline\Entity\People |
||
535 | */ |
||
536 | public function getDeliveryContact() |
||
537 | { |
||
538 | return $this->deliveryContact; |
||
539 | } |
||
540 | |||
541 | /** |
||
542 | * Set deliveryContact |
||
543 | * |
||
544 | * @param \ControleOnline\Entity\People $delivery_contact |
||
545 | * @return Order |
||
546 | */ |
||
547 | public function setDeliveryContact(\ControleOnline\Entity\People $delivery_contact = null) |
||
548 | { |
||
549 | $this->deliveryContact = $delivery_contact; |
||
550 | |||
551 | return $this; |
||
552 | } |
||
553 | |||
554 | /** |
||
555 | * Set payer |
||
556 | * |
||
557 | * @param \ControleOnline\Entity\People $payer |
||
558 | * @return Order |
||
559 | */ |
||
560 | public function setPayer(\ControleOnline\Entity\People $payer = null) |
||
561 | { |
||
562 | $this->payer = $payer; |
||
563 | |||
564 | return $this; |
||
565 | } |
||
566 | |||
567 | /** |
||
568 | * Get payer |
||
569 | * |
||
570 | * @return \ControleOnline\Entity\People |
||
571 | */ |
||
572 | public function getPayer() |
||
575 | } |
||
576 | |||
577 | |||
578 | /** |
||
579 | * Set comments |
||
580 | * |
||
581 | * @param string $comments |
||
582 | * @return Order |
||
583 | */ |
||
584 | public function setComments($comments) |
||
585 | { |
||
586 | $this->comments = $comments; |
||
587 | |||
588 | return $this; |
||
589 | } |
||
590 | |||
591 | /** |
||
592 | * Get comments |
||
593 | * |
||
594 | * @return string |
||
595 | */ |
||
596 | public function getComments() |
||
597 | { |
||
598 | return $this->comments; |
||
599 | } |
||
600 | |||
601 | /** |
||
602 | * Get otherInformations |
||
603 | * |
||
604 | * @return stdClass |
||
605 | */ |
||
606 | public function getOtherInformations($decode = false) |
||
607 | { |
||
608 | return $decode ? (object) json_decode((is_array($this->otherInformations) ? json_encode($this->otherInformations) : $this->otherInformations)) : $this->otherInformations; |
||
609 | } |
||
610 | |||
611 | /** |
||
612 | * Set comments |
||
613 | * |
||
614 | * @param string $otherInformations |
||
615 | * @return Order |
||
616 | */ |
||
617 | public function addOtherInformations($key, $value) |
||
618 | { |
||
619 | $otherInformations = $this->getOtherInformations(true); |
||
620 | $otherInformations->$key = $value; |
||
621 | $this->otherInformations = json_encode($otherInformations); |
||
622 | return $this; |
||
623 | } |
||
624 | |||
625 | /** |
||
626 | * Set comments |
||
627 | * |
||
628 | * @param string $otherInformations |
||
629 | * @return Order |
||
630 | */ |
||
631 | public function setOtherInformations($otherInformations) |
||
635 | } |
||
636 | |||
637 | |||
638 | /** |
||
639 | * Get orderDate |
||
640 | * |
||
641 | * @return \DateTimeInterface |
||
642 | */ |
||
643 | public function getOrderDate() |
||
644 | { |
||
645 | return $this->orderDate; |
||
646 | } |
||
647 | |||
648 | /** |
||
649 | * Set alter_date |
||
650 | * |
||
651 | * @param \DateTimeInterface $alter_date |
||
652 | */ |
||
653 | public function setAlterDate(\DateTimeInterface $alter_date = null): self |
||
654 | { |
||
655 | $this->alterDate = $alter_date; |
||
656 | |||
657 | return $this; |
||
658 | } |
||
659 | |||
660 | /** |
||
661 | * Get alter_date |
||
662 | * |
||
663 | */ |
||
664 | public function getAlterDate(): ?\DateTimeInterface |
||
665 | { |
||
666 | return $this->alterDate; |
||
667 | } |
||
668 | |||
669 | /** |
||
670 | * Add invoiceTax |
||
671 | * |
||
672 | * @param \ControleOnline\Entity\OrderInvoiceTax $invoice_tax |
||
673 | * @return Order |
||
674 | */ |
||
675 | public function addAInvoiceTax(OrderInvoiceTax $invoice_tax) |
||
676 | { |
||
677 | $this->invoiceTax[] = $invoice_tax; |
||
678 | |||
679 | return $this; |
||
680 | } |
||
681 | |||
682 | /** |
||
683 | * Remove invoiceTax |
||
684 | * |
||
685 | * @param \ControleOnline\Entity\OrderInvoiceTax $invoice_tax |
||
686 | */ |
||
687 | public function removeInvoiceTax(OrderInvoiceTax $invoice_tax) |
||
688 | { |
||
689 | $this->invoiceTax->removeElement($invoice_tax); |
||
690 | } |
||
691 | |||
692 | /** |
||
693 | * Get invoiceTax |
||
694 | * |
||
695 | * @return \Doctrine\Common\Collections\Collection |
||
696 | */ |
||
697 | public function getInvoiceTax() |
||
698 | { |
||
699 | return $this->invoiceTax; |
||
700 | } |
||
701 | |||
702 | |||
703 | |||
704 | /** |
||
705 | * Get invoiceTax |
||
706 | * |
||
707 | * @return \ControleOnline\Entity\InvoiceTax |
||
708 | */ |
||
709 | public function getClientInvoiceTax() |
||
710 | { |
||
711 | foreach ($this->getInvoiceTax() as $invoice) { |
||
712 | if ($invoice->getInvoiceType() == 55) { |
||
713 | return $invoice; |
||
714 | } |
||
715 | } |
||
716 | } |
||
717 | |||
718 | |||
719 | /** |
||
720 | * Get invoiceTax |
||
721 | * |
||
722 | * @return \ControleOnline\Entity\InvoiceTax |
||
723 | */ |
||
724 | public function getCarrierInvoiceTax() |
||
725 | { |
||
726 | foreach ($this->getInvoiceTax() as $invoice) { |
||
727 | if ($invoice->getInvoiceType() == 57) { |
||
728 | return $invoice->getInvoiceTax(); |
||
729 | } |
||
730 | } |
||
731 | } |
||
732 | |||
733 | /** |
||
734 | * Add OrderInvoice |
||
735 | * |
||
736 | * @param \ControleOnline\Entity\OrderInvoice $invoice |
||
737 | * @return People |
||
738 | */ |
||
739 | public function addInvoice(OrderInvoice $invoice) |
||
740 | { |
||
741 | $this->invoice[] = $invoice; |
||
742 | |||
743 | return $this; |
||
744 | } |
||
745 | |||
746 | /** |
||
747 | * Remove OrderInvoice |
||
748 | * |
||
749 | * @param \ControleOnline\Entity\OrderInvoice $invoice |
||
750 | */ |
||
751 | public function removeInvoice(OrderInvoice $invoice) |
||
752 | { |
||
753 | $this->invoice->removeElement($invoice); |
||
754 | } |
||
755 | |||
756 | /** |
||
757 | * Get OrderInvoice |
||
758 | * |
||
759 | * @return \Doctrine\Common\Collections\Collection |
||
760 | */ |
||
761 | public function getInvoice() |
||
762 | { |
||
763 | return $this->invoice; |
||
764 | } |
||
765 | |||
766 | |||
767 | /** |
||
768 | * Get Notified |
||
769 | * |
||
770 | * @return boolean |
||
771 | */ |
||
772 | public function getNotified() |
||
773 | { |
||
774 | return $this->notified; |
||
775 | } |
||
776 | |||
777 | /** |
||
778 | * Set Notified |
||
779 | * |
||
780 | * @param boolean $notified |
||
781 | * @return People |
||
782 | */ |
||
783 | public function setNotified($notified) |
||
784 | { |
||
785 | $this->notified = $notified ? 1 : 0; |
||
786 | |||
787 | return $this; |
||
788 | } |
||
789 | |||
790 | /** |
||
791 | * Set orderType |
||
792 | * |
||
793 | * @param string $orderType |
||
794 | * @return Order |
||
795 | */ |
||
796 | public function setOrderType($order_type) |
||
797 | { |
||
798 | $this->orderType = $order_type; |
||
799 | |||
800 | return $this; |
||
801 | } |
||
802 | |||
803 | /** |
||
804 | * Get orderType |
||
805 | * |
||
806 | * @return string |
||
807 | */ |
||
808 | public function getOrderType() |
||
809 | { |
||
810 | return $this->orderType; |
||
811 | } |
||
812 | |||
813 | /** |
||
814 | * Set app |
||
815 | * |
||
816 | * @param string $app |
||
817 | * @return Order |
||
818 | */ |
||
819 | public function setApp($app) |
||
820 | { |
||
821 | $this->app = $app; |
||
822 | |||
823 | return $this; |
||
824 | } |
||
825 | |||
826 | /** |
||
827 | * Get app |
||
828 | * |
||
829 | * @return string |
||
830 | */ |
||
831 | public function getApp() |
||
832 | { |
||
833 | return $this->app; |
||
834 | } |
||
835 | |||
836 | |||
837 | |||
838 | /** |
||
839 | * Set mainOrder |
||
840 | * |
||
841 | * @param \ControleOnline\Entity\Order $mainOrder |
||
842 | * @return Order |
||
843 | */ |
||
844 | public function setMainOrder(\ControleOnline\Entity\Order $main_order = null) |
||
845 | { |
||
846 | $this->mainOrder = $main_order; |
||
847 | |||
848 | return $this; |
||
849 | } |
||
850 | |||
851 | /** |
||
852 | * Get mainOrder |
||
853 | * |
||
854 | * @return \ControleOnline\Entity\Order |
||
855 | */ |
||
856 | public function getMainOrder() |
||
857 | { |
||
858 | return $this->mainOrder; |
||
859 | } |
||
860 | |||
861 | /** |
||
862 | * Set mainOrderId |
||
863 | * |
||
864 | * @param integer $mainOrderId |
||
865 | * @return Order |
||
866 | */ |
||
867 | public function setMainOrderId($mainOrderId) |
||
868 | { |
||
869 | $this->mainOrderId = $mainOrderId; |
||
870 | |||
871 | return $this; |
||
872 | } |
||
873 | |||
874 | /** |
||
875 | * Get mainOrderId |
||
876 | * |
||
877 | * @return integer |
||
878 | */ |
||
879 | public function getMainOrderId() |
||
880 | { |
||
881 | return $this->mainOrderId; |
||
882 | } |
||
883 | |||
884 | |||
885 | |||
886 | public function getInvoiceByStatus(array $status) |
||
887 | { |
||
888 | foreach ($this->getInvoice() as $purchasingOrderInvoice) { |
||
889 | $invoice = $purchasingOrderInvoice->getInvoice(); |
||
890 | if (in_array($invoice->getStatus()->getStatus(), $status)) { |
||
891 | return $invoice; |
||
892 | } |
||
893 | } |
||
894 | } |
||
895 | |||
896 | |||
897 | public function canAccess($currentUser): bool |
||
898 | { |
||
899 | if (($provider = $this->getProvider()) === null) |
||
900 | return false; |
||
901 | |||
902 | return $currentUser->getPeople()->getLink()->exists( |
||
903 | function ($key, $element) use ($provider) { |
||
904 | return $element->getCompany() === $provider; |
||
905 | } |
||
906 | ); |
||
907 | } |
||
908 | |||
909 | public function justOpened(): bool |
||
910 | { |
||
911 | return $this->getStatus()->getStatus() == 'quote'; |
||
912 | } |
||
913 | |||
914 | /** |
||
915 | * Get tracking |
||
916 | * |
||
917 | * @return \Doctrine\Common\Collections\Collection |
||
918 | */ |
||
919 | public function getTracking() |
||
920 | { |
||
921 | return $this->tracking; |
||
922 | } |
||
923 | |||
924 | public function getOneInvoice() |
||
925 | { |
||
926 | return (($invoiceOrders = $this->getInvoice()->first()) === false) ? |
||
927 | null : $invoiceOrders->getInvoice(); |
||
928 | } |
||
929 | |||
930 | /** |
||
931 | * Add Task |
||
932 | * |
||
933 | * @param \ControleOnline\Entity\Task $task |
||
934 | * @return Order |
||
935 | */ |
||
936 | public function addTask(\ControleOnline\Entity\Task $task) |
||
937 | { |
||
938 | $this->task[] = $task; |
||
939 | |||
940 | return $this; |
||
941 | } |
||
942 | |||
943 | /** |
||
944 | * Remove Task |
||
945 | * |
||
946 | * @param \ControleOnline\Entity\Task $task |
||
947 | */ |
||
948 | public function removeTask(\ControleOnline\Entity\Task $task) |
||
949 | { |
||
950 | $this->task->removeElement($task); |
||
951 | } |
||
952 | |||
953 | /** |
||
954 | * Get Task |
||
955 | * |
||
956 | * @return \Doctrine\Common\Collections\Collection |
||
957 | */ |
||
958 | public function getTask() |
||
959 | { |
||
960 | return $this->task; |
||
961 | } |
||
962 | |||
963 | /** |
||
964 | * Add OrderQueue |
||
965 | * |
||
966 | * @param \ControleOnline\Entity\OrderQueue $invoice_tax |
||
967 | * @return Order |
||
968 | */ |
||
969 | public function addAOrderQueue(\ControleOnline\Entity\OrderQueue $orderQueue) |
||
970 | { |
||
971 | $this->orderQueue[] = $orderQueue; |
||
972 | |||
973 | return $this; |
||
974 | } |
||
975 | |||
976 | /** |
||
977 | * Remove OrderQueue |
||
978 | * |
||
979 | * @param \ControleOnline\Entity\OrderQueue $invoice_tax |
||
980 | */ |
||
981 | public function removeOrderQueue(\ControleOnline\Entity\OrderQueue $orderQueue) |
||
982 | { |
||
983 | $this->orderQueue->removeElement($orderQueue); |
||
984 | } |
||
985 | |||
986 | /** |
||
987 | * Get OrderQueue |
||
988 | * |
||
989 | * @return \Doctrine\Common\Collections\Collection |
||
990 | */ |
||
991 | public function getOrderQueue() |
||
992 | { |
||
993 | return $this->orderQueue; |
||
994 | } |
||
995 | |||
996 | public function isOriginAndDestinationTheSame(): ?bool |
||
1016 | } |
||
1017 | |||
1018 | public function isOriginAndDestinationTheSameState(): ?bool |
||
1019 | { |
||
1020 | if (($origin = $this->getAddressOrigin()) === null) { |
||
1021 | return null; |
||
1022 | } |
||
1023 | |||
1024 | if (($destination = $this->getAddressDestination()) === null) { |
||
1025 | return null; |
||
1026 | } |
||
1027 | |||
1028 | $origState = $origin->getStreet()->getDistrict()->getCity()->getState(); |
||
1029 | $destState = $destination->getStreet()->getDistrict()->getCity()->getState(); |
||
1030 | |||
1031 | // both objects are the same entity ( = same name and same country) |
||
1032 | |||
1033 | if ($origState === $destState) { |
||
1034 | return true; |
||
1035 | } |
||
1036 | |||
1037 | return false; |
||
1038 | } |
||
1039 | |||
1040 | |||
1041 | public function getOrderProducts() |
||
1042 | { |
||
1043 | return $this->orderProducts; |
||
1044 | } |
||
1045 | |||
1046 | public function addOrderProduct(OrderProduct $orderProduct): self |
||
1050 | } |
||
1051 | |||
1052 | public function removeOrderProduct(OrderProduct $orderProduct): self |
||
1053 | { |
||
1054 | $this->orderProducts->removeElement($orderProduct); |
||
1055 | return $this; |
||
1056 | } |
||
1057 | } |
||
1058 |
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