General method to create classes from the registered list.
@param string $name
@param array $arguments
@return mixed
327175
public function create($name, array $arguments = array())
	{
		if(!isset($this->reflections[$name]))
			$this->reflections[$name] = new \ReflectionClass($this->registry[$name]);

		$reflection = $this->reflections[$name];

		return $reflection->newInstanceArgs($arguments);
	}
222099
protected function createSection(string $name, array $args) : SectionInterface {
        $className = $this->getSectionClassName($name);

        // aditional parameters
        $args[] = $this->authentication;
        $args[] = $this->client;
        $args[] = $this->throwsExceptions;
        $args[] = $this->baseUrl;

        return new $className(...$args);
    }
952496
public static function get(string $name, array $args = [], $persistant = false)
    {
        if (!is_array(static::$classes)) {
            throw new ArchException('A static property $classes with an array of classes must be declared in class [' . __CLASS__ . ']');
        }
        if (!array_key_exists($name, static::$classes)) {
            throw new ArchException('Unknown object [' . $name . ']');
        }
        return self::buildClass(static::$classes[$name], $args, $persistant);
    }
1207887
public static function make($name, array $options = []): self
    {
        $class = new ReflectionClass($options['class'] ?? static::class);

        /* @var static $instance */
        $instance = $class->newInstanceWithoutConstructor();
        $instance->setName($name);
        $instance->setOptions($options);

        return $instance;
    }
900696
private static function createInstance($classname, array $arguments = array())
    {
        $reflection_obj = new ReflectionClass($classname);
        if ($reflection_obj->getMethod('__construct')->isPublic()) {
            self::$_instances[ $classname ] = call_user_func_array(array($reflection_obj, 'newInstance'), $arguments);
            if (
                method_exists(self::$_instances[ $classname ], 'init') &&
                is_callable(array(self::$_instances[ $classname ], 'init'))
            ) {
                self::$_instances[ $classname ]->init();
            }
        } else {
            self::$_instances[ $classname ] = new $classname;
            if (
                method_exists(self::$_instances[ $classname ], 'init') &&
                is_callable(array(self::$_instances[ $classname ], 'init'))
            ) {
                call_user_func_array(array(self::$_instances[ $classname ], 'init'), $arguments);
            }
        }
    }
273055
public function getInstance($name, $parameters = [])
	{
		$class = $this->baseNamespace . ucfirst($name);

		// If we have a custom class, use that instead.
		if ( ! empty($this->addedClasses[$name]))
		{
			$class = $this->addedClasses[$name];
		}

		// Ensure our class actually exists
		if ( ! class_exists($class))
		{
			throw new InvalidArgumentException("$name is not a known class ($class)");
		}

		return new $class($parameters);
	}
116743
public function call($name, $arguments = [])
    {
        return $this->runViaLaravelCollection(function ($collection) use (
            $name,
            $arguments
        ) {
            return call_user_func_array(
                [$collection, $name],
                $this->coollectizeCallbacks($this->__toArray($arguments), $name)
            );
        },
        $name);
    }
1363602
public function makeClass($alias, array $arguments)
    {
        $reflection = new \ReflectionClass($this->getAlias($alias));

        return $reflection->newInstanceArgs($arguments);
    }
999023
public function make($name, array $args = [])
    {
        list($className, $normalizedClass) = $this->resolveAlias($name);

        if (isset($this->inProgressMakes[$normalizedClass])) {
            throw new InjectionException(
                $this->inProgressMakes,
                sprintf(
                    InjectorException::M_CYCLIC_DEPENDENCY,
                    $className
                ),
                InjectorException::E_CYCLIC_DEPENDENCY
            );
        }

        $this->inProgressMakes[$normalizedClass] = count($this->inProgressMakes);

        // isset() is used specifically here because classes may be marked as "shared" before an
        // instance is stored. In these cases the class is "shared," but it has a null value and
        // instantiation is needed.
        if (isset($this->shares[$normalizedClass])) {
            unset($this->inProgressMakes[$normalizedClass]);

            return $this->shares[$normalizedClass];
        }

        if (isset($this->delegates[$normalizedClass])) {
            $executable         = $this->buildExecutable($this->delegates[$normalizedClass]);
            $reflectionFunction = $executable->getCallableReflection();
            $args               = $this->provisionFuncArgs($reflectionFunction, $args);
            $obj                = call_user_func_array(array($executable, '__invoke'), $args);
        } else {
            $obj = $this->provisionInstance($className, $normalizedClass, $args);
        }

        $obj = $this->prepareInstance($obj, $normalizedClass);

        if (array_key_exists($normalizedClass, $this->shares)) {
            $this->shares[$normalizedClass] = $obj;
        }

        unset($this->inProgressMakes[$normalizedClass]);

        return $obj;
    }
1109805
public function helper($name, $args = [])
    {
        $args = func_get_args();
        $name = array_shift($args);
        if (isset($this->helpers[$name]) && is_callable($this->helpers[$name])) {
            return call_user_func_array($this->helpers[$name], $args);
        } elseif (($helper = [Helper::class, $name]) && is_callable($helper)) {
            return call_user_func_array($helper, $args);
        }

        throw new \RuntimeException(sprintf('undefined helper "%s" in %s line %d', $name, static::NAME, $this->getLineTrace()));
    }
546302
public function make($name, $parameters = []) {
		$name = $this->getAlias($name);

		if (is_string($name) && $this->resolved($name)) {
			return $this->instances[$name];
		}

		if (is_callable($name) || (is_string($name) && !$this->registered($name))) {
			return $this->build($name, $parameters ?: []);
		}

		list($builder, $singleton) = $this->extractComponentBuilder($name);

		$component = $this->build($builder, $parameters);

		if ($this->hasExtender($name)) {
			$extenders = $this->getExtenders($name);
			$component = $this->resolveExtend($component, $extenders);
		}

		if ($singleton) {
			$this->instance($name, $component);
		}

		return $component;
	}
746064
public function get($name, array $arguments = [])
    {
        if (array_key_exists($name, $this->reflections) === false) {
            throw new RegistryNotFoundException("$name not found registry");
        }

        $reflection = $this->reflections[$name];

        return $reflection->newInstanceArgs($arguments);
    }
420031
protected function executeCommand($name, array $arguments)
    {
        $command = $this->client->createCommand($name, $arguments);

        return $this->client->executeCommand($command);
    }
757479
private function createDispatch(array $arguments)
    {
        $arguments['controller'] = $this->filterName($arguments['controller']);
        $data = [
            'className' => ltrim(
                "{$arguments['namespace']}"."\\"."{$arguments['controller']}",
                "\\"
            ),
            'method' => lcfirst($this->filterName($arguments['action'])),
            'arguments' => $arguments['args']
        ];
        $reflection = new \ReflectionClass(ControllerDispatch::class);
        return $reflection->newInstanceArgs($data);
    }
79059
public static function create($accessor, $name, array $arguments = [])
    {
        $container = static::getContainer();
        $object = $container->get($accessor);

        return call_user_func_array([$object, $name], $arguments);
    }
286914
public function makeInstance(string $namespace, $arguments = [])
    {
        if (!class_exists($namespace)) {
            throw new ContainerException(sprintf('Class "%s" not exists.', $namespace));
        }
        $class = $this->getClassNameFromNamespace($namespace);

        if ($this->has($class)) {
            return $this->get($class);
        }

        return $this[$class] = new $namespace($arguments);
    }
1070752
private function callSessionMethod(string $name, array $arguments)
    {
        return \call_user_func_array(
            [
                $this->getFactory()->getSession(),
                $name
            ],
            $arguments
        );
    }