Generates an NgRest Plugin Object.

@param string $className
@param string $name
@param string $alias
@param boolean $i18n
@param array $args
@return \luya\admin\ngrest\base\Plugin
423580
public static function createPluginObject($className, $name, $alias, $i18n, $args = [])
    {
        return Yii::createObject(array_merge([
            'class' => $className,
            'name' => $name,
            'alias' => $alias,
            'i18n' => $i18n,
        ], $args));
    }
889826
protected function buildTerminalObject($name, $arguments)
    {
        // Retrieve the parser for the current set of styles
        $parser = $this->style->parser($this->util->system);

        // Reset the styles
        $this->style->reset();

        // Execute the terminal object
        $this->router->settings($this->settings);
        $this->router->parser($parser);
        $this->router->output($this->output);
        $this->router->util($this->util);

        return $this->router->execute($name, $arguments);
    }
543294
public static function create($option = array(), $alias = null)
	{
		if('' === static::$driverName)
		{
			static::init();
		}
		if(isset(self::$instances[static::$driverName][$alias]))
		{
			return self::$instances[static::$driverName][$alias];
		}
		else
		{
			$object = static::__createBefore($option, $alias);
			if(null === $object)
			{
				$className = static::$driverName . $option['type'];
				$ref = new ReflectionClass($className);
				$object = $ref->newInstance(isset($option['option']) ? $option['option'] : array());
			}
			static::__createAfter($option, $alias, $object);
			if(null !== $alias)
			{
				self::$instances[static::$driverName][$alias] = $object;
			}
			return $object;
		}
	}
948747
public function createNewAlias($alias, $path, array $pathParameters = array(), $locale = null, $title = null, $keywords = null, $description = null)
    {
        $rc = new \ReflectionClass($this->entityClass);
        $object = $rc->newInstance();
        if (!$object instanceof ContentInterface) {
            return;
        }
        $object->setAlias($alias);
        $pathParameters[UrlGenerator::GENERATE_NORMAL_ROUTE] = true;
        $path = $this->router->generate($path, $pathParameters);
        $path = str_replace('/app_dev.php', '', $path);
        $key = $this->generator->generateMetaTagKeyFromRelativePath($path, $this->router, $locale);
        $object->setKeyword($key);
        $object->setTitle($title);
        $object->setKeywords($keywords);
        $object->setDescription($description);

        return $object;
    }
132875
public function getResolverFromArgument(string $argumentName): Closure
    {
        [$className, $methodName] = $this->getMethodArgumentParts($argumentName);

        $namespacedClassName = $this->namespaceClassName($className);

        return Utils::constructResolver($namespacedClassName, $methodName);
    }
1205123
public static function create($name, ...$args)
    {
        $name = static::getClass($name);

        $class = static::findClass($name);

        if ($class) {
            return static::createObject($class, ...$args);
        }

        return null;
    }
839538
protected function createInstance($className, $name)
    {
        $formConfiguration = $this->typoScriptService->getFormConfiguration($className);

        /** @var FormObject $instance */
        $instance = Core::instantiate(FormObject::class, $className, $name, $formConfiguration);

        $this->insertObjectProperties($instance);

        $instance->getHash();

        return $instance;
    }
1348965
private function getNamedArguments($className, $functionName, array $arguments)
    {
        $fullFunctionName = $this->getFullFunctionName($className, $functionName);

        if (empty($this->functionArgumentsCache[$fullFunctionName])) {
            $this->functionArgumentsCache[$fullFunctionName] =
                $this->buildReflectionFunction($className, $functionName)->getParameters();
        }

        $i              = 0;
        $namedArguments = array();
        foreach ($this->functionArgumentsCache[$fullFunctionName] as $parameter) {
            /** @var ReflectionParameter $parameter */
            try {
                $defaultValue = '[defaultValue:' . $this->sanitize($parameter->getDefaultValue()) . ']';
            } catch (ReflectionException $e) {
                $defaultValue = '';
            }

            $namedArguments[$parameter->getName()] = isset($arguments[$i])
                ? $arguments[$i]
                : $defaultValue;
            $i++;
        }

        return $namedArguments;
    }
