Saves the parameters in cache system if defined.

@param string $basedir The base directory

@return boolean Returns TRUE if a valid cache has been saved, FALSE otherwise
486058
private function saveToCache($basedir)
    {
        if (true === $this->debug) {
            return false;
        }

        if (null !== $this->cache) {
            return $this->cache->save($this->getCacheId($basedir), serialize($this->raw_parameters), null, null, true);
        }

        return false;
    }
1350599
private function recurseThroughDirectory($baseDir, $lookingFor = "/(.*)\.php$/i")
    {
        $results = array();
        $di = new RecursiveDirectoryIterator($baseDir);

        $this->output->writeLn("Scanning $baseDir...");

        foreach (new RecursiveIteratorIterator($di) as $filename => $file) {
            if (preg_match($lookingFor, $filename)) {
                $results[] = $this->extractFrom($filename);
            }
        }

        return $results;
    }
549228
private function getYmlFiles($basedir)
    {
        $ymlFiles = File::getFilesByExtension($basedir, self::EXTENSION);

        $defaultFile = $basedir.DIRECTORY_SEPARATOR.self::CONFIG_FILE.'.'.self::EXTENSION;

        if (is_file($defaultFile) && 1 < count($ymlFiles)) {
            // Ensure that config.yml is the first one
            $ymlFiles = array_diff($ymlFiles, array($defaultFile));
            array_unshift($ymlFiles, $defaultFile);
        }

        foreach ($ymlFiles as &$file) {
            $name = basename($file);
            if (in_array(substr($name, 0, strrpos($name, '.')), $this->yml_names_to_ignore)) {
                $file = null;
            }
        }

        return array_filter($ymlFiles);
    }
85739
public function buildClasses($basedir, OutputInterface $output)
    {
        $target = $this->ensureBuildDir($basedir, $output);

        foreach ($this->getClasses() as $element) {
            $element->build($target, $output);
        }
    }
1256473
static function recursiveFindRelative( $baseDir, $subDir, $suffix )
    {
        $dir = $baseDir;
        if ( $subDir != "" )
        {
            if ( $dir != '' )
                $dir .= "/" . $subDir;
            else
                $dir .= $subDir;
        }

        if ( !is_dir( $dir ) )
        {
            return array();
        }

        $returnFiles = array();
        if ( $handle = @opendir( $dir ) )
        {
            while ( ( $file = readdir( $handle ) ) !== false )
            {
                if ( ( $file == "." ) || ( $file == ".." ) )
                {
                    continue;
                }
                if ( is_dir( $dir . '/' . $file ) )
                {
                    if ( $file[0] != "." )
                    {
                        $files = eZDir::recursiveFindRelative( $baseDir, $subDir . '/' . $file, $suffix );
                        $returnFiles = array_merge( $files, $returnFiles );
                    }
                }
                else
                {
                    if ( preg_match( "/$suffix$/", $file ) )
                        $returnFiles[] = $subDir . '/' . $file;
                }
            }
            @closedir( $handle );
        }
        return $returnFiles;
    }
1152803
public function findClassFile($class,$baseDir = null)
    {
        $baseDir = is_null($baseDir) ? getcwd():$baseDir;

        $file = $this->mainLoader->findFile($class);
        if (is_file($file)) {
            $spl = PathUtil::createSplFileInfo($baseDir,$file);

            return $spl;
        }

        return false;
    }
867117
public static boolean isProcessRunning(String baseDir)
    {
        File pidFile = new File(baseDir, "pid");
        boolean exists = pidFile.isFile();
        return exists;
    }
814553
public function getImages($dir, $basedir)
    {
        $files = array();
        $dir = $basedir . $dir;
        if ($handler = opendir($dir)) {
            while ($file = readdir($handler)) {
                $path = realpath("{$dir}/{$file}");
                if (is_file($path)) {
                    if (preg_match('/^[a-zA-z0-9=&,]+\.(gif|png|jpg|jpeg)$/', $file)) {
                        array_push($files, array(str_replace(array($basedir, '\\'), array('', '/'), $path),filesize($path)));
                    }
                }
            }
            closedir($handler);
        }
        
        return $files;
    }
1038080
private function checkBaseDir($reader, array $base)
    {
        if (!isset($base[$reader]) || !is_dir(dirname(app_path()) . '/' . $base[$reader])) {
            throw new \RuntimeException('Either a basedir is not set or basedir is not a directory');
        }
    }
211115
private function registerModelsAndTwigLayoutNamespaces ($baseDir)
    {
        $elementTypesModel = new ElementTypesModel($baseDir);

        // model
        $this["model.element_types"] = $elementTypesModel;
        $this["model.download"]      = new DownloadModel($baseDir);

        // twig template namespaces
        foreach ($elementTypesModel->getAllElementTypes() as $elementType)
        {
            $this["twig.loader.filesystem"]->addPath($elementTypesModel->getUserSubDirectory("{$elementType}s"), $elementType);
        }


        $this["twig.loader.filesystem"]->addPath($elementTypesModel->getUserSubDirectory("_base"), "base");
    }
273788
private function buildConfigDefinition($baseDir)
    {
        $definition = new Definition('BackBee\Config\Config', array(
            $this->getConfigDirByBundleBaseDir($baseDir),
            new Reference('cache.bootstrap'),
            null,
            '%debug%',
            '%config.yml_files_to_ignore%',
        ));

        if (true === $this->application->getContainer()->getParameter('container.autogenerate')) {
            $definition->addTag('dumpable', array('dispatch_event' => false));
        }

        $definition->addMethodCall('setContainer', array(new Reference('service_container')));
        $definition->addMethodCall('setEnvironment', array('%bbapp.environment%'));
        $definition->setConfigurator(array(new Reference('config.configurator'), 'configureBundleConfig'));
        $definition->addTag('bundle.config', array('dispatch_event' => false));

        return $definition;
    }
314568
public function isCached( Base $entity, $source = self::PERSISTED )
    {
        switch( $source ) {
            case self::PERSISTED:
                return false !== array_search( $entity, $this->instancesPersisted, true );
            case self::UNPERSISTED:
                return false !== array_search( $entity, $this->instancesUnpersisted, true );
            case self::ALL:
                return $this->isCached( $entity, self::PERSISTED ) || $this->isCached( $entity, self::UNPERSISTED );
        }
        throw new \InvalidArgumentException("Bad source `{$source}` passed to " . __FUNCTION__);
    }
8243
private function scanModuleFolders($basedir, &$folders)
    {
        if (is_dir($basedir) && ($h = opendir($basedir))) {
            while (($folder = readdir($h))) {
                if ($folder !== '.' && $folder !== '..') {
                    $this->scanModuleFiles($basedir . DIRECTORY_SEPARATOR . $folder, $folders);
                }
            }
            closedir($h);
        }
    }
169462
public function save() : bool
    {
        if (!$this->isTableNameSet()) {
            return false;
        }
        $pkName = $this->primaryKey;
        if ((int) $this->$pkName > 0) {
            $this->updateEntry();
        } else {
            $this->createEntry();
        }
        return true;
    }
777648
protected function getDirectoryScanner(PhingFile $baseDir)
    {
        $this->fileset->setDir($baseDir);
        $this->fileset->setDefaultexcludes($this->useDefaultExcludes);

        return $this->fileset->getDirectoryScanner($this->project);
    }
845815
protected static function initCache()
    {
        // Build namespace for cache
        $namespace = self::$registry->getParameter('doozr.namespace.flat').'.cache';
        $container = self::$registry->getParameter('doozr.kernel.caching.container');
        $unix      = self::$registry->getParameter('doozr.unix');
        $caching   = self::$registry->getParameter('doozr.kernel.caching');

        // Store cache ...
        self::$registry->setCache(
            Doozr_Loader_Serviceloader::load(
                'cache',
                $container,
                $namespace,
                [],
                $unix,
                $caching
            )
        );

        // Important for bootstrap result
        return true;
    }
1090833
public function setBasePath(string $basePath): bool
    {
        $basePath = App::getAlias($basePath);
        return SeasLog::setBasePath($basePath);
    }