public static function createObject($type)
    {
        if (\is_string($type)) {
            return static::get($type);
        } elseif (\is_array($type)) {
            if (!isset($type['class'])) {
                throw new InvalidConfigException('Object configuration must be an array containing a "class" element.');
            }

            $class = $type['class'];
            unset($type['class']);

            return static::get($class, $type);
        }

        throw new InvalidConfigException('Unsupported configuration type: ' . \gettype($type));
    }
public static function createObject($type)
    {
        if (\is_string($type)) {
            return static::get($type);
        } elseif (\is_array($type)) {
            if (!isset($type['class'])) {
                throw new InvalidConfigException('Object configuration must be an array containing a "class" element.');
            }

            $class = $type['class'];
            unset($type['class']);

            return static::get($class, $type);
        }

        throw new InvalidConfigException('Unsupported configuration type: ' . \gettype($type));
    }
public static function createObject ( $ type ) { if ( \ is_string ( $ type ) ) { return static :: get ( $ type ) ; } elseif ( \ is_array ( $ type ) ) { if ( ! isset ( $ type [ 'class' ] ) ) { throw new InvalidConfigException ( 'Object configuration must be an array containing a "class" element.' ) ; } $ class = $ type [ 'class' ] ; unset ( $ type [ 'class' ] ) ; return static :: get ( $ class , $ type ) ; } throw new InvalidConfigException ( 'Unsupported configuration type: ' . \ gettype ( $ type ) ) ; }
Creates a new object using the given configuration. Inspired by Yii2.
@see \yii\BaseYii::createObject
@param string|array $type
@return mixed
@throws InvalidConfigException
@throws \ReflectionException
Creates a new object using the given configuration . Inspired by Yii2 .