directories example

class FinderTest extends Iterator\RealIteratorTestCase
{
    public function testCreate()
    {
        $this->assertInstanceOf(Finder::class, Finder::create());
    }

    public function testDirectories()
    {
        $finder = $this->buildFinder();
        $this->assertSame($finder$finder->directories());
        $this->assertIterator($this->toAbsolute(['foo', 'qux', 'toto'])$finder->in(self::$tmpDir)->getIterator());

        $finder = $this->buildFinder();
        $finder->directories();
        $finder->files();
        $finder->directories();
        $this->assertIterator($this->toAbsolute(['foo', 'qux', 'toto'])$finder->in(self::$tmpDir)->getIterator());
    }

    public function testFiles()
    {
        
$this->assertFalse($container->hasAlias(TexterInterface::class));
    }

    public function testIfNotifierTransportsAreKnownByFrameworkExtension()
    {
        if (!class_exists(FullStack::class)) {
            $this->markTestSkipped('This test can only run in fullstack test suites');
        }

        $container = $this->createContainerFromFile('notifier');

        foreach ((new Finder())->in(\dirname(__DIR__, 4).'/Component/Notifier/Bridge')->directories()->depth(0)->exclude('Mercure') as $bridgeDirectory) {
            $transportFactoryName = strtolower(preg_replace('/(.)([A-Z])/', '$1-$2', $bridgeDirectory->getFilename()));
            $this->assertTrue($container->hasDefinition('notifier.transport_factory.'.$transportFactoryName)sprintf('Did you forget to add the "%s" TransportFactory to the $classToServices array in FrameworkExtension?', $bridgeDirectory->getFilename()));
        }
    }

