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