Conditions | 12 |
Paths | 58 |
Total Lines | 38 |
Code Lines | 31 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
67 | public function execute(Observer $observer) |
||
68 | { |
||
69 | $flage = 1; |
||
70 | $keepCartProduct = $this->buyNowHelper->keepCartProducts(); |
||
71 | $updateBuyNowCart = $restoreCartProduct = $this->buyNowHelper->restoreCartProducts(); |
||
72 | if (($keepCartProduct == 0) && ($restoreCartProduct == 1)) { |
||
73 | try { |
||
74 | $orderIds = $observer->getEvent()->getOrderIds(); |
||
75 | foreach ($orderIds as $orderIdsKey => $orderIdsVal) { |
||
76 | $orderData = $this->orderRepository->get($orderIdsVal); |
||
77 | $quoteData = $this->quoteFactory->create(); |
||
78 | $quoteData->load($orderData->getQuoteId()); |
||
79 | if ($quoteData->hasData()) { |
||
80 | if (($quoteData->getBuyNowId()) && ($quoteData->getCustomerId())) { |
||
81 | $customerRepoData = $this->customerRepository->getById($quoteData->getCustomerId()); |
||
82 | $quoteDataReplace = $this->quoteFactory->create(); |
||
83 | $quoteDataReplace->load($quoteData->getBuyNowId()); |
||
84 | if ($quoteDataReplace->hasData()) { |
||
85 | $quoteDataReplace->assignCustomer($customerRepoData); |
||
86 | $quoteDataReplace->setBuyNowId(0); |
||
87 | $quoteDataReplace->setIsActive(1); |
||
88 | $quoteDataReplace->save(); |
||
89 | if ($updateBuyNowCart) { |
||
90 | $quoteData->setBuyNowId(0); |
||
91 | $quoteDataReplace->setIsActive(0); |
||
92 | $quoteData->save(); |
||
93 | } |
||
94 | } |
||
95 | } |
||
96 | } |
||
97 | break; |
||
98 | } |
||
99 | } catch (\Magento\Framework\Exception\NoSuchEntityException $e) { |
||
100 | $flage = 0; |
||
101 | } catch (\Magento\Framework\Exception\LocalizedException $e) { |
||
102 | $flage = 0; |
||
103 | } catch (\Exception $e) { |
||
104 | $flage = 0; |
||
105 | } |
||
109 |
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