transport = $transport; $this->endpoints = $endpoint; :new-namespaces $this->registeredNamespaces = $registeredNamespaces; } :endpoints :functions /** * Catchall for registered namespaces * * @return object * @throws BadMethodCallException if the namespace cannot be found */ public function __call(string $name, array $arguments) { if (isset($this->registeredNamespaces[$name])) { return $this->registeredNamespaces[$name]; } throw new BadMethodCallException("Namespace [$name] not found"); } /** * Extract an argument from the array of parameters * * @return null|mixed */ public function extractArgument(array &$params, string $arg) { if (array_key_exists($arg, $params) === true) { $value = $params[$arg]; $value = (is_object($value) && !is_iterable($value)) ? (array) $value : $value; unset($params[$arg]); return $value; } else { return null; } } /** * @return callable|array */ private function performRequest(AbstractEndpoint $endpoint) { $promise = $this->transport->performRequest( $endpoint->getMethod(), $endpoint->getURI(), $endpoint->getParams(), $endpoint->getBody(), $endpoint->getOptions() ); return $this->transport->resultOrFuture($promise, $endpoint->getOptions()); } }