src/Graviton/GeneratorBundle/Command/GenerateDynamicBundleCommand.php
private function getExistingBundleHashes($baseDir)
    {
        $existingBundles = [];
        $fs = new Filesystem();
        $bundleBaseDir = $baseDir.self::BUNDLE_NAMESPACE;

        if (!$fs->exists($bundleBaseDir)) {
            return $existingBundles;
        }

        $bundleFinder = $this->getBundleFinder($baseDir);

        foreach ($bundleFinder as $bundleDir) {
            $genHash = '';
            $hashFileFinder = new Finder();
            $hashFileIterator = $hashFileFinder
                ->files()
                ->in($bundleDir->getPathname())
                ->name(self::GENERATION_HASHFILE_FILENAME)
                ->depth('== 0')
                ->getIterator();

            $hashFileIterator->rewind();

            $hashFile = $hashFileIterator->current();
            if ($hashFile instanceof SplFileInfo) {
                $genHash = $hashFile->getContents();
            }

            $existingBundles[$bundleDir->getPathname()] = $genHash;
        }

        return $existingBundles;
    }
private function getExistingBundleHashes($baseDir)
    {
        $existingBundles = [];
        $fs = new Filesystem();
        $bundleBaseDir = $baseDir.self::BUNDLE_NAMESPACE;

        if (!$fs->exists($bundleBaseDir)) {
            return $existingBundles;
        }

        $bundleFinder = $this->getBundleFinder($baseDir);

        foreach ($bundleFinder as $bundleDir) {
            $genHash = '';
            $hashFileFinder = new Finder();
            $hashFileIterator = $hashFileFinder
                ->files()
                ->in($bundleDir->getPathname())
                ->name(self::GENERATION_HASHFILE_FILENAME)
                ->depth('== 0')
                ->getIterator();

            $hashFileIterator->rewind();

            $hashFile = $hashFileIterator->current();
            if ($hashFile instanceof SplFileInfo) {
                $genHash = $hashFile->getContents();
            }

            $existingBundles[$bundleDir->getPathname()] = $genHash;
        }

        return $existingBundles;
    }
private function getExistingBundleHashes ( $ baseDir ) { $ existingBundles = [ ] ; $ fs = new Filesystem ( ) ; $ bundleBaseDir = $ baseDir . self :: BUNDLE_NAMESPACE ; if ( ! $ fs -> exists ( $ bundleBaseDir ) ) { return $ existingBundles ; } $ bundleFinder = $ this -> getBundleFinder ( $ baseDir ) ; foreach ( $ bundleFinder as $ bundleDir ) { $ genHash = '' ; $ hashFileFinder = new Finder ( ) ; $ hashFileIterator = $ hashFileFinder -> files ( ) -> in ( $ bundleDir -> getPathname ( ) ) -> name ( self :: GENERATION_HASHFILE_FILENAME ) -> depth ( '== 0' ) -> getIterator ( ) ; $ hashFileIterator -> rewind ( ) ; $ hashFile = $ hashFileIterator -> current ( ) ; if ( $ hashFile instanceof SplFileInfo ) { $ genHash = $ hashFile -> getContents ( ) ; } $ existingBundles [ $ bundleDir -> getPathname ( ) ] = $ genHash ; } return $ existingBundles ; }
scans through all existing dynamic bundles, checks if there is a generation hash and collect that
all in an array that can be used for fast checking.

@param string $baseDir base directory of dynamic bundles

@return array key is bundlepath, value is the current hash
scans through all existing dynamic bundles checks if there is a generation hash and collect that all in an array that can be used for fast checking .