public static function bestRates() { $limit = Core::validate(self::getVar('limit')); if ($limit == null) { $limit = 10; } $bestRates = Rate::getBestRates($limit); $data = array(); $currency = new Currency(); $deal = new Deal(); foreach ($bestRates as $rate) { $currency->findById($rate['FirstId']); $row['firstCurrency'] = $currency->getName(); $currency->findById($rate['SecondId']); $row['secondCurrency'] = $currency->getName(); $deal->findLastDealByRate($rate['id']); $row['lastPrice'] = $deal->getPrice(); $row['id'] = $rate['id']; array_push($data, $row); } //$result['data'] = $data; return $data; }