/** * @param string $key * * @return Utils\ArrayHash|NULL */ public function getDetails($key = NULL) { if ($this->details === NULL) { try { if ($this->profileId !== NULL) { if (($result = $this->twitter->get('users/show.json', ['screen_name' => $this->profileId])) && $result instanceof Utils\ArrayHash) { $this->details = $result; } } else { if ($user = $this->twitter->getUser()) { if (($result = $this->twitter->get('users/show.json', ['user_id' => $user])) && $result instanceof Utils\ArrayHash) { $this->details = $result; } } else { $this->details = new Utils\ArrayHash(); } } } catch (\Exception $e) { // todo: log? } } if ($key !== NULL) { return isset($this->details[$key]) ? $this->details[$key] : NULL; } return $this->details; }