| Total Complexity | 7 |
| Total Lines | 57 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class AddToCartGraphQl implements ArgumentInterface |
||
| 12 | { |
||
| 13 | private CurrentProduct $currentProduct; |
||
| 14 | |||
| 15 | public function __construct( |
||
| 16 | CurrentProduct $currentProduct) |
||
| 17 | { |
||
| 18 | $this->currentProduct = $currentProduct; |
||
| 19 | } |
||
| 20 | |||
| 21 | private function getProduct() : ProductInterface |
||
| 24 | } |
||
| 25 | |||
| 26 | public function isProductConfigurable(): bool |
||
| 27 | { |
||
| 28 | return $this->getProduct()->getTypeId() === Configurable::TYPE_CODE; |
||
| 29 | } |
||
| 30 | |||
| 31 | public function getAddToCartQuery(): string |
||
| 32 | { |
||
| 33 | if ($this->isProductConfigurable()) { |
||
| 34 | return $this->getAddToCartQueryProductTypeConfigurable(); |
||
| 35 | } |
||
| 36 | |||
| 37 | return $this->getAddToCartQueryProductTypeSimple(); |
||
| 38 | } |
||
| 39 | |||
| 40 | private function getAddToCartQueryProductTypeSimple(): string |
||
| 41 | { |
||
| 42 | return '{ |
||
| 43 | addProductsToCart( |
||
| 44 | cartId: "%cartId" |
||
| 45 | cartItems: [ |
||
| 46 | { |
||
| 47 | quantity: %qty |
||
| 48 | sku: "%sku" |
||
| 49 | } |
||
| 50 | ] |
||
| 51 | ) { |
||
| 52 | cart { |
||
| 53 | items { |
||
| 54 | product { |
||
| 55 | name |
||
| 56 | sku |
||
| 57 | } |
||
| 58 | quantity |
||
| 59 | } |
||
| 60 | } |
||
| 61 | } |
||
| 62 | }'; |
||
| 63 | } |
||
| 64 | |||
| 65 | private function getAddToCartQueryProductTypeConfigurable(): string |
||
| 68 | addProductsToCart( |
||
| 69 | cartId: "%cartId" |
||
| 70 | cartItems: [ |
||
| 71 | { |
||
| 91 |
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