Restricts the matching to directories only.
public directories ( ) : |
||
Résultat | The current Finder instance |
/** * fire. */ public function fire() { // set_time_limit(30); $path = $this->argument('path'); $name = $this->option('name'); $type = $this->option('type'); $maxDepth = $this->option('maxdepth'); $delete = $this->option('delete'); $root = $this->getLaravel()->basePath(); $path = realpath($root . '/' . $path); $this->finder->in($path); if ($name !== null) { $this->finder->name($name); } switch ($type) { case 'd': $this->finder->directories(); break; case 'f': $this->finder->files(); break; } if ($maxDepth !== null) { if ($maxDepth == '0') { $this->line($path); return; } $this->finder->depth('<' . $maxDepth); } foreach ($this->finder as $file) { $realPath = $file->getRealpath(); if ($delete === 'true' && $filesystem->exists($realPath) === true) { try { if ($filesystem->isDirectory($realPath) === true) { $deleted = $filesystem->deleteDirectory($realPath, true); } else { $deleted = $filesystem->delete($realPath); } } catch (Exception $e) { } if ($deleted === true) { $this->info('removed ' . $realPath); } else { $this->error('removed ' . $realPath . ' fail'); } } else { $this->line($file->getRealpath()); } } }
protected function execute(InputInterface $input, OutputInterface $output) { $this->initBuild($input, $output); $this->zero(); $finder = new Finder(); $finder->directories()->in("{$this->rootDirectory}/vendor2")->depth('== 0'); $map = array(1 => array('composer', 'ezyang', 'gregwar', 'imagine', 'incenteev', 'jdorn'), 2 => array('doctrine'), 3 => array('endroid'), 4 => array('kriswallsmith', 'monolog', 'phpoffice'), 5 => array('pimple', 'psr', 'sensio', 'sensiolabs', 'silex', 'swiftmailer', 'symfony/assetic-bundle', 'symfony/monolog-bundle', 'symfony/swiftmailer-bundle', 'twig', 'symfony/symfony/src/Symfony/Bridge', 'symfony/symfony/src/Symfony/Bundle'), 6 => array('symfony/symfony/src/Symfony/Component/Intl', 'symfony/symfony/src/Symfony/Component/HttpKernel', 'symfony/symfony/src/Symfony/Component/Security', 'symfony/symfony/src/Symfony/Component/Form'), 7 => array('symfony/symfony/src/Symfony/Component')); foreach ($map as $i => $dirs) { $this->filesystem->remove($this->distDirectory); $this->filesystem->mkdir($this->distDirectory); $this->filesystem->mkdir("{$this->distDirectory}/vendor2"); foreach ($dirs as $dir) { $this->filesystem->mirror("{$this->rootDirectory}/vendor2/{$dir}", "{$this->distDirectory}/vendor2/{$dir}"); if ($i == 7) { $this->filesystem->remove("{$this->distDirectory}/vendor2/{$dir}/Intl"); $this->filesystem->remove("{$this->distDirectory}/vendor2/{$dir}/HttpKernel"); $this->filesystem->remove("{$this->distDirectory}/vendor2/{$dir}/Security"); $this->filesystem->remove("{$this->distDirectory}/vendor2/{$dir}/Form"); } } chdir($this->buildDirectory); $command = "zip -r vendor-{$i}.zip edusoho/"; exec($command); } }
public function checkDirAction() { $paths = array('/' => array('depth' => '<1', 'dir' => true), 'app' => array('depth' => '<1', 'dir' => true), 'src' => array(), 'plugins' => array(), 'api' => array(), 'vendor' => array('depth' => '<1', 'dir' => true), 'vendor2' => array('depth' => '<1', 'dir' => true), 'vendor_user' => array('depth' => '<1', 'dir' => true), 'web' => array('depth' => '<1', 'dir' => true)); $errorPaths = array(); if (PHP_OS !== 'WINNT') { foreach ($paths as $folder => $opts) { $finder = new Finder(); if (!empty($opts['depth'])) { $finder->depth($opts['depth']); } if (!empty($opts['dir'])) { $finder->directories(); } try { $finder->in($this->container->getParameter('kernel.root_dir') . '/../' . $folder); foreach ($finder as $fileInfo) { $relaPath = $fileInfo->getRealPath(); if (!(is_writable($relaPath) && is_readable($relaPath))) { $errorPaths[] = $relaPath; } } } catch (\Exception $e) { } } } return $this->render('TopxiaAdminBundle:System:Report/dir-permission.html.twig', array('errorPaths' => $errorPaths)); }
/** * Reloads all bundles by going through all installed bundles and refilling cache file */ public function reloadBundles() { $this->bundles = []; if ($this->coreBundlesLocation !== false) { $normalizedCoreBundles = HasFilesystemRepresentation::normalizePath(Yii::getAlias($this->coreBundlesLocation)); $coreBundles = ['bundle', 'core', 'visual-builder']; foreach ($coreBundles as $bundle) { $this->loadBundle($normalizedCoreBundles . $bundle); } } // load third-party bundles $finder = new Finder(); try { $finder->directories()->in(HasFilesystemRepresentation::normalizePath(Yii::getAlias($this->bundlesLocation)) . $this->bundleLocationLookup)->ignoreUnreadableDirs()->followLinks()->sortByName()->depth('== 0'); foreach ($finder as $directory) { /** @var SplFileInfo $directory */ $this->loadBundle(dirname($directory->getRealPath())); } } catch (\InvalidArgumentException $e) { } $finder = null; unset($finder); gc_collect_cycles(); $this->updateBundlesCache(); }
public function buildVendorDirectory() { $this->output->writeln('build vendor2/ .'); $this->filesystem->mkdir("{$this->distDirectory}/vendor2"); $this->filesystem->copy("{$this->rootDirectory}/vendor/autoload.php", "{$this->distDirectory}/vendor2/autoload.php"); $directories = array('composer', 'doctrine/annotations/lib', 'doctrine/cache/lib', 'doctrine/collections/lib', 'doctrine/common/lib/Doctrine', 'doctrine/dbal/lib/Doctrine', 'doctrine/doctrine-bundle', 'doctrine/doctrine-cache-bundle', 'doctrine/doctrine-migrations-bundle', 'doctrine/inflector/lib', 'doctrine/lexer/lib', 'doctrine/migrations/lib', 'doctrine/orm/lib', 'endroid/qrcode/src', 'endroid/qrcode/assets', 'ezyang/htmlpurifier/library', 'gregwar/captcha', 'imagine/imagine/lib', 'incenteev/composer-parameter-handler', 'jdorn/sql-formatter/lib', 'kriswallsmith/assetic/src', 'monolog/monolog/src', 'phpoffice/phpexcel/Classes', 'pimple/pimple/lib', 'psr/log/Psr', 'sensio/distribution-bundle', 'sensio/framework-extra-bundle', 'sensio/generator-bundle', 'sensiolabs/security-checker', 'silex/silex/src', 'swiftmailer/swiftmailer/lib', 'symfony/assetic-bundle', 'symfony/monolog-bundle', 'symfony/swiftmailer-bundle', 'symfony/symfony/src', 'twig/extensions/lib', 'twig/twig/lib'); foreach ($directories as $dir) { $this->filesystem->mirror("{$this->rootDirectory}/vendor/{$dir}", "{$this->distDirectory}/vendor2/{$dir}"); } $this->filesystem->remove("{$this->distDirectory}/vendor2/composer/installed.json"); $finder = new Finder(); $finder->directories()->in("{$this->distDirectory}/vendor2"); $toDeletes = array(); foreach ($finder as $dir) { if ($dir->getFilename() == 'Tests') { $toDeletes[] = $dir->getRealpath(); } } $this->filesystem->remove($toDeletes); $remainFiles = array('composer/LICENSE', 'doctrine/annotations/LICENSE', 'doctrine/cache/LICENSE', 'doctrine/collections/LICENSE', 'doctrine/common/LICENSE', 'doctrine/dbal/LICENSE', 'doctrine/doctrine-bundle/LICENSE', 'doctrine/inflector/LICENSE', 'doctrine/lexer/LICENSE', 'doctrine/migrations/LICENSE', 'doctrine/orm/LICENSE', 'endroid/qrcode/LICENSE', 'ezyang/htmlpurifier/LICENSE', 'gregwar/captcha/LICENSE', 'imagine/imagine/LICENSE', 'incenteev/composer-parameter-handler/LICENSE', 'jdorn/sql-formatter/LICENSE.txt', 'kriswallsmith/assetic/LICENSE', 'monolog/monolog/LICENSE', 'phpoffice/phpexcel/license.md', 'pimple/pimple/LICENSE', 'psr/log/LICENSE', 'sensiolabs/security-checker/LICENSE', 'silex/silex/LICENSE', 'swiftmailer/swiftmailer/LICENSE', 'symfony/assetic-bundle/LICENSE', 'symfony/symfony/LICENSE'); foreach ($remainFiles as $file) { // $path = "{$this->rootDirectory}/vendor/{$file}"; // if (!file_exists($path)) { // echo $path . "\n"; // } $this->filesystem->copy("{$this->rootDirectory}/vendor/{$file}", "{$this->distDirectory}/vendor2/{$file}"); } }
private function simpleAction($action = 'renew', $time) { if ($this->checkLetsEncrypt()) { $check = new domainCheck(); $finder = new Finder(); $certCheck = new certsCheck(); $le = new letsEncrypt($this->config); $counter = 0; $finder->directories()->in($this->config['system']['le-domains']); foreach ($finder as $file) { if ($action == 'renew') { if ($certCheck->isCertExpire($file->getRealpath(), $time)) { if ($check->isSubdomain($file->getRelativePathname())) { $le->renewSubDomain($file->getRelativePathname()); } else { $le->renewDomain($file->getRelativePathname()); } $counter++; } } elseif ($action == "revoke") { $le->revokeDomain($file->getRelativePathname()); $counter++; } } return $counter; } }
protected function execute(InputInterface $input, OutputInterface $output) { /** @var AlbumRepository $repo */ $repo = $this->getContainer()->get('doctrine')->getRepository('RodgerGalleryBundle:Album'); $webroot = $this->getContainer()->getParameter('web_root'); $result = array(); foreach ($repo->findAll() as $album) { /** @var Album $album */ $output->writeln(sprintf("<info>[%s]</info>\t%s => %s", $album->getName(), $album->getSlug(), $album->getId())); $finder = new Finder(); foreach ($finder->directories()->name($album->getSlug())->in($webroot) as $dir) { $output->writeln($dir->getRealpath()); $this->addResult($album, $dir); } $finder = new Finder(); foreach ($finder->directories()->name($album->getSlug())->in($this->getContainer()->getParameter('kernel.root_dir') . '/../uploads') as $dir) { $output->writeln($dir->getRealpath()); $this->addResult($album, $dir); } } foreach ($this->result as $arr) { $output->writeln(sprintf("<info>%s => %s</info>", $arr['old'], $arr['new'])); exec(sprintf("mv %s %s", $arr['old'], $arr['new'])); } }
public function boot() { if (true === $this->booted) { return; } $this->booted = true; $moduleConfigCacheFile = $this->getParameter('kernel.root_dir') . '/cache/' . $this->environment . '/modules_config.php'; if (file_exists($moduleConfigCacheFile)) { $this->_moduleConfig = (include $moduleConfigCacheFile); } else { $finder = new Finder(); $finder->directories()->depth('== 0'); foreach ($this->_moduleDirectories as $dir) { if (glob($dir . '/*/Service', GLOB_ONLYDIR)) { $finder->in($dir . '/*/Service'); } } foreach ($finder as $dir) { $filepath = $dir->getRealPath() . '/module_config.php'; if (file_exists($filepath)) { $this->_moduleConfig = array_merge_recursive($this->_moduleConfig, include $filepath); } } if (!$this->debug) { $cache = "<?php \nreturn " . var_export($this->_moduleConfig, true) . ';'; file_put_contents($moduleConfigCacheFile, $cache); } } $subscribers = empty($this->_moduleConfig['event_subscriber']) ? array() : $this->_moduleConfig['event_subscriber']; foreach ($subscribers as $subscriber) { $this->dispatcher()->addSubscriber(new $subscriber()); } }
private function simpleAction($action = 'renew') { $fs = new Filesystem(); if (!$fs->exists($this->config['system']['le-domains'])) { throw new Exception("FATAL ERROR: Directory " . $this->config['system']['le-domains'] . " not exist. Is Let's Encrypt installed ?"); } $check = new domainCheck(); $finder = new Finder(); $certCheck = new certsCheck(); $le = new letsEncrypt($this->config); $counter = 0; $finder->directories()->in($this->config['system']['le-domains']); foreach ($finder as $file) { if ($certCheck->isCertExpire($file->getRealpath())) { if ($check->isSubdomain($file->getRelativePathname())) { if ($action == 'renew') { $le->renewSubDomain($file->getRelativePathname()); } elseif ($action == 'revoke') { $le->revokeSubDomain($file->getRelativePathname()); } } else { if ($action == 'renew') { $le->renewDomain($file->getRelativePathname()); } elseif ($action == 'revoke') { $le->revokeDomain($file->getRelativePathname()); } } $counter++; } } return $counter; }
public static function followLinks(array $paths, $excludePatterns) { $finder = new Finder(); $finder->directories(); foreach ($excludePatterns as $excludePattern) { if (substr($excludePattern, 0, 1) == '/') { $excludePattern = substr($excludePattern, 1); } $excludePattern = '/' . preg_quote($excludePattern, '/') . '/'; $excludePattern = str_replace(preg_quote('*', '/'), '.*', $excludePattern); $finder->notPath($excludePattern); } foreach ($paths as $p) { $finder->in($p); } foreach ($finder as $i) { if ($i->isLink()) { $realPath = $i->getRealPath(); foreach ($paths as $k => $p2) { if (substr($realPath, 0, strlen($p2) + 1) == $p2 . '/') { continue 2; } } $paths[] = $realPath; } } return $paths; }
protected function execute(InputInterface $input, OutputInterface $output) { $dialog = $this->getHelperSet()->get('dialog'); $rootDir = $input->getArgument('rootDir'); $modules = $this->getModules(); $finder = new Finder(); $finder->directories()->in($rootDir)->filter(function (\SplFileInfo $file) use($modules) { return in_array($file->getFilename(), $modules['incompatibles']['modules']); }); foreach ($finder as $file) { $errors['incompatibles'][] = $file->getRelativePathname(); } $finder = new Finder(); $finder->directories()->in($rootDir)->filter(function (\SplFileInfo $file) use($modules) { return in_array($file->getFilename(), $modules['warnings']['modules']); }); foreach ($finder as $file) { $errors['warnings'][] = $file->getRelativePathname(); } foreach ($errors as $type => $error) { $output->writeln('<info>' . $type . '</info>'); foreach ($error as $a) { $output->writeln('<error>' . $a . '</error>'); } } }
/** * Try to patch all older versions, in Patch\Version_X_Y_Z dirs * * @param BundleVersion $bundleVersion * @return Version */ protected function patchOldVersions(BundleVersion $bundleVersion) { $reflection = new \ReflectionClass(get_called_class()); $fileInfos = new \SplFileInfo($reflection->getFileName()); $patchPath = $fileInfos->getPath() . DIRECTORY_SEPARATOR . 'Patch'; // directory doesn't exists, no patch to call if (is_dir($patchPath) === false) { return $bundleVersion->getInstalledVersion(); } // dirs like Update\Version_X_Y_Z $finderVersions = new Finder(); $finderVersions->directories()->in($patchPath)->name('Version_*')->sortByName(); $dirsVersions = array(); foreach ($finderVersions as $dir) { $dirsVersions[] = str_replace('_', '.', substr($dir->getFilename(), 8)); } usort($dirsVersions, array($this, 'compareDirVersion')); // now that we have dirs in right order, let's find patch files $return = $bundleVersion->getInstalledVersion(); foreach ($dirsVersions as $dir) { $files = $this->findPatchsFiles($patchPath . DIRECTORY_SEPARATOR . 'Version_' . str_replace('.', '_', $dir)); foreach ($files as $file) { $className = $reflection->getNamespaceName() . '\\Patch\\Version_' . str_replace('.', '_', $dir) . '\\' . $file->getBasename('.' . $file->getExtension()); $this->callUpdate($className, $bundleVersion); } $return = new Version($dir); } return $return; }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $destroy_prs = array(); $pull_request = $this->getConfigParameter('pull_request'); $pr_directories = $this->getConfigParameter('pr_directories'); // Get deployed PR's based on directories in $pr_directories and compare // that to the PR's open on GitHub. if ($input->getOption('closed')) { $deployed_prs = array(); $finder = new Finder(); // @TODO need to ensure that prefix is alphanumeric ONLY. $pattern = '/^' . $pull_request['prefix'] . '\\-([0-9]+)/'; $iterator = $finder->directories()->name($pattern)->depth(0)->in($pr_directories); foreach ($iterator as $directory) { preg_match($pattern, $directory->getFilename(), $matches); $deployed_prs[] = $matches[1]; } if (!empty($deployed_prs)) { $github = $this->getGithub(); $open_prs = array(); $paginator = new Github\ResultPager($github); $prs = $paginator->fetchAll($github->api('pr'), 'all', array($this->getConfigParameter('organization'), $this->getConfigParameter('repository'), array('state' => 'open'))); foreach ($prs as $pr) { $open_prs[] = $pr['number']; } // PR's to destroy are deployed PR's that are not open. $destroy_prs = array_diff($deployed_prs, $open_prs); } } else { $pr_number = $input->getArgument('pull-request'); if (!is_numeric($pr_number)) { throw new \Exception("PR must be a number."); } $destroy_prs[] = $pr_number; } if (!empty($destroy_prs)) { $fs = new Filesystem(); $site_dir = $input->getOption('site-dir'); foreach ($destroy_prs as $destroy_pr) { // @TODO get this path from a central place. $pr_path = rtrim($pr_directories, '/') . "/{$pull_request['prefix']}-{$destroy_pr}.{$pull_request['domain']}"; if ($fs->exists($pr_path)) { // Drop the database. // @TODO set/get database name in central place, and use in DrupalSettings. $database = $pull_request['prefix'] . '_' . $destroy_pr; $process = new Process("drush sqlq 'DROP database {$database}'", $pr_path . "/docroot/sites/" . $site_dir); $process->run(); // Remove the PR's web root. $fs->remove($pr_path); // @TODO destroy memcache bins. $output->writeln("<info>Successfully destroyed PR #{$destroy_pr}</info>"); } } } else { $output->writeln("<info>No PR's to destroy.</info>"); } }
/** * @return array Array containing all modules keys */ protected function getModules() { $finder = new Finder(); $finder->directories()->in(THEBUGGENIE_PATH . '/modules')->depth('== 0'); foreach ($finder as $file) { $modules[] = $file->getRelativePathname(); } return $modules; }
public function getChildren() { $finder = new Finder(); $finder->directories()->in($this->file_info->getPathname())->depth('== 0')->sortByName(); $categories = array(); foreach ($finder as $dir) { $categories[] = new Category($dir, $this->content_provider); } return $categories; }
/** * {@inheritdoc} */ public function getJobs($directory) { $builds = array(); $finder = new Finder(); $finder->directories(); foreach ($finder->in($this->getJoliCiStrategyDirectory($directory)) as $dir) { $builds[] = new Job($this->naming->getProjectName($directory), $this->getName(), $this->naming->getUniqueKey(array('build' => $dir->getFilename())), array('origin' => $directory, 'build' => $dir->getRealPath()), "JoliCi Build: " . $dir->getFilename()); } return $builds; }
private function fetchPages($dir) { $pages = array(); $finder = new Finder(); $folders = $finder->directories()->depth(0)->in($dir); foreach ($folders as $folder) { $pages[] = basename((string) $folder); } return $pages; }
public function getCategoryRoots() { $finder = new Finder(); $finder->directories()->in($this->datadir)->depth('== 0')->sortByName(); $categories = array(); foreach ($finder as $dir) { $categories[] = new Category($dir, $this); } return $categories; }
public function findThemeNames() { $finder = new Finder(); $finder->directories()->in($this->themeDir)->depth(0); $names = []; foreach ($finder as $directory) { $names[] = $directory->getFilename(); } return $names; }
public function resourceProvider() { $finder = new Finder(); $finder->directories()->in(__DIR__ . '/fixtures'); $finder->depth('< 1'); $data = array(); foreach ($finder as $directory) { $data[] = [file_get_contents($directory->getRealPath() . '/Resource/TestResource.php'), $directory->getRealPath() . '/swagger.json', $directory->getFilename()]; } return $data; }
/** * Returns all directories including their sub directories for the given template resources * * @param array $templateDirectories List of directories containing handlebars templates * * @return array */ private function getTemplateDirectoriesRecursive(array $templateDirectories) { $templateDirectoriesWithSubDirectories = array(); $templateDirectories = $this->getTemplateDirectories($templateDirectories); $finder = new Finder(); /** @var SplFileInfo $subDirectory */ foreach ($finder->directories()->in($templateDirectories) as $subDirectory) { $templateDirectoriesWithSubDirectories[] = $subDirectory->getRealPath(); } return array_unique(array_merge($templateDirectories, $templateDirectoriesWithSubDirectories)); }
public function connect(SilexApplication $app) { $app['controller.prod'] = $this; $controllers = $app['controllers_factory']; $controllers->before(function (Request $request) use($app) { if (!$app['authentication']->isAuthenticated() && null !== $request->query->get('nolog')) { return $app->redirectPath('login_authenticate_as_guest'); } if (null !== ($response = $app['firewall']->requireAuthentication())) { return $response; } }); $controllers->get('/', function (Application $app) { try { \Session_Logger::updateClientInfos($app, 1); } catch (SessionNotFound $e) { return $app->redirectPath('logout'); } $cssPath = $app['root.path'] . '/www/skins/prod/'; $css = []; $cssfile = false; $finder = new Finder(); $iterator = $finder->directories()->depth(0)->filter(function (\SplFileInfo $fileinfo) { return ctype_xdigit($fileinfo->getBasename()); })->in($cssPath); foreach ($iterator as $dir) { $baseName = $dir->getBaseName(); $css[$baseName] = $baseName; } $cssfile = $app['settings']->getUserSetting($app['authentication']->getUser(), 'css'); if (!$cssfile && isset($css['000000'])) { $cssfile = '000000'; } $feeds = $app['repo.feeds']->getAllForUser($app['acl']->get($app['authentication']->getUser())); $aggregate = Aggregate::createFromUser($app, $app['authentication']->getUser()); $thjslist = ""; $queries_topics = ''; if ($app['conf']->get(['registry', 'classic', 'render-topics']) == 'popups') { $queries_topics = \queries::dropdown_topics($app['translator'], $app['locale']); } elseif ($app['conf']->get(['registry', 'classic', 'render-topics']) == 'tree') { $queries_topics = \queries::tree_topics($app['locale']); } $sbas = $bas2sbas = []; foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) { $sbas_id = $databox->get_sbas_id(); $sbas['s' + $sbas_id] = ['sbid' => $sbas_id, 'seeker' => null]; foreach ($databox->get_collections() as $coll) { $bas2sbas['b' . $coll->get_base_id()] = ['sbid' => $sbas_id, 'ckobj' => ['checked' => false], 'waschecked' => false]; } } return $app['twig']->render('prod/index.html.twig', ['module_name' => 'Production', 'WorkZone' => new Helper\WorkZone($app, $app['request']), 'module_prod' => new Helper\Prod($app, $app['request']), 'cssfile' => $cssfile, 'module' => 'prod', 'events' => $app['events-manager'], 'GV_defaultQuery_type' => $app['conf']->get(['registry', 'searchengine', 'default-query-type']), 'GV_multiAndReport' => $app['conf']->get(['registry', 'modules', 'stories']), 'GV_thesaurus' => $app['conf']->get(['registry', 'modules', 'thesaurus']), 'cgus_agreement' => \databox_cgu::askAgreement($app), 'css' => $css, 'feeds' => $feeds, 'aggregate' => $aggregate, 'GV_google_api' => $app['conf']->get(['registry', 'webservices', 'google-charts-enabled']), 'queries_topics' => $queries_topics, 'search_status' => \databox_status::getSearchStatus($app), 'queries_history' => \queries::history($app, $app['authentication']->getUser()->getId()), 'thesau_js_list' => $thjslist, 'thesau_json_sbas' => json_encode($sbas), 'thesau_json_bas2sbas' => json_encode($bas2sbas), 'thesau_languages' => $app['locales.available']]); })->bind('prod'); return $controllers; }
public function getRecipies() { $finder = new Finder(); $recipies = array(); foreach ($finder->directories()->in(getcwd())->depth('== 0') as $directory) { if (file_exists($directory->getRealPath() . '/ext_emconf.php')) { $recipies[] = new ExtensionRecipe(String::relativePath($directory->getRealPath())); } } return $recipies; }
protected function getDirectories($path) { $directoryPaths = array(); $finder = new Finder(); $iterator = $finder->directories()->in($path); foreach ($iterator as $file) { /** @var SplFileInfo $file */ $directoryPaths[] = $file->getPathname(); } return $directoryPaths; }
public function schemaProvider() { $finder = new Finder(); $finder->directories()->in(__DIR__ . '/fixtures'); $finder->depth('< 1'); $data = array(); foreach ($finder as $directory) { $data[] = [$directory]; } return $data; }
/** * Lists all themes available in app/Resources/themes directory * * @return array */ private function getFolderDirectories() { $finder = new Finder(); $directories = $finder->directories()->in($this->getThemeDir())->sortByName()->depth('== 1'); $themeFolders = []; foreach ($directories as $directory) { $name = $directory->getRelativePath(); $themeFolders[$name] = $name; } return $themeFolders; }
/** * @param ContainerBuilder $container */ protected function readAnnotations(ContainerBuilder $container) { $annotationLoader = new Loader($container); $appFinder = new Finder(); $appFinder->directories()->in([ROOT . 'vendor/brainexe/'])->depth("<=1")->name('src'); $annotationLoader->load(ROOT . 'src'); foreach ($appFinder as $dir) { /** @var SplFileInfo $dir */ $annotationLoader->load($dir->getPathname()); } }
/** * {@inheritdoc} */ public function connect(Application $app) { $finder = new Finder(); $source = $app['root'] . $app['src_path']; $controllers = $app['controllers_factory']; foreach ($finder->directories()->in($source) as $file) { $content = $file->getFilename(); $controllers->get(sprintf('/%s', $content), 'content.controller:index')->contents($content)->bind(sprintf('%s_list', $content)); $controllers->get(sprintf('/%s/{%s}', $content, $content), 'content.controller:show')->content($content)->bind(sprintf('%s_show', $content)); } return $controllers; }
private function getThemes() { $themes = array(); $dir = $this->container->getParameter('kernel.root_dir') . '/../web/themes'; $finder = new Finder(); foreach ($finder->directories()->in($dir)->depth('== 0') as $directory) { $theme = $this->getTheme($directory->getBasename()); if ($theme) { $themes[] = $theme; } } return $themes; }
/** * {@inheritdoc} */ public function getLocales() { $finder = new Finder(); $finder->in($this->config->localesDirectory())->directories(); $locales = []; /** * @var SplFileInfo $directory */ foreach ($finder->directories()->getIterator() as $directory) { $locales[] = $directory->getFilename(); } return $locales; }