/** * @param int $expenseId * @return \ArrayObject|bool * @throws \RuntimeException */ public function getTicketBalance($expenseId) { $expenseDao = new Expenses($this->getServiceLocator(), '\\ArrayObject'); $result = $expenseDao->getTicketBalance($expenseId); if (!$result) { throw new \RuntimeException("Purchase order #{$expenseId} not found."); } if ($result['finance_status'] == Ticket::FIN_STATUS_SETTLED) { throw new \RuntimeException("The PO id that you have entered is already settled. Please either put another ID or unsettle the PO."); } return ['balance' => $result['ticket_balance'], 'currency' => $result['currency']]; }