src/Command/GenerateModuleCommand.php
protected function _copyAndParseDir($sFrom, $sTo, array $aNameMap = array())
    {
        $oFileInfos = new \RecursiveIteratorIterator(
            new \RecursiveDirectoryIterator($sFrom, \RecursiveDirectoryIterator::SKIP_DOTS)
        );

        if (!file_exists($sTo)) {
            mkdir($sTo);
        }

        foreach ($oFileInfos as $oFileInfo) {
            $sFilePath = (string)$oFileInfo;
            $aReplace = array(
                'search' => array_merge(array($sFrom), array_keys($aNameMap)),
                'replace' => array_merge(array($sTo), array_values($aNameMap))
            );
            $sNewPath = str_replace($aReplace['search'], $aReplace['replace'], $sFilePath);
            $this->_copyAndParseFile($sFilePath, $sNewPath);
        }
    }
protected function _copyAndParseDir($sFrom, $sTo, array $aNameMap = array())
    {
        $oFileInfos = new \RecursiveIteratorIterator(
            new \RecursiveDirectoryIterator($sFrom, \RecursiveDirectoryIterator::SKIP_DOTS)
        );

        if (!file_exists($sTo)) {
            mkdir($sTo);
        }

        foreach ($oFileInfos as $oFileInfo) {
            $sFilePath = (string)$oFileInfo;
            $aReplace = array(
                'search' => array_merge(array($sFrom), array_keys($aNameMap)),
                'replace' => array_merge(array($sTo), array_values($aNameMap))
            );
            $sNewPath = str_replace($aReplace['search'], $aReplace['replace'], $sFilePath);
            $this->_copyAndParseFile($sFilePath, $sNewPath);
        }
    }
protected function _copyAndParseDir ( $ sFrom , $ sTo , array $ aNameMap = array ( ) ) { $ oFileInfos = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ sFrom , \ RecursiveDirectoryIterator :: SKIP_DOTS ) ) ; if ( ! file_exists ( $ sTo ) ) { mkdir ( $ sTo ) ; } foreach ( $ oFileInfos as $ oFileInfo ) { $ sFilePath = ( string ) $ oFileInfo ; $ aReplace = array ( 'search' => array_merge ( array ( $ sFrom ) , array_keys ( $ aNameMap ) ) , 'replace' => array_merge ( array ( $ sTo ) , array_values ( $ aNameMap ) ) ) ; $ sNewPath = str_replace ( $ aReplace [ 'search' ] , $ aReplace [ 'replace' ] , $ sFilePath ) ; $ this -> _copyAndParseFile ( $ sFilePath , $ sNewPath ) ; } }
Copies files from directory, parses all files and puts
parsed content to another directory

@param string $sFrom Directory from
@param string $sTo Directory to
@param array $aNameMap What should be changed in file name?
Copies files from directory parses all files and puts parsed content to another directory