779288
public static function object($alias,$namespace=null,$args=[]) {
        if (isset(self::$pool[$alias])) {
            return self::$pool[$alias];
        }

        //object('dao','\app\Name',[]);3
        //object('dao','\app\Name');2

        //object('\app\Name',[]); 2
        //object('\app\Name');  1

        if($namespace == null) {
            $namespace = $alias;
        }
        elseif(is_array($namespace)) {
            $args = $namespace;
            $namespace = $alias;
        }

        $constructor = static::make($namespace,$args);
        /*
        $reflect = new \ReflectionClass($namespace);
        $constructor = $reflect->getConstructor();
        if (!$constructor || $constructor->getNumberOfParameters() == 0) {
            $constructor = $reflect->newInstance();
        }
        else {
            $constructor = $reflect->newInstanceArgs($args);
        }
        */
        //固化
        if(in_array($alias,Config::$o->pool)) {
            self::$solidify[$alias] = $constructor;
        }
        return self::$pool[$alias] = $constructor;
    }
1363602
public function makeClass($alias, array $arguments)
    {
        $reflection = new \ReflectionClass($this->getAlias($alias));

        return $reflection->newInstanceArgs($arguments);
    }
394286
public static function bindStatic($className, $methodName, $args = null)
    {
        if (empty($args)) {
            $args = null;
        }
        $native = [$className, $methodName];
        $callback = function () use ($native, $args) {
            $a = func_get_args();
            if ($args !== null) {
                $a = array_merge($a, $args);
            }
            return call_user_func_array($native, $a);
        };
        return $callback->bindTo(null, $className);
    }
563965
public function getColumn($name, $alias = '')
    {
        $column = new DerivedColumn($name, $alias);

        return $column->setTable($this);
    }
47478
public function newInstance($className, array $args = array())
    {
        // create and return a new instance
        $reflectionClass = $this->newReflectionClass($className);
        return $reflectionClass->newInstanceArgs($args);
    }
636198
public function makeServiceInstance(string $className, $arguments = NULL, $configuration = NULL) {
        $instance = NULL;

        $implInterfaces = class_implements($className);
        if(in_array(ConstructorAwareServiceInterface::class, $implInterfaces)) {
            /** @var ConstructorAwareServiceInterface $className */
            if($args = $className::getConstructorArguments()) {
                $newArguments = [];

                foreach($args as $argName => $argValue) {
                    $newArguments[] = is_null($argValue) ? ($arguments[$argName] ?? NULL) : $argValue;
                }

                $arguments = $newArguments;
            }
        }

        if($arguments)
            $arguments = $this->mapArray( AbstractCollection::makeArray($arguments), true);

        if(in_array(StaticConstructorServiceInterface::class, $implInterfaces)) {
            $instance = new $className($arguments, $this);
        } elseif (in_array(DynamicConstructorServiceInterface::class, $implInterfaces)) {
            $sig = SignatureService::getSignatureService()->getMethodSignature($className, "__construct");
            $args = [];
            foreach($sig as $name => $type) {

            }
            $instance = new $className(...$args);
        } else {
            $instance = $arguments ? new $className(...array_values($arguments)) : new $className();
        }

        if($configuration && method_exists($instance, 'setConfiguration')) {
            $configuration = $this->mapArray( $configuration );
            $instance->setConfiguration($configuration);
        }

        return $instance;
    }
339097
private static function create_namespace( $parent, $name, $callable ) {
		$reflection  = new ReflectionClass( $callable );
		$doc_comment = self::get_doc_comment( $reflection );
		if ( ! $doc_comment ) {
			\WP_CLI::debug( null === $doc_comment ? "Failed to get doc comment for {$name}." : "No doc comment for {$name}.", 'commandfactory' );
		}
		$docparser = new \WP_CLI\DocParser( $doc_comment );

		return new CommandNamespace( $parent, $name, $docparser );
	}
637468
public static GobblinInstancePluginFactory instantiatePluginByAlias(String alias)
      throws ClassNotFoundException, InstantiationException, IllegalAccessException {
    return RESOLVER.resolveClass(alias).newInstance();
  }
1039776
public function createPointer($domain, $alias = false)
    {
        $parameters = [
            'domain' => $this->domainName,
            'from' => $domain,
            'action' => 'add',
        ];
        if ($alias) {
            $parameters['alias'] = 'yes';
            $list = &$this->aliases;
        } else {
            $list = &$this->pointers;
        }
        $this->getContext()->invokeApiPost('DOMAIN_POINTER', $parameters);
        $list[] = $domain;
        $list = array_unique($list);
    }