1 | <?php |
||
23 | final class ProductVariantContext implements Context |
||
24 | { |
||
25 | /** |
||
26 | * @var ProductRepositoryInterface |
||
27 | */ |
||
28 | private $productRepository; |
||
29 | |||
30 | /** |
||
31 | * @var RepositoryInterface |
||
32 | */ |
||
33 | private $productVariantRepository; |
||
34 | |||
35 | /** |
||
36 | * @param ProductRepositoryInterface $productRepository |
||
37 | * @param RepositoryInterface $productVariantRepository |
||
38 | */ |
||
39 | public function __construct(ProductRepositoryInterface $productRepository, RepositoryInterface $productVariantRepository) |
||
44 | |||
45 | /** |
||
46 | * @Transform /^"([^"]+)" variant of product "([^"]+)"$/ |
||
47 | */ |
||
48 | public function getProductVariantByNameAndProduct($variantName, $productName) |
||
65 | |||
66 | /** |
||
67 | * @Transform /^"([^"]+)" product variant$/ |
||
68 | * @Transform /^"([^"]+)" variant$/ |
||
69 | * @Transform :variant |
||
70 | */ |
||
71 | public function getProductVariantByName($name) |
||
83 | |||
84 | /** |
||
85 | * @Transform /^variant with code "([^"]+)"$/ |
||
86 | */ |
||
87 | public function getProductVariantByCode($code) |
||
95 | } |
||
96 |
Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.