Register a new client that will be able to be use by the ApiFactory

@param  string          $name
@param  string          $class
@param  string|callable $requirement
@param  bool            $priority
@throws \InvalidArgumentException
438320
public function register($name, $class, $requirement = '', $priority = false)
    {
        if (!class_exists($class)) {
            throw new \InvalidArgumentException(sprintf('%s is not a valid class name.', $class));
        }

        $definition = [
            'class'       => $class,
            'requirement' => $requirement
        ];

        if ($priority) {
            $this->classes = array_merge_recursive([$name => $definition], $this->classes);
        } else {
            $this->classes[$name] = $definition;
        }
    }
941142
public function filter($name, $callable, $priority = 10, $override = false)
    {
        if ($override) {
            $this->clearFilters($name);
        }

        if (!isset($this->filters[$name])) {
            $this->filters[$name] = array(array());
        }
        if (is_callable($callable)) {
            $this->filters[$name][(int) $priority][] = $callable;
        }
    }
1248995
public static function registerEngine($engineClass, $priority)
    {
        if (!is_int($priority)) {
            trigger_error('Priority must be integer', E_USER_WARNING);

            return;
        }
        if (array_key_exists($priority, self::$registeredEngines)) {
            trigger_error('Priority already taken', E_USER_WARNING);

            return;
        }
        if (!class_exists($engineClass)) {
            trigger_error('Engine does not exist', E_USER_WARNING);

            return;
        }
        self::$registeredEngines[$priority] = $engineClass;
    }
157123
public static function create($class, $name)
    {
        $actor = Pool::getInstance()->get($class);
        $actor->initialization($name);
        return $actor;
    }
1070379
public function addListener($name, $listener, $priority = 0)
    {
        if (! isset($this->listeners[$name])) $this->listeners[$name] = [];
        $this->listeners[$name][$priority][] = $listener;
    }
520898
protected void register(final Class<? extends Component<?>> interfaceClass, final Class<? extends Component<?>> implClass, final PriorityLevel priority, final int weight) {

        preloadClass(interfaceClass);

        getFacade().componentFactory().register(
                                                RegistrationItemBase.create()
                                                                    .interfaceClass(interfaceClass)
                                                                    .implClass(implClass)
                                                                    .priority(priority)
                                                                    .weight(weight));
    }
650169
public function createApiConnector(string $name, array $options = []): ApiConnector
    {
        $namespace = __NAMESPACE__ . '\\Connector';
        $class     = $namespace . '\\' . \ucfirst(\strtolower($name));

        if (\class_exists($class)) {
            return new $class($this->client, $this->requestFactory, $this->streamFactory, $this->uriFactory, $options);
        }

        // No class found, sorry!
        throw new Exception\UnknownApiConnectorException("Could not find an API object for '$name'.");
    }
902725
public function hook($name, $callable, $priority = 10, $override = false)
    {
        if ($override) {
            $this->clearHooks($name);
        }

        return parent::hook($name, $callable, $priority);
    }
609002
public function api($class = null, $type = null, $name = null) {
		$class = str_replace(".", "\\", $class);

		switch ($type) {
			default:
				$info = Inspector::info($class);
				$result = ['class' => [
					'name' => $info['shortName'],
					'description' => trim($info['description'] . PHP_EOL . PHP_EOL . $info['text'])
				]];
			break;
			case 'method':
				$result = $this->_methods($class, compact('name'));
			break;
			case 'property':
				$result = $this->_properties($class, compact('name'));
			break;
		}
		$this->_render($result);
	}
1335991
public function declareQueue($name, array $options = [], callable $callback = null)
    {
        $passive = array_key_exists('passive', $options) ? (bool)$options['passive'] : null;
        $durable = array_key_exists('durable', $options) ? (bool)$options['durable'] : null;
        $exclusive = array_key_exists('exclusive', $options) ? (bool)$options['exclusive'] : null;
        $autoDelete = array_key_exists('autoDelete', $options) ? (bool)$options['autoDelete'] : null;
        $noWait = array_key_exists('noWait', $options) ? (bool)$options['noWait'] : null;
        $arguments = array_key_exists('arguments', $options) ? $options['arguments'] : null;

        $outputFrame = Queue\QueueDeclareFrame::create(
            $name,
            $passive,
            $durable,
            $exclusive,
            $autoDelete,
            $noWait,
            $arguments
        );
        $outputFrame->frameChannelId = $this->id;
        $this->connection->command($outputFrame);

        if (is_callable($callback)) {
            $this->on(self::EVENT_ON_CHANNEL_DECLARE_QUEUE_CALLBACK, $callback);
        }
    }
505664
public function setClient()
    {
        if(empty($this->apiKey))
        {
            throw new InvalidArgumentException('Api key can not be empty');
        }

        $this->client = new Client($this->apiKey);
    }
55787
protected function createActor($class, $name)
    {
        $actor = Pool::getInstance()->get($class);
        $actor->initialization($name);
        $this->addChild($actor);
        return $actor;
    }
427430
public function registerWrapper($name, $class)
    {
        if (!is_subclass_of($class, WrapperInterface::class)) {
            throw new \RuntimeException(sprintf(
                'Wrapper class "%s" must be implement ' . WrapperInterface::class,
                $class
            ));
        }
        $this->wrappers[$name] = $class;

        return $this;
    }
508360
public static synchronized ILoadBalancer registerNamedLoadBalancerFromProperties(String name, Class<? extends IClientConfig> configClass) throws ClientException {
        if (namedLBMap.get(name) != null) {
            throw new ClientException("LoadBalancer for name " + name + " already exists");
        }
        IClientConfig clientConfig = getNamedConfig(name, configClass);
        return registerNamedLoadBalancerFromclientConfig(name, clientConfig);
    }
925024
public function registerFormatter($name, $class)
    {
        $name = strtolower(is_array($name) ? implode('-', $name) : $name);
        if (array_key_exists($name, static::$formatters)) {
            throw new \RuntimeException(sprintf('Formatter %s already registered.', $class));
        }
        static::$formatters[$name] = $class;

        return $this;
    }
1202860
public function registerResponseClass($name, $class)
    {
        $this->responseClasses[$name] = $class;
        // set retrospectively if method already encountered
        if ($this->serviceDescription !== null
            && $this->hasOperation($name) === true
        ) {
            throw new \LogicException(
                "Too late to add new response class, {$name} operation has already been defined. "
                .'If you want to add a new response class, call reset() method first, add new response class '
                .'and run build again.'
            );
        }
        return $this;
    }
1032082
public function mapLazyService(string $name, $class = null)
    {
        if (isset($this->services[$name]) && ! $this->allowOverride) {
            throw ContainerModificationsNotAllowedException::fromExistingService($name);
        }
        $this->lazyServicesClassMap[$name] = $class ?? $name;
        $this->lazyServicesDelegator = null;
    }