Get Yawik Application to use
@return Application|\Zend\Mvc\Application
328652
public function getApplication()
    {
        if (!is_object($this->application)) {
            $this->application = Application::init();
        }
        return $this->application;
    }
1241682
public function getMenu()
    {
        if ($this->_menu === null) {
            $menu = Yii::$app->get('menu', false);
            if ($menu) {
                $this->_menu = $menu;
            } else {
                $this->_menu = false;
            }
        }

        return $this->_menu;
    }
514275
static public function web()
	{
	    $key = 'app.web';
	    if (!static::has($key)) {
	        if ( !($app = static::app()) || $app->isCli()) {
	            static::setShared($key, new \Wslim\Web\App(Config::getWebAppPath()));
	        } else {
	            static::setShared($key, $app);
	        }
	    }
	    
	    return static::get($key);
	}
554651
private function getConfigObject()
    {
        if (!isset($this->config)) {
            $config = [];
            $file = $this->appRoot . '/' . $this->cliConfig->get('service.app_config_file');
            if (file_exists($file)) {
                $config = (array) (new YamlParser())->parseFile($file);
            }
            $this->config = new AppConfig($config);
        }

        return $this->config;
    }
2677
public function get()
    {
        $schemeCollection = new SchemeCollection();
        $pageAdapter = new AppAdapter($this->injector, $this->appName, 'Resource\Page', $this->resourceDir . '/Page');
        $appAdapter = new AppAdapter($this->injector, $this->appName, 'Resource\App', $this->resourceDir . '/App');
        $schemeCollection->scheme('page')->host('self')->toAdapter($pageAdapter);
        $schemeCollection->scheme('app')->host('self')->toAdapter($appAdapter);
        $schemeCollection->scheme('http')->host('*')->toAdapter(new Http());

        return $schemeCollection;
    }
860664
public function getApp(): App
    {
        if (!is_null($this->getTemplateEngine()->getApp())) {
            return $this->getTemplateEngine()->getApp();
        } else {
            throw new RuntimeException('Template engine is not initialized with application');
        }
    }
583950
public function controller()
	{
		if(!$this->hasController()) {
			throw new InvalidControllerException('Could get controller of ' . get_class($this) . '. Please fill $controller property.');
		}

		return app()->make($this->controller);
	}
521279
public function getApplication()
    {
        //load drupals autoload.php, so their classes are available
        if (file_exists('./vendor/autoload.php')) {
            $autoloader = require './vendor/autoload.php';
        } else {
            $autoloader = require '../vendor/autoload.php';
        }

        $sitePath = 'sites/default';

        Settings::initialize('./', $sitePath, $autoloader);

        $app = new DrupalKernel($this->appenv, $autoloader);
        $app->setSitePath($sitePath);

        return $app;
    }
667241
public function getMenu()
    {
        if ($this->_menu === null) {
            $this->_menu = Yii::$app->get('menu');
        }

        return $this->_menu;
    }
221616
public function getApplication()
    {
        // include applications autoload
        $appAutoLoader = './app/autoload.php';
        if (file_exists($appAutoLoader)) {
            require $appAutoLoader;
        } else {
            require $this->getVendorDir().'/autoload.php';
        }

        // environment loading as of Symfony 3.3
        if (!getenv('APP_ENV') && class_exists('Symfony\Component\Dotenv\Dotenv') && file_exists(realpath('.env'))) {
            (new \Symfony\Component\Dotenv\Dotenv())->load(realpath('.env'));
        }

        $namespace = getenv('APP_KERNEL_NAMESPACE') ?: '\App\\';
        $fqcn      = $namespace . (getenv('APP_KERNEL_CLASS_NAME') ?: 'Kernel');
        $class     = class_exists($fqcn) ? $fqcn : '\AppKernel';

        if (!class_exists($class)) {
            throw new \Exception("Symfony Kernel class was not found in the configured locations. Given: '$class'");
        }

        //since we need to change some services, we need to manually change some services
        $app = new $class($this->appenv, $this->debug);

        // We need to change some services, before the boot, because they would
        // otherwise be instantiated and passed to other classes which makes it
        // impossible to replace them.

        Utils::bindAndCall(function () use ($app) {
            // init bundles
            $app->initializeBundles();

            // init container
            $app->initializeContainer();
        }, $app);

        Utils::bindAndCall(function () use ($app) {
            foreach ($app->getBundles() as $bundle) {
                $bundle->setContainer($app->container);
                $bundle->boot();
            }

            $app->booted = true;
        }, $app);

        if ($this->debug) {
            Utils::bindAndCall(function () use ($app) {
                $container = $app->container;

                $containerClassName = substr(strrchr(get_class($app->container), "\\"), 1);
                $metaName = $containerClassName . '.php.meta';

                Utils::bindAndCall(function () use ($container) {
                    $container->publicContainerDir = $container->containerDir;
                }, $container);

                if ($container->publicContainerDir === null) {
                    return;
                }

                $metaContent = @file_get_contents($app->container->publicContainerDir . '/../' . $metaName);

                // Cannot read the Metadata, returning
                if ($metaContent === false) {
                    return;
                }

                $containerMetadata = unserialize($metaContent);

                foreach ($containerMetadata as $entry) {
                    if ($entry instanceof FileResource) {
                        register_file($entry->__toString());
                    }
                }
            }, $app);
        }

        if ($trustedProxies = getenv('TRUSTED_PROXIES')) {
            Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
        }

        if ($trustedHosts = getenv('TRUSTED_HOSTS')) {
            Request::setTrustedHosts(explode(',', $trustedHosts));
        }

        return $app;
    }
1204590
public function getImportCurrentDataApplication(){

		$app_config = $this->getAppConfigYaml();

		foreach ($app_config[$this->getApplicationName()] as $key => $value) {
            if(isset($value['address_uri'])){
				$addresUri = explode('/', $value['address_uri']);
                if(!empty($addresUri[0]) && strpos($_SERVER['HTTP_HOST'] , $addresUri[0]) !== false ){
                	$this->setEnvironmentStatus($key);

                    if($this->getEnvironmentStatus()=='production' || $this->getEnvironmentStatus()=='staging'){
                    	$dir_path = 'prod';
                    }else if($this->getEnvironmentStatus()=='testing' || $this->getEnvironmentStatus()=='development'){
                    	$dir_path = 'dev';
                    	if(file_exists(PATH_ROOT.'/app/dev/') && file_exists(PATH_ROOT.'/app/prod/')){
                    		unlink(file_exists(PATH_ROOT.'/app/dev/'));
                    	}
                    }

                	if(!file_exists(PATH_ROOT.'/app/'.$dir_path)){
                		if($this->getEnvironmentStatus()!='development' && $this->getEnvironmentStatus()!='testing' && file_exists(PATH_ROOT.'/app/dev/')){
                			rename(PATH_ROOT.'/app/dev/', PATH_ROOT.'/app/'.$dir_path );
                		}else if($this->getEnvironmentStatus()!='production' && $this->getEnvironmentStatus()!='staging' && file_exists(PATH_ROOT.'/app/prod/')){
                			rename(PATH_ROOT.'/app/prod/', PATH_ROOT.'/app/'.$dir_path );
                		}
                	}
                    $this->setApplicationPath('/app/'.$dir_path.'/'.$this->getApplicationName());
                    break;
                }
            }

		}


		//Get address_uri of file app_config.yml
		if($this->getEnvironmentStatus()=='production'){
			if(isset($app_config[$this->getNameApplication()]['production'])){
				$c=$app_config[$this->getNameApplication()]['production'];
				$this->setAddressUri($c['address_uri']);
				$this->setUseHttps($c['use_https']);
				$this->setUseWww($c['use_www']);
			}
		}else if($this->getEnvironmentStatus()=='staging'){
			if(isset($app_config[$this->getNameApplication()]['staging'])){
				$c=$app_config[$this->getNameApplication()]['staging'];
				$this->setAddressUri($c['address_uri']);
				$this->setUseHttps($c['use_https']);
				$this->setUseWww($c['use_www']);
			}
		}else if($this->getEnvironmentStatus()=='testing'){
			if(isset($app_config[$this->getNameApplication()]['testing'])){
				$c=$app_config[$this->getNameApplication()]['testing'];
				$this->setAddressUri($c['address_uri']);
				$this->setUseHttps($c['use_https']);
				$this->setUseWww($c['use_www']);
			}
		}else if($this->getEnvironmentStatus()=='development'){
			if(isset($app_config[$this->getNameApplication()]['development'])){
				$c=$app_config[$this->getNameApplication()]['development'];
				$this->setAddressUri($c['address_uri']);
				$this->setUseHttps($c['use_https']);
				$this->setUseWww($c['use_www']);
			}
		}


		//Get address_uri of file app_config.yml
		if($this->getEnvironmentStatus()=='production'){
			if(isset($app_config['address_uri_production'])){
				$this->setAddressUri($app_config['address_uri_production']);
			}
		}else if($this->getEnvironmentStatus()=='staging'){
			if(isset($app_config['address_uri_staging'])){
				$this->setAddressUri($app_config['address_uri_staging']);
			}
		}else if($this->getEnvironmentStatus()=='testing'){
			if(isset($app_config['address_uri_testing'])){
				$this->setAddressUri($app_config['address_uri_testing']);
			}
		}else if($this->getEnvironmentStatus()=='development'){
			if(isset($app_config['address_uri_development'])){
				$this->setAddressUri($app_config['address_uri_development']);
			}
		}

		if($this->getAddressUri()==''){
			throw new \Exception("Você deve definir uma url em address_uri_".$this->getEnvironmentStatus().' no arquivo de configuração do app_config.yml');
		}

		$this->setConnectionDb($app_config);

	}
439206
protected function getApiKeyMiddleware()
    {
        $handleRequest = function (RequestInterface $request) {
            return $request->withUri(Uri::withQueryValue(
                $request->getUri(),
                static::PARAM_API_KEY,
                $this->apiKey
            ));
        };

        return Middleware::mapRequest($handleRequest);
    }
651054
public function getApplication()
    {
        if (!$this->app) {
            $this->app = $this->getPackage()->app ?: $this->container->get('application');
        }

        return $this->app;
    }
842861
public function getWidgetModel()
    {
        //próba pobrania modelu widgetu z cache
        if (null === $widgetModel = \App\Registry::$cache->load($cacheKey = 'category-widget-model-' . $this->id)) {
            //pobieranie modelu widgetu
            \App\Registry::$cache->save($widgetModel = new \Cms\Model\CategoryWidgetModel($this->id), $cacheKey, 0);
        }
        //zwrot atrybutów
        return $widgetModel;
    }
939177
public function getUserAgent(): string
    {
        $userAgent = 'Swoft/' . App::version();
        $userAgent .= ' Swoft/' . SWOOLE_VERSION;
        $userAgent .= ' PHP/' . PHP_VERSION;
        return $userAgent;
    }
621854
public function getApplication(): ?Application
    {
        if ($this instanceof Application) {
            return $this;
        }

        if ($p = $this->parent) {
            return $p->getApplication();
        }

        return null;
    }
1022862
protected function getUserAgent()
    {
        return sprintf(
            '%s/%s (%s; %s; PHP %s)',
            str_replace(' ', '-', $this->config->get('application.name')),
            $this->config->getVersion(),
            php_uname('s'),
            php_uname('r'),
            PHP_VERSION
        );
    }