Создает контроллер заданного класса.
@param string $class класс контроллера
@param array $args аргументы конструктора
@return IController
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;
    }
740393
public static function getInstance(
        $class = null,
        array $options = []
    ) {
        /** @var Implementation $instance */
        if (is_null(self::$instance)) {
            if (is_null($class)) {
                self::$instance = self::makeInstance(
                    Implementation::class, $options
                )->getApp($options);

                self::$instance->load();
            } else {
                ! is_object($class) || self::$instance = $class;
            }
        }
        return self::$instance;
    }
807117
public function make($class)
    {
        $action = $this->container->make($class);
        $action->setEvents($this->container->make('events'));

        return $action;
    }
551461
public function createObject($class, array $args = [], $shared = false, $protected = false)
    {
        $callback = function (Container $container) use ($class, $args) {
            return $container->newInstance($class, $args);
        };

        return $this->set($class, $callback, $shared, $protected)->get($class);
    }
1240655
protected static function checkInternalClass($instance, $class, array $args = [])
    {
        if (null !== $instance) {
            return;
        }

        $messages = [];
        foreach ($args as $name => $value) {
            $messages[] = sprintf('%s => %s', $name, $value);
        }

        throw new \RuntimeException(sprintf(
            'Unable to create internal class: %s, with params: %s',
            $class,
            implode(', ', $messages)
        ));
    }
313891
private function __setCallback($type, $class, array $args)
    {
        if (!is_array($class)) {
            $this->{$type} = [
                [
                    'class' => $class,
                    'args' => $args
                ]
            ];

            return $this;
        } elseif (is_array($class) && count($class) == 2) {
            $className = $class[0];
            $methodName = $class[1];
        } else {
            if (is_array($class)) {
                $class = implode($class);
            }
            throw new \InvalidArgumentException("{$class} is missformated");
        }

        $this->{$type} = [
            [
                'class' => [$className, $methodName],
                'args' => $args
            ]
        ];

        return $this;
    }
65480
public static function getControllerInstance($class, $namespace = '')
    {
        $that = self::getInstance();

        if (array_key_exists('namespaces', $that->settings)) {
            if (array_key_exists($namespace, $that->settings['namespaces'])) {
                return call_user_func(
                    [
                        $that->settings['namespaces'][$namespace] . $class,
                        'getInstance',
                    ]
                );
            }

            foreach ($that->settings['namespaces'] as $namespace) {
                $instance = $namespace . $class;
                if (class_exists($instance)) {
                    return call_user_func([$instance, 'getInstance']);
                }
            }
        }

        return false;
    }
1120635
protected static function createObject($class, ...$args)
    {
        if (!is_subclass_of($class, Record::class)) {
            throw new \InvalidArgumentException(sprintf('Class: %s is not sub class of ' . Record::class, $class));
        }

        // TODO: Make Record support set DB after construct.
        try {
            return new $class(...$args);
        } catch (\Exception $e) {
            if ($e instanceof \InvalidArgumentException || $e->getPrevious() instanceof \PDOException) {
                return new NullRecord();
            }

            throw $e;
        }
    }
1021199
public function icon($class, $options = array()) {
		$defaults = array();
		$options = array_merge($defaults, $options);

		$iconVendorPrefix = $this->getIconVendor($class);
		if ($iconVendorPrefix) {
			$class = $iconVendorPrefix . ' ' . $class;
		} else {
			$iconVendorPrefix = $this->_config['defaultIconVendorPrefix'];
			if ($iconVendorPrefix) {
				$class = $iconVendorPrefix . ' ' . $iconVendorPrefix . '-' . $class;
			}
		}

		$options['class'] = $class;
		return $this->tag('i', '', $options);
	}
