*/ class Price extends BaseLoop implements ArraySearchLoopInterface { /* set countable to false since we need to preserve keys */ protected $countable = false; /** * @return ArgumentCollection */ protected function getArgDefinitions() { return new ArgumentCollection( Argument::createIntTypeArgument('area', null, true) ); } public function buildArray() { $area = $this->getArea(); $prices = Colissimo::getPrices(); if (!isset($prices[$area]) || !isset($prices[$area]["slices"])) { return array(); } $areaPrices = $prices[$area]["slices"]; ksort($areaPrices); return $areaPrices; } public function parseResults(LoopResult $loopResult) { foreach ($loopResult->getResultDataCollection() as $maxWeight => $price) { $loopResultRow = new LoopResultRow(); $loopResultRow->set("MAX_WEIGHT", $maxWeight) ->set("PRICE", $price); $loopResult->addRow($loopResultRow); } return $loopResult; } }