/** * Create a currency object and return it. * * <code> * $ids = array(1,2,3,4,5); * $currencies = new CrowdFundingCurrencies(JFactory::getDbo()); * $currencies->load($ids); * * $currency = $currencies->getCurrency(1); * </code> * * @param int $id * * @throws UnexpectedValueException * * @return null|CrowdFundingCurrency */ public function getCurrency($id) { if (!$id) { throw new UnexpectedValueException(JText::_("LIB_CROWDFUNDING_INVALID_CURRENCY_ID")); } $currency = null; foreach ($this->items as $item) { if ($id == $item["id"]) { $currency = new CrowdFundingCurrency(); $currency->bind($item); break; } } return $currency; }