Retrieves the solution directory list. It caches the result if not already
done so that it retrieves it faster the next occurrences.

@param \Puzzlout\Framework\Core\Application $app The current application instance.
@return array(of String)
163984
public function GetSolutionDirectoryList(\Puzzlout\Framework\Core\Application $app) {
        $Cacher = \Puzzlout\Framework\Core\Cache\BaseCache::Init($app->config);
        //$Cacher->Remove(CacheKeys::SOLUTION_FOLDERS);
        if (!$Cacher->KeyExists(CacheKeys::SOLUTION_FOLDERS)) {
            $SolutionPathListArray = ArrayFilterDirectorySearch::Init($app)->RecursiveScanOf(
                    "APP_ROOT_DIR", \Puzzlout\Framework\Core\DirectoryManager\Algorithms\ArrayListAlgorithm::ExcludeList());
            $Cacher->Create(CacheKeys::SOLUTION_FOLDERS, $SolutionPathListArray);
        } else {
            $SolutionPathListArray = $Cacher->Read(CacheKeys::SOLUTION_FOLDERS, array());
        }
        return $SolutionPathListArray;
    }
1219599
public function connect(Application $app)
    {
        /**
         * @var ControllerCollection $collection
         */
        $collection = $app['controllers_factory'];
        $collection
            ->match('/', Controller::INDEX . ':indexAction')
            ->method('GET')
            ->value('template', 'pages/landing');
        $collection
            ->match('/account/login', Controller::INDEX . ':indexAction')
            ->method('POST')
            ->value('template', 'pages/landing');
        $collection
            ->match('/account/create', Controller::ACCOUNT . ':indexAction')
            ->method('POST|GET')
            ->value('template', 'pages/registration');
        $collection
            ->match('/game', Controller::INDEX . ':indexAction')
            ->method('GET')
            ->value('template', 'pages/landing');
        $collection
            ->match('/cities',Controller::CITY.':listAction')
            ->method('GET')
            ->value('template','pages/game/cityList');
        $collection
            ->match('/city/create',Controller::CITY.':createAction')
            ->method('GET')
            ->value('template','pages/game/newcity');


        return $collection;
    }
1147692
protected function getPdo(Application $app, $prefix)
    {
        return $app->share(function () use ($app, $prefix) {
            $factory = new PdoConfigFactory();

            $app[$prefix.'.server']  = array_merge(
                array(
                    'driver' => 'sqlite',
                ),
                isset($app[$prefix.'.server']) ? (array) $app[$prefix.'.server'] : array()
            );

            $params = array_merge(
                $app[$prefix.'.server'],
                array(
                    'options' => isset($app[$prefix.'.options']) ? (array) $app[$prefix.'.options'] : array(),
                ),
                array(
                    'attributes' => isset($app[$prefix.'.attributes']) ? (array) $app[$prefix.'.attributes'] : array(),
                )
            );

            $cfg = $factory->createConfig($params['driver']);

            return $cfg->connect($params);
        });
    }
904574
public function bootstrap(Application $app)
    {
        $items = [];
        // First we will see if we have a cache configuration file. If we do, we'll load
        // the configuration items from that file so that it is very quick. Otherwise
        // we will need to spin through every configuration file and load them all.
//        if (file_exists($cached = $app->getCachedConfigPath())) {
//            $items = require $cached;
//            $loadedFromCache = true;
//        }

        // Next we will spin through all of the configuration files in the configuration
        // directory and load each one into the repository. This will make all of the
        // options available to the developer for use in various parts of this app.
        $app->share('config', $config = new Config($items, true));

//        if (!isset($loadedFromCache)) {
        $this->loadConfigurationFiles($app, $config);
//        }
        // Finally, we will set the application's environment based on the configuration
        // values that were loaded. We will pass a callback which will be used to get
        // the environment in a web context where an "--env" switch is not present.
//        $app->detectEnvironment(function () use ($config) {
//            return $config->get('app.env', 'production');
//        });
        date_default_timezone_set($config->get('app.timezone', 'UTC'));
        mb_internal_encoding('UTF-8');
    }
199903
protected function getConfigurationFiles(ApplicationContract $app): array
    {
        $files = [];

        $configPath = $app->configPath();

        $configFiles = Finder::create()
            ->files()
            ->name('*.php')
            ->in($configPath);

        foreach ($configFiles as $file) {
            $directory = $this->getNestedDirectory($file, $configPath);
            $files[$directory.basename($file->getPathname(), '.php')] = $file->getPathname();
        }

        ksort($files, SORT_NATURAL);

        return $files;
    }
462043
public static function ReadAll($app = 'phpgw')
    {
        $Categories = new Api\Categories(0, $app);

        return $Categories->return_array('all', 0, true, '', 'ASC', '', true, null, -1, '', null);
    }
1221808
public function getClosure($app)
    {    
        // Confirm the matched property is a key in the routes array
        if (!isset($this->routes[$this->matched]))
            return false;
        
        $callback = $this->routes[$this->matched];
        
        // Is the callback a string? If so, it should be the name of a resource 
        // class, which will be used to build the logic inside a closure.
        if (is_string($callback)) {
            $className = 'Resources\\' . $callback;
            if (class_exists($className)) {
                // Success, so lets build a closure for executing the 
                // requested resource's output
                $callback = function() use ($app, $className, $callback) {
                    // Does this resource have a IoC alias registered?
                    if (!$resource = $app->get($callback))
                        $resource = new $className(
                            $app->get('request'), 
                            $app->get('response')
                        );
                    
                    $resource->output();
                };

            } else {
                // Oops, bad class name given to the router
                return false;
            }
        }
        
        // $callback should now be a closure - either because that's what the 
        // router was given originally, or because one was built from the 
        // string it was given.
        if (is_callable($callback)) {
            return $callback;
        } else {
            // The callback wasn't callable (that's not good).
            return false;
        }
    }
454529
public function getContent(AppInterface $app)
    {
        $imports = [];

        $stringedOperations = [];

        foreach ($this->migration->getOperations() as $op) {
            list($opString, $importString) = FormatFileContent::formatObject($op);

            array_push($stringedOperations, $opString);

            $imports = array_merge($imports, $importString);
        }

        $imports = array_unique($imports);

        $importPaths = '';

        foreach ($imports as $import) {
            $import = sprintf('use %s;', $import);
            $importPaths .= $import.PHP_EOL;
        }

        $opContent = '['.PHP_EOL;
        foreach ($stringedOperations as $op) {
            $opContent .= sprintf("\t\t\t%s,".PHP_EOL, $op);
        }
        $opContent .= "\t\t]";

        $dependencies = $this->migration->getDependency();

        $namespace = $this->migration->getNamespace($app);

        return sprintf(
            $this->getFileTemplate(),
            $namespace,
            $importPaths,
            $this->migration->getName(),
            "\n".rtrim(
                Tools::stringify(
                    $dependencies,
                    3,
                    0,
                    true,
                    false
                ),
                PHP_EOL
            ),
            $opContent
        );
    }
496808
public static function console($app)
  {
    if (Filesystem::isDirectory(Self::$dir . DIRECTORY_SEPARATOR . 'Commands')) {
      $app->craftsman->load(Self::$dir . DIRECTORY_SEPARATOR . 'Commands');
    }
  }
1208131
protected function getConfigurationFiles(Container $app)
    {
        $files = [];
        $configPath = realpath($app['path.config']);

        /** @var \Symfony\Component\Finder\SplFileInfo $file */
        foreach (Finder::create()->files()->name('*.php')->in($configPath) as $file) {
            $nesting = $this->getConfigurationNesting($file, $configPath);
            $files[$nesting . basename($file->getRealPath(), '.php')] = $file->getRealPath();
        }

        return $files;
    }
604758
public function all($app = NULL) : Bool
    {
        if( ! is_string($app) )
        {
            if( $app === NULL )
            {
                $MLFiles = Filesystem::getFiles($this->appdir, 'ml');
            }
            elseif( is_array($app) )
            {
                $MLFiles = $app;
            }
            else
            {
                return false;
            }

            $allMLFiles = [];

            if( ! empty($MLFiles) ) foreach( $MLFiles as $file )
            {
                $removeExtension = str_replace($this->extension, '', $file);
                $this->all($removeExtension);
            }

            return true;
        }
        else
        {
            $createFile = $this->_langFile($app);
      
            if( is_file($createFile) )
            {
                return unlink($createFile);
            }

            return false;
        }
    }
174231
public function dueEvents(Application $app)
    {
        return array_filter($this->events, function ($event) use ($app)
        {
            return $event->isDue($app);
        });
    }
151707
public function extractModules($app)
    {
        if ($this->_modules === null) {
            foreach ($app->getModules() as $id => $obj) {
                // create module object
                $moduleObject = Yii::$app->getModule($id);
                // see if the module is a luya base module, otherwise ignore
                if ($moduleObject instanceof \luya\base\Module) {
                    $this->_modules[$id] = $moduleObject;
                }
            }
            // when no luya modules are registered an empty array will be returned.
            if ($this->_modules === null) {
                $this->_modules = [];
            }
        }
    }
1213411
protected function getConfigurationFiles(Application $app)
	{
		$files = [];

		foreach (Finder::create()->files()->name('*.php')->in($app->configPath()) as $file)
		{
			$nesting = $this->getConfigurationNesting($file);

			$files[$nesting.basename($file->getPathname(), '.php')] = $file->getPathname();
		}

        // Verificar se tem um arquivo de configuracao na pasta do pchar
        $config_root = root_path('config.php');
        if (file_exists($config_root)) {
            $files['config'] = $config_root;
        }

		return $files;
	}
1371030
public static function apps(): array
    {
        self::initialize();
        $apps = [];
        foreach (self::$repositories as $name => $repository) {
            $apps[] = $name;
        }
        return $apps;
    }
1069126
private function resolveAbstractToClassName(Application $app, $abstract)
    {
        $result = null;
        try {
            $instance = $app->make($abstract);
            if (is_object($instance)) {
                $className = get_class($instance);
                if (ltrim($abstract, '\\') !== $className) {
                    $result = $className;
                }
            }
        } catch (Exception $e) {
        } catch (Throwable $e) {
        }

        return $result;
    }
1010551
public static function appPath(?string $app = null): ?string
    {
        self::initialize();
        if ($app === null) {
            $app = '*';
        }
        if (isset(self::$repositories[$app])) {
            return call_user_func([self::$repositories[$app], 'getPath']);
        }
        return null;
    }