135148
public function get($class, ...$args)
    {
        $poolName = trim($class, '\\');

        if (!$poolName) {
            return null;
        }

        $pool     = $this->map[$poolName] ?? null;
        if ($pool == null) {
            $pool = $this->applyNewPool($poolName);
        }

        if ($pool->count()) {
            $obj = $pool->shift();
            $obj->__isConstruct = false;
            return $obj;
        } else {
            $reflector         = new \ReflectionClass($poolName);
            $obj               = $reflector->newInstanceWithoutConstructor();
            $obj->__useCount   = 0;
            $obj->__genTime    = time();
            $obj->__isConstruct = false;
            $obj->__DSLevel    = Macro::DS_PUBLIC;
            unset($reflector);
            return $obj;
        }
    }
205274
public function loadClass($class)
    {
        if (0 === strpos($class, 'Admingenerated')) {
            $filePath = $this->basePath.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';

            if (!file_exists($filePath)) {
                $this->generateEmptyController($class);
            }

            if (file_exists($filePath)) {
                require $filePath;
            }
        }
    }
1027675
public function __simpleReturned(string $class, array $args = array())
    {
        try {
            $class = new \ReflectionClass($class);
            if (empty($args)) {
                return ($class->newInstanceArgs());
            } else {
                return ($class->newInstanceArgs(array($args)));
            }
        } catch (\Exception $ex) {
            throw new \Exception($ex->getMessage());
        }
    }
719886
public function getControllerInstance($class, $namespace = '')
    {
        if (isset($this->complement['namespaces'])) {
            if (isset($this->complement['namespaces'][$namespace])) {
                $namespace = $this->complement['namespaces'][$namespace];

                $_class = $namespace . $class;

                if (class_exists($_class)) {
                    return call_user_func([$_class, 'getInstance']);
                }

                return false;
            }

            foreach ($this->complement['namespaces'] as $key => $namespace) {
                $instance = $namespace . $class;
                if (class_exists($instance)) {
                    return call_user_func([$instance, 'getInstance']);
                }
            }
        }

        return false;
    }
881408
public static function getInstance($class, array $args, array $conf, string $confHash) {
        $rfClass = new ReflectionClass($class);
        if (!$rfClass->implementsInterface(IComponent::class)) {
            throw new InvalidArgumentException("class $class is not an instance of x2ts\\IComponent");
        }
        if ($rfClass->hasMethod('getInstance')) {
            return $rfClass->getMethod('getInstance')
                ->invoke(null, $args, $conf, $confHash);
        }
        /** @var IComponent $component */
        $component = $rfClass->newInstanceArgs($args);
        $rfClass->getMethod('saveConf')->invoke($component, $conf, $confHash);
        if ($rfClass->hasMethod('init')) {
            $rfClass->getMethod('init')->invoke($component);
        }
        return $component;
    }
405143
public static function menu_icon_for_class($class)
    {
        $icon = Config::inst()->get($class, 'menu_icon');
        if (!empty($icon)) {
            $iconURL = ModuleResourceLoader::resourceURL($icon);
            $class = strtolower(Convert::raw2htmlname(str_replace('\\', '-', $class)));
            return ".icon.icon-16.icon-{$class} { background-image: url('{$iconURL}'); } ";
        }
        return '';
    }
421900
private function loadController($class)
    {
        $controller = new $class($this->currentControllerAliasConfig);
        if (!is_a($controller, '\\mpf\\web\\Controller')) {
            $this->critical('Controller `' . $class . '` must extend \\mpf\\web\\Controller!', array(
                'requestedController' => $this->request()->getController(),
                'requestedModule' => $this->request()->getModule()
            ));
            return null;
        }
        return $controller;
    }
674903
public static function getControllerMethods($class)
    {
        if (!class_exists($class)) {
            throw new TaskManagerException('class ' . $class . ' not found');
        }
        $class_methods = get_class_methods($class);
        if ($parent_class = get_parent_class($class)) {
            $parent_class_methods = get_class_methods($parent_class);
            return array_diff($class_methods, $parent_class_methods);
        }
        return $class_methods;
    }