create app instance and run it
@param array|string $config if string it is basePath
@param boolean      $run    if run

@return static
691
static public function launch($config, $run = true)
	{
		if (is_string($config)) {
		    $config = ['basePath' => $config];
		}
		
		$app = new static($config);
		
		if ($run) {
		    return $app->run();
		}
		
		return $app;
	}
954696
public function create($config){

        $creator = $this->getCreator($config);

        return $this->callCreator($creator, $config);

    }
242481
public static function create($config, string $instanceOf = null): BaseObject
    {
        // Get class from config
        $class = static::checkConfig($config, $instanceOf);

        // New object
        $object = new $class();

        // Populate
        if ($config) {
            static::populate($object, $config);
        }

        return $object;
    }
444420
public function make($config = null)
    {
        try {
            return $this->_invokeCallable($this->_getFactoryCallback($config), [$config]);
        } catch (InvocationExceptionInterface $invocationException) {
            throw $this->_createCouldNotMakeException(
                $this->__('Could not make subject instance'),
                null,
                $invocationException,
                $this,
                $config
            );
        } catch (RootException $exception) {
            throw $this->_createFactoryException(
                $this->__('An error occurred while trying to make the subject instance'),
                null,
                $exception,
                $this
            );
        }
    }
634199
public static function write(string $fileName = '', $config = null): bool
    {
        $pathInfo = \pathinfo(static::normalizePath($fileName));
        if (!isset($pathInfo['extension'])) {
            $message = \sprintf(
                'Config file name "%s" is missing an extension and cannot be auto-detected',
                $pathInfo['filename']
            );

            throw new RuntimeException($message);
        }

        $extension = \strtolower($pathInfo['extension']);
        if (!\in_array($extension, static::$allowedExtensions)) {
            $message = \sprintf(
                'Unsupported config file type. Supported extension types are: %s',
                \implode(',', static::$allowedExtensions)
            );

            throw new RuntimeException($message);
        }

        if (!isset(static::$writers[$extension]) || !(static::$writers[$extension] instanceof AbstractWriter)) {
            static::$writers[$extension] = WriterManager::get($extension);
        }

        return static::$writers[$extension]->toFile($fileName, $config);
    }
619791
static public function factory($config = array()) {
        if (is_string($config)) {
            // Assume $config is a filename
            $filename = $config;
            $config = array(
                'timestampFormat' => 'Y-m-d',
                array(
                    'writerName' => 'Stream',
                    'writerParams' => array(
                        'stream' => self::_getLoggingDirectory() . DIRECTORY_SEPARATOR . $filename
                    )
                )
            );
        }
        return parent::factory($config);
    }
298201
public function initialize(array $config = [])
    {
        if (empty($this->engine)) {
            if ($this->isSupported()) {
                $this->engine = new \Mustache_Engine();
            } else {
                throw new RuntimeException(
                    'PARSER_E_THIRD_PARTY',
                    0,
                    ['Mustache Template Engine by Justin Hileman', 'https://github.com/bobthecow']
                );
            }
        }

        return $this;
    }
198968
public function createService($config)
    {
        $this->fileService->mkdir($config['_path_service_'], 0777, true);

        $service = $this->fileService->get($config['template_source'].'/Service.txt');

        if ($config['options-withBaseService'] ?? false) {
            $baseService = $this->fileService->get($config['template_source'].'/BaseService.txt');
            $service = $this->fileService->get($config['template_source'].'/ExtendedService.txt');
        }

        foreach ($config as $key => $value) {
            $service = str_replace($key, $value, $service);
            if ($config['options-withBaseService'] ?? false) {
                $baseService = str_replace($key, $value, $baseService);
            }
        }

        $service = $this->putIfNotExists($config['_path_service_'].'/'.$config['_camel_case_'].'Service.php', $service);

        if ($config['options-withBaseService'] ?? false) {
            $this->putIfNotExists($config['_path_service_'].'/BaseService.php', $baseService);
        }

        return $service;
    }
540100
public static function create(array $config)
    {
        if (!empty($config['url'])) {
            $config['app_id'] = substr(parse_url($config['url'], PHP_URL_PATH), 6);
            $config['key'] = parse_url($config['url'], PHP_URL_USER);
            $config['secret'] = parse_url($config['url'], PHP_URL_PASS);
            $config['scheme'] = parse_url($config['url'], PHP_URL_SCHEME);
            $config['host'] = parse_url($config['url'], PHP_URL_HOST);
            $config['port'] = parse_url($config['url'], PHP_URL_PORT) ?: $config['port'];
        }

        // For backwards compatibility with deprecated host argument
        if (preg_match('(^(https?://))', $config['host'], $matches)) {
            $config['scheme'] = substr($matches[0], 0, -3);
            $config['host'] = substr($config['host'], strlen($matches[0]));
        }

        return new Pusher(
            $config['key'],
            $config['secret'],
            $config['app_id'],
            [
                'scheme' => $config['scheme'],
                'host' => $config['host'],
                'port' => $config['port'],
                'timeout' => $config['timeout'],
                'cluster' => $config['cluster'],
                'debug' => $config['debug'],
            ]
        );
    }
31801
public function load(array $files, Config $config = null)
    {
        if (is_null($config)) {
            $config = new Config();
        }

        if (!$this->isValidFileList($files)) {
            throw new \RuntimeException('Invalid config file list given. At least one config file must exist.');
        }

        foreach ($files as $file) {
            if ($this->isFileExisting($file)) {
                $config->merge(
                    $this->loadFile($file)
                );
            }
        }

        return $config;
    }
358476
public static function instance($config = [])
    {
        if (null === self::$instance) {
            self::$instance = new static($config);
        }

        return self::$instance;
    }
692169
public static function createFromArray(array $config)
    {
        $self = new self();

        if (!empty($config['base_url'])) {
            $self->setBaseUrl($config['base_url']);
        }

        if (!empty($config['auth_path'])) {
            $self->setAuthPath($config['auth_path']);
        }

        if (!empty($config['api_path'])) {
            $self->setApiPath($config['api_path']);
        }

        if (!empty($config['debug'])) {
            $self->setDebug($config['debug']);
        }

        if (!empty($config['auth'])) {
            $self->setAuth($config['auth']);
        }

        return $self;
    }
312492
public function createRouter(App $app, array $config = []): Router
    {
        $routes = $this->mergeRoutes($app, $this->buildRoutes($config));
        
        return new PathRouter(...$this->generateRouterData($routes));
    }
892748
public static function instance(array $config = array())
    {
        if (!(self::$instance instanceof Phery)) {
            self::$instance = new Phery($config);
        } else if ($config) {
            self::$instance->config($config);
        }

        return self::$instance;
    }
936244
public function initialize(array $config = [])
    {
        $config = array_merge($this->config, $config);

        if (empty($this->engine)) {
            if ($this->isSupported()) {
                $this->engine = new \O2System\Parser\Template\Engines\Blade($config);
            } else {
                throw new RuntimeException('PARSER_E_THIRD_PARTY', 0, ['\O2System\Parser\Engines\Blade']);
            }
        }

        return $this;
    }
449673
public static function getInstance($config = array())
    {
        static $instance;

        if ($instance === null) {
            if (!$config instanceof AnConfig) {
                $config = new AnConfig($config);
            }

            $instance = new self($config);
        }

        return $instance;
    }
1239685
public function createFacade($config)
    {
        $this->fileService->mkdir($config['_path_facade_'], 0777, true);

        $facade = $this->fileService->get($config['template_source'].'/Facade.txt');

        foreach ($config as $key => $value) {
            $facade = str_replace($key, $value, $facade);
        }

        $facade = $this->putIfNotExists($config['_path_facade_'].'/'.$config['_camel_case_'].'.php', $facade);

        return $facade;
    }