Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
1 | <?php |
||
20 | class StockbaseStockManagement |
||
21 | { |
||
22 | /** |
||
23 | * @var StockRegistryInterface |
||
24 | */ |
||
25 | private $stockRegistry; |
||
26 | /** |
||
27 | * @var StockbaseConfiguration |
||
28 | */ |
||
29 | private $config; |
||
30 | /** |
||
31 | * @var ProductRepositoryInterface |
||
32 | */ |
||
33 | private $productRepository; |
||
34 | /** |
||
35 | * @var StockItemResource |
||
36 | */ |
||
37 | private $stockItemResource; |
||
38 | /** |
||
39 | * @var ObjectManagerInterface |
||
40 | */ |
||
41 | private $objectManager; |
||
42 | |||
43 | /** |
||
44 | * StockbaseStockManagement constructor. |
||
45 | * @param StockRegistryInterface $stockRegistry |
||
46 | * @param StockbaseConfiguration $config |
||
47 | * @param ProductRepositoryInterface $productRepository |
||
48 | * @param StockItemResource $stockItemResource |
||
49 | 9 | * @param ObjectManagerInterface $objectManager |
|
50 | */ |
||
51 | public function __construct( |
||
65 | |||
66 | /** |
||
67 | * Gets the amount of items available in the Stockbase stock. |
||
68 | * |
||
69 | * @param int $productId |
||
70 | 1 | * @return float |
|
71 | */ |
||
72 | 1 | public function getStockbaseStockAmount($productId) |
|
83 | |||
84 | /** |
||
85 | * Gets the Stockbase EAN for given product (if any). |
||
86 | * |
||
87 | * @param int $productId |
||
88 | 4 | * @return string|null |
|
89 | */ |
||
90 | 4 | public function getStockbaseEan($productId) |
|
115 | 1 | ||
116 | /** |
||
117 | * Checks if given product is properly configured to be processed as a Stockbase product. |
||
118 | * |
||
119 | * @param int $productId |
||
120 | * @return bool |
||
121 | */ |
||
122 | public function isStockbaseProduct($productId) |
||
126 | |||
127 | 2 | /** |
|
128 | 2 | * Increments/decrements the amount of items in stock. |
|
129 | * |
||
130 | * @param string $ean |
||
131 | * @param float $amount |
||
132 | * @param string $operation |
||
133 | */ |
||
134 | public function updateStockAmount($ean, $amount, $operation = '-') |
||
138 | 1 | ||
139 | /** |
||
140 | 1 | * Creates a stock reserve for given item. |
|
141 | * |
||
142 | * @param QuoteItem $quoteItem |
||
143 | 1 | * @param float $stockbaseAmount |
|
144 | 1 | * @param float $magentoStockAmount |
|
145 | 1 | * @return StockItemReserve |
|
146 | 1 | */ |
|
147 | 1 | public function createReserve(QuoteItem $quoteItem, $stockbaseAmount, $magentoStockAmount) |
|
165 | 1 | ||
166 | /** |
||
167 | * Releases the stock reserve. |
||
168 | * |
||
169 | * @param StockItemReserve $reserve |
||
170 | */ |
||
171 | public function releaseReserve(StockItemReserve $reserve) |
||
175 | 1 | ||
176 | /** |
||
177 | * Gets stock reserve entries for given products. |
||
178 | 1 | * |
|
179 | 1 | * @param int|int[] $productIds |
|
180 | * @return StockItemReserve[] |
||
181 | */ |
||
182 | 1 | View Code Duplication | public function getReserveForProduct($productIds) |
195 | 1 | ||
196 | /** |
||
197 | * Gets stock reserve entries for given quote items. |
||
198 | 1 | * |
|
199 | 1 | * @param int|int[] $quoteItemIds |
|
200 | * @return StockItemReserve[] |
||
201 | */ |
||
202 | 1 | View Code Duplication | public function getReserveForQuoteItem($quoteItemIds) |
215 | } |
||
216 |
Scrutinizer analyzes your
composer.json
/composer.lock
file if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.