Ouzo\Config::registerConfig PHP Method

registerConfig() public static method

public static registerConfig ( $customConfig ) : ConfigRepository
$customConfig
return Ouzo\Config\ConfigRepository
    public static function registerConfig($customConfig)
    {
        if (!is_object($customConfig)) {
            throw new InvalidArgumentException('Custom config must be a object');
        }
        if (!method_exists($customConfig, 'getConfig')) {
            throw new InvalidArgumentException('Custom config object must have getConfig method');
        }
        $reflection = new ReflectionMethod($customConfig, 'getConfig');
        if (!$reflection->isPublic()) {
            throw new InvalidArgumentException('Custom config method getConfig must be public');
        }
        $config = self::getInstanceNoReload();
        $config->addCustomConfig($customConfig);
        return self::$configInstance;
    }

Usage Example

Example #1
0
 /**
  * @param $config
  * @return $this
  */
 public function addConfig($config)
 {
     $this->configRepository = Config::registerConfig($config);
     return $this;
 }
All Usage Examples Of Ouzo\Config::registerConfig