apis[$api])) { throw new \InvalidArgumentException('API has already a handler: '.$api); } $this->apis[$api] = $handler; } /** * Returns an API handler. * * @param string $api An API name of the handle * @return mixed Returns a handler * @throws \InvalidArgumentException When no such handler exists */ public function getApiHandler($api) { if (!isset($this->apis[$api])) { throw new \InvalidArgumentException('No handler for '.$api.' implemented.'); } return $this->apis[$api]; } }