public function cleanupOutputDirectory()
    {
        $directoryIterator = new \RecursiveDirectoryIterator($this->outputDirectory, \RecursiveDirectoryIterator::SKIP_DOTS);

        /**
         * Items, which must not be deleted have to be skipped during the directory iteration
         *
         * @param \SplFileInfo $current
         * @return bool
         */
        $filterCallback = function (\SplFileInfo $current) {
            $skipItem = false === strpos($current->getFilename(), '.gitkeep') ? true : false;
            return $skipItem;
        };

        $filteredDirectoryIterator = new \RecursiveCallbackFilterIterator($directoryIterator, $filterCallback);
        $items = new \RecursiveIteratorIterator(
            $filteredDirectoryIterator,
            \RecursiveIteratorIterator::CHILD_FIRST
        );

        $this->fileSystem->remove($items);
    }
public function cleanupOutputDirectory()
    {
        $directoryIterator = new \RecursiveDirectoryIterator($this->outputDirectory, \RecursiveDirectoryIterator::SKIP_DOTS);

        /**
         * Items, which must not be deleted have to be skipped during the directory iteration
         *
         * @param \SplFileInfo $current
         * @return bool
         */
        $filterCallback = function (\SplFileInfo $current) {
            $skipItem = false === strpos($current->getFilename(), '.gitkeep') ? true : false;
            return $skipItem;
        };

        $filteredDirectoryIterator = new \RecursiveCallbackFilterIterator($directoryIterator, $filterCallback);
        $items = new \RecursiveIteratorIterator(
            $filteredDirectoryIterator,
            \RecursiveIteratorIterator::CHILD_FIRST
        );

        $this->fileSystem->remove($items);
    }
public function cleanupOutputDirectory ( ) { $ directoryIterator = new \ RecursiveDirectoryIterator ( $ this -> outputDirectory , \ RecursiveDirectoryIterator :: SKIP_DOTS ) ; /**
         * Items, which must not be deleted have to be skipped during the directory iteration
         *
         * @param \SplFileInfo $current
         * @return bool
         */ $ filterCallback = function ( \ SplFileInfo $ current ) { $ skipItem = false === strpos ( $ current -> getFilename ( ) , '.gitkeep' ) ? true : false ; return $ skipItem ; } ; $ filteredDirectoryIterator = new \ RecursiveCallbackFilterIterator ( $ directoryIterator , $ filterCallback ) ; $ items = new \ RecursiveIteratorIterator ( $ filteredDirectoryIterator , \ RecursiveIteratorIterator :: CHILD_FIRST ) ; $ this -> fileSystem -> remove ( $ items ) ; }
Delete the generated contents of the output directory

@throws \Symfony\Component\Filesystem\Exception\IOException
Delete the generated contents of the output directory