| Conditions | 5 |
| Paths | 5 |
| Total Lines | 26 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 6 | public function validate() |
||
| 7 | { |
||
| 8 | if($this->hasMultipleArguments()) { |
||
| 9 | $arguments = $this->getArguments(); |
||
| 10 | if(!isset($arguments['id']) || !isset($arguments['name'])) { |
||
| 11 | throw new Exception('Expecting arguments "id" and "name"'); |
||
| 12 | } |
||
| 13 | $id = $this->getData($arguments['id']); |
||
| 14 | $name = $this->getData($arguments['name']); |
||
| 15 | |||
| 16 | $product = $this->getContext()->getModel('ProductFinder')->retrieveByIdAndName($id, $name); |
||
| 17 | } else { |
||
| 18 | $id = $this->getData($this->getArgument()); |
||
| 19 | |||
| 20 | $product = $this->getContext()->getModel('ProductFinder')->retrieveById($id); |
||
| 21 | } |
||
| 22 | |||
| 23 | if(!$product) { |
||
| 24 | $this->throwError(); |
||
| 25 | return false; |
||
| 26 | } |
||
| 27 | |||
| 28 | $this->export($product); |
||
| 29 | |||
| 30 | return true; |
||
| 31 | } |
||
| 32 | } |
||
| 34 | ?> |