| Conditions | 3 |
| Paths | 3 |
| Total Lines | 21 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | public function process($name, $count) |
||
| 35 | { |
||
| 36 | $swatch = new Option($name); |
||
| 37 | $optionCount = 0; |
||
| 38 | while ($this->webDriver->elementExists($this->theme->getConfigurableSwatchSelectorXpath($count, ++$optionCount), WebDriver::BY_XPATH)) { |
||
| 39 | |||
| 40 | $itemOptionElement = $this->webDriver->byXpath($this->theme->getConfigurableSwatchSelectorXpath($count, $optionCount)); |
||
| 41 | $img = null; |
||
| 42 | $available = !$this->webDriver->elementExists($this->theme->getConfigurableSwatchNotAvailableXpath($count, $optionCount), WebDriver::BY_XPATH); |
||
| 43 | if ($this->webDriver->elementExists($this->theme->getConfigurableSwatchImgXpath($count, $optionCount), WebDriver::BY_XPATH)) { |
||
| 44 | $img = $this->webDriver->byXpath($this->theme->getConfigurableSwatchImgXpath($count, $optionCount))->getAttribute('src'); |
||
| 45 | } |
||
| 46 | $swatch->addValue(new SwatchValue( |
||
| 47 | trim($itemOptionElement->getAttribute($this->theme->getConfigurableSwatchOptionLabelAttributeName())), |
||
| 48 | $itemOptionElement, |
||
| 49 | $available, |
||
| 50 | $img |
||
| 51 | )); |
||
| 52 | } |
||
| 53 | return $swatch; |
||
| 54 | } |
||
| 55 | } |