public function __construct($config) { // only objects that implement IConfig interface are allowed to be passed for $config if (!$config instanceof IConfig) { throw new ConfigException("Invalid type for \$config parameter, it must implement IConfig interface "); } $this->_config = $config; $connectionAdapter = $this->_config->getConnectionAdapter(); switch (strtolower($connectionAdapter)) { case Config::CONNECTION_ADAPTER_GUZZLE: $this->_adapter = new GuzzleAdapter($config); break; default: throw new ConfigException("Invalid Connection Adapter set", ConfigException::INVALID_ADAPTER); break; } }
protected function _getObjectFromKind($kind) { if ($this->_config === null) { throw new AdapterException('Missing config object, it is required for mapping response to objects'); } $version = $this->_config->getAPIVersion(); $classToLoad = "\\DevStub\\KubernetesAPIClient\\Entity\\" . $version . "\\" . $kind; return new $classToLoad(); }