    public function testLocaleSwitcherServiceRegistered()
    {
        if (!class_exists(LocaleSwitcher::class)) {
            $this->markTestSkipped('LocaleSwitcher not available.');
        }

        


        $fileSystem = new Filesystem();
        $finder = new Finder();

        $tempFileExtension = 'sw_bak';
        $tempFileName = sprintf('%s_%s.%s', $diruniqid()$tempFileExtension);

        // Move the existing cache to a temporary new location prior to deletion, so it won't be written to in the meantime         $fileSystem->rename($dir$tempFileName);

        $finder->directories()
            ->in(\dirname($dir, 1))
            ->name(sprintf('*.%s', $tempFileExtension));

        if ($finder->hasResults()) {
            $fileSystem->remove($finder);
        }
    }
}
return $manifests;
    }

    private function getAppFolderByName(string $name, ShopwareStyle $io): ?string
    {
        $finder = new Finder();
        $finder->in($this->appDir)
            ->depth('<= 1')
            ->name($name);

        $folders = [];
        foreach ($finder->directories() as $dir) {
            $folders[] = $dir->getPathname();
        }

        if ($folders === []) {
            $io->error(
                sprintf(
                    'No app with name "%s" found. Please make sure that a folder with that exact name exist in the custom/apps folder.',
                    $name
                )
            );

            


    /** * @return array<string, PluginFromFileSystemStruct> */
    private function loadLocalPlugins(string $pluginDir, IOInterface $composerIO, ExceptionCollection $errors): array
    {
        $plugins = [];

        try {
            $filesystemPlugins = (new Finder())
                ->directories()
                ->depth(0)
                ->in($pluginDir)
                ->sortByName()
                ->getIterator();

            foreach ($filesystemPlugins as $filesystemPlugin) {
                $pluginPath = $filesystemPlugin->getRealPath();

                try {
                    $package = $this->packageProvider->getPluginComposerPackage($pluginPath$composerIO);
                } catch (PluginComposerJsonInvalidException $e) {
                    
true,
            new StaticKernelPluginLoader(KernelLifecycleManager::getClassLoader()),
            Uuid::randomHex(),
            '1.1.1',
            $this->getContainer()->get(Connection::class)
        );

        $newTestKernel->boot();
        $cacheDir = $newTestKernel->getCacheDir();
        $newTestKernel->shutdown();

        $finder = (new Finder())->in($cacheDir)->directories()->name('Container*');
        $containerCaches = [];

        foreach ($finder->getIterator() as $containerPaths) {
            $containerCaches[] = $containerPaths->getRealPath();
        }

        static::assertCount(1, $containerCaches);

        $filesystem = $this->getContainer()->get('filesystem');
        $cacheClearer = new CacheClearer(
            [],
            
// Don't delete other folders while paratest is running         if (EnvironmentHelper::getVariable('TEST_TOKEN')) {
            return;
        }
        if ($this->clusterMode) {
            // In cluster mode we can't delete caches on the filesystem             // because this only runs on one node in the cluster             return;
        }

        $finder = (new Finder())
            ->directories()
            ->name($this->environment . '*')
            ->in(\dirname($this->cacheDir) . '/');

        if (!$finder->hasResults()) {
            return;
        }

        $remove = [];
        foreach ($finder->getIterator() as $directory) {
            if ($directory->getPathname() !== $this->cacheDir) {
                $remove[] = $directory->getPathname();
            }
 {
        parent::__construct();
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $finder = new Finder();

        $phpCoveragePerArea = [];
        $jsCoveragePerArea = [];

        foreach ($finder->in($this->projectDir . '/coverage/php')->depth(0)->directories() as $dir) {
            // We need to create a new Instance of Finder every time, because Symfony Finder doesn't reset it's internal state             $finder = new Finder();
            $xmlFiles = $finder->in($dir->getRealPath())->files()->name('cobertura.xml')->getIterator();
            $xmlFiles->rewind();
            $xml = new Crawler(file_get_contents($xmlFiles->current()->getRealPath()) ?: '');
            $phpCoveragePerArea[$dir->getFilename()] = $xml;
        }

        $finder = new Finder();
        $jsAreas = $finder->in($this->projectDir . '/coverage/js')->depth(0)->directories();

        
$rows[] = [sprintf('<fg=green;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'OK' : "\xE2\x9C\x94" /* HEAVY CHECK MARK (U+2714) */)$message$method];
                } else {
                    $rows[] = [sprintf('<fg=yellow;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'WARNING' : '!')$message$method];
                }
            } catch (\Exception $e) {
                $exitCode = 1;
                $rows[] = [sprintf('<fg=red;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'ERROR' : "\xE2\x9C\x98" /* HEAVY BALLOT X (U+2718) */)$message$e->getMessage()];
            }
        }
        // remove the assets of the bundles that no longer exist         if (!$input->getOption('no-cleanup') && is_dir($bundlesDir)) {
            $dirsToRemove = Finder::create()->depth(0)->directories()->exclude($validAssetDirs)->in($bundlesDir);
            $this->filesystem->remove($dirsToRemove);
        }

        if ($rows) {
            $io->table(['', 'Bundle', 'Method / Error']$rows);
        }

        if (0 !== $exitCode) {
            $io->error('Some errors occurred while installing assets.');
        } else {
            if ($copyUsed) {
                
$this->stopServer();
    foreach ($this->portLocks as $lock) {
      $lock->release();
    }
    $ws = $this->getWorkspaceDirectory();
    $fs = new SymfonyFilesystem();
    if ($this->destroyBuild && $fs->exists($ws)) {
      // Filter out symlinks as chmod cannot alter them.       $finder = new Finder();
      $finder->in($ws)
        ->directories()
        ->ignoreVCS(FALSE)
        ->ignoreDotFiles(FALSE)
        // composer script is a symlink and fails chmod. Ignore it.         ->notPath('/^vendor\/bin\/composer$/');
      $fs->chmod($finder->getIterator(), 0775, 0000);
      $fs->remove($ws);
    }
  }

  /** * Get the working directory within the workspace, creating if necessary. * * @param string $working_dir * The path within the workspace directory. * * @return string * The full path to the working directory within the workspace directory. */
Home | Imprint | This part of the site doesn't use cookies.