Calls a class considering all routes.

@param *string          $class class name
@param mixed[, mixed..] $arg   arguments

@return object
1052
public function call($class)
    {
        //argument 1 must be a string
        Argument::i()->test(1, 'string');

        $args = func_get_args();
        $class = array_shift($args);

        return $this->callArray($class, $args);
    }
931714
public function invokeStaticMethod($class, $name, array $args = [])
    {
        $method = new ReflectionMethod($class, $name);
        $method->setAccessible(true);

        if (empty($args)) {
            return $method->invoke(null);
        }

        return $method->invokeArgs(null, $args);
    }
111392
public function newInstance(string $class, array $args, BindInterface $bind)
    {
        $compiledClass = $this->compile($class, $bind);
        $instance = (new ReflectionClass($compiledClass))->newInstanceArgs($args);
        $instance->bindings = $bind->getBindings();

        return $instance;
    }
1169253
public static function newInstance($class, ...$args)
    {
        if(!isset(static::$classNameMap[$class]))
        {
            $ref = new \ReflectionClass($class);
            $className = static::getNewClassName($ref->getShortName());
            $tpl = static::getTpl($ref, $className);
            eval($tpl);
            static::$classNameMap[$class] = $className;
        }
        return new static::$classNameMap[$class](...$args);
    }
236657
public function resolveMethod($class, $method, array $args = [])
    {
        if ( ! is_object($class)) {
            throw new Exception('Container::makeMethod except a object as the first parameter!');
        }

        $reflectionMethod = new ReflectionMethod($class, $method);
        $dependencies = $this->getMethodDependencies($reflectionMethod, $args);

        return $reflectionMethod->invokeArgs($class, $dependencies);
    }
624737
public function newInstance(string $class, $args = [], string $selector = Injector::DEFAULT_SELECTOR)
    {
        if (!class_exists($class))
            throw new DIException("Class $class does not exist");

        if (isset($this->factories[$class]))
            return $this->factories[$class]->produce($class, $args, $selector, $this);

        return $this->default_factory->produce($class, $args, $selector, $this);
    }
1083177
public function path($routes, $class = null)
    {
        $routes = (array) $routes;

        if ($this->isPath($routes)) {
            return $this->getActiveClass($class);
        }
    }
672676
protected function bindToClass($url, $class)
    {
        $array  = explode('|', $url, 2);
        $action = !empty($array[0]) ? $array[0] : $this->router->config('default_action');
        $param  = [];

        if (!empty($array[1])) {
            $this->parseUrlParams($array[1], $param);
        }

        return new CallbackDispatch($this, [$class, $action], $param);
    }
614602
private function load($class)
    {
        if ($this->isLoaded($class)) {
            throw new \InvalidArgumentException(sprintf(
                "Error loading class '%s', the class already exists",
                $class
            ));
        }

        if ($file = $this->findFile($class)) {
            return $this->loadFile($file, $class);
        }

        return false;
    }
827158
public function invoke(Callable $callable, array $args = [])
    {
        // object/class method
        if (is_string($callable) && false !== strpos($callable, '::')) {
            $callable = explode('::', $callable);
        }
        if (is_array($callable)) {
            $reflection = new \ReflectionMethod($callable[0], $callable[1]);
        }

        // closures, functions and any other callable
        if (!isset($reflection)) {
            $reflection = new \ReflectionFunction($callable);
        }

        // inject arguments
        $arguments = $this->inject($reflection, $args);
        return $callable(...$arguments);
    }
21263
public function loadClass( $class ) {

		if ( ! isset( $this->class_map[ $class ] ) )
			return FALSE;

		return $this->loader->loadFile( $this->class_map[ $class ] );
	}
745760
public function produce(string $class, array $args, string $selector, Injector $injector)
    {
        return call_user_func($this->function, $args);
    }
19406
protected function createControllerByClass($class, $args = [])
    {
        $controller = $this->getPrototype(
                $class,
                ['umi\hmvc\controller\IController'],
                function (IPrototype $prototype)
                {
                    $prototype->registerConstructorDependency(
                    'umi\hmvc\model\IModel',
                    function ($concreteClassName) {
                        if ($this->modelFactory) {
                            return $this->modelFactory->createByClass($concreteClassName);
                        }

                        return null;
                    }
                );
                }
            )
            ->createInstance($args);

        if ($controller instanceof IModelAware) {
            $controller->setModelFactory($this->modelFactory);
        }

        return $controller;
    }
852503
public function _action(&$class) {
        ob_start();

        $annotation = Annotation::getClass($class);

        $this->_callAnnotation($class, $annotation, 'class', 'Before');

        if (method_exists($class, 'action' . ucfirst($this->request->action))) {
            $this->_callAnnotation($class, $annotation, 'methods', 'Before');
            $action = 'action' . ucfirst($this->request->action);
            $params = Injector::instance()->getArgsMethod($class, $action);

            $reflectionMethod = new \ReflectionMethod($class, $action);
            $output = $reflectionMethod->invokeArgs($class, $params);
            $this->_callAnnotation($class, $annotation, 'methods', 'After');

            $this->addError('Action "' . $this->request->src . '/' . ucfirst($this->request->controller) . '/action' . ucfirst($this->request->action) . '" called successfully', __FILE__, __LINE__, ERROR_INFORMATION);
        }
        else {
            throw new Exception('The requested "' . $this->request->src . '/' . ucfirst($this->request->controller) . '/action' . ucfirst($this->request->action) . '"  doesn\'t exist');
        }

        $this->_callAnnotation($class, $annotation, 'class', 'After');
        $output = ob_get_contents() . $output;
        ob_get_clean();

        return $output;
    }
683049
public function call($class)
    {
        $this->command->getOutput()->writeln("<info>Seeding:</info> $class");

        $seeder = new $class($this->container, $this->command);

        return $seeder->__invoke();
    }
1090945
private function create_with_args( $class, array $args ) {

		switch ( count( $args ) ) {
			case 0:
				return new $class();
			case 1:
				return new $class( reset( $args ) );
			case 2:
				return new $class( reset( $args ), end( $args ) );
		}

		return ( new \ReflectionClass( $class ) )->newInstanceArgs( $args );
	}
547292
public static function callStatic($class, $method, $args = null)
    {
        $args   = \func_get_args();
        $class  = \array_shift($args);
        $method = \array_shift($args);

        $refl = new \ReflectionClass($class);
        $reflMethod = $refl->getMethod($method);
        $reflMethod->setAccessible(true);

        return $reflMethod->invokeArgs(null, $args);
    }