session = $session; } /** * Get account. * * @param int $id Account id * * @return Account * * @since 1.0.0 */ public function get(int $id = 0) : Account { if ($id === 0) { $account = new Account(Auth::authenticate($this->session)); if (!isset($this->accounts[$account->getId()])) { $this->accounts[$account->getId()] = $account; } return $account; } return $this->accounts[$id] ?? new NullAccount(); } /** * Add account. * * @param Account $account Account * * @return bool * * @since 1.0.0 */ public function add(Account $account) : bool { if (!isset($this->accounts[$account->getId()])) { $this->accounts[$account->getId()] = $account; return true; } return false; } /** * Remove account. * * @param int $id Account id * * @return bool * * @since 1.0.0 */ public function remove(int $id) : bool { if (isset($this->accounts[$id])) { unset($this->accounts[$id]); return true; } return false; } /** * Get accounts count. * * @return int * * @since 1.0.0 */ public function count() : int { return count($this->accounts); } }