private function mapDirectory($dir, $targetModuleName, $newModuleName) 
	{
	    $result = array();
	    $cdir = scandir($dir);
	    
	    $fileName = '';
	    foreach ($cdir as $key => $value) 
	    {
	        if (!in_array($value,array(".",".."))) 
	        {
	            if (is_dir($dir . '/' . $value)) 
	            {
	
	                if ($value == $targetModuleName) 
	                {
	                    rename($dir . '/' . $value, $dir . '/' . $newModuleName);
	                    $value = $newModuleName;
	                }
	                elseif ($value == $this->moduleNameToViewName($targetModuleName)) 
	                {
	                    $newModuleNameSnakeCase = $this->moduleNameToViewName($newModuleName);
	                    rename($dir . '/' . $value, $dir . '/' . $newModuleNameSnakeCase);
	                    
	                    $value = $newModuleNameSnakeCase;
	                }
	                
	                $result[$dir . '/' .$value] = $this->mapDirectory($dir . '/' . $value, $targetModuleName, $newModuleName);
	            }
	            else 
	            {
	                $newFileName = str_replace($targetModuleName, $newModuleName, $value);
	                if ($value != $newFileName) 
	                {
	                    rename($dir . '/' . $value, $dir . '/' . $newFileName);
	                    $value = $newFileName;
	                }
	                $result[$dir . '/' .$value] = $value;
	                $fileName = $dir . '/' .$value;
	                $this->replaceFileTextContent($fileName, $fileName, $targetModuleName, $newModuleName);
	            }
	        }
	    }
	    
	    return $result;
	}
private function mapDirectory($dir, $targetModuleName, $newModuleName) 
	{
	    $result = array();
	    $cdir = scandir($dir);
	    
	    $fileName = '';
	    foreach ($cdir as $key => $value) 
	    {
	        if (!in_array($value,array(".",".."))) 
	        {
	            if (is_dir($dir . '/' . $value)) 
	            {
	
	                if ($value == $targetModuleName) 
	                {
	                    rename($dir . '/' . $value, $dir . '/' . $newModuleName);
	                    $value = $newModuleName;
	                }
	                elseif ($value == $this->moduleNameToViewName($targetModuleName)) 
	                {
	                    $newModuleNameSnakeCase = $this->moduleNameToViewName($newModuleName);
	                    rename($dir . '/' . $value, $dir . '/' . $newModuleNameSnakeCase);
	                    
	                    $value = $newModuleNameSnakeCase;
	                }
	                
	                $result[$dir . '/' .$value] = $this->mapDirectory($dir . '/' . $value, $targetModuleName, $newModuleName);
	            }
	            else 
	            {
	                $newFileName = str_replace($targetModuleName, $newModuleName, $value);
	                if ($value != $newFileName) 
	                {
	                    rename($dir . '/' . $value, $dir . '/' . $newFileName);
	                    $value = $newFileName;
	                }
	                $result[$dir . '/' .$value] = $value;
	                $fileName = $dir . '/' .$value;
	                $this->replaceFileTextContent($fileName, $fileName, $targetModuleName, $newModuleName);
	            }
	        }
	    }
	    
	    return $result;
	}
private function mapDirectory ( $ dir , $ targetModuleName , $ newModuleName ) { $ result = array ( ) ; $ cdir = scandir ( $ dir ) ; $ fileName = '' ; foreach ( $ cdir as $ key => $ value ) { if ( ! in_array ( $ value , array ( "." , ".." ) ) ) { if ( is_dir ( $ dir . '/' . $ value ) ) { if ( $ value == $ targetModuleName ) { rename ( $ dir . '/' . $ value , $ dir . '/' . $ newModuleName ) ; $ value = $ newModuleName ; } elseif ( $ value == $ this -> moduleNameToViewName ( $ targetModuleName ) ) { $ newModuleNameSnakeCase = $ this -> moduleNameToViewName ( $ newModuleName ) ; rename ( $ dir . '/' . $ value , $ dir . '/' . $ newModuleNameSnakeCase ) ; $ value = $ newModuleNameSnakeCase ; } $ result [ $ dir . '/' . $ value ] = $ this -> mapDirectory ( $ dir . '/' . $ value , $ targetModuleName , $ newModuleName ) ; } else { $ newFileName = str_replace ( $ targetModuleName , $ newModuleName , $ value ) ; if ( $ value != $ newFileName ) { rename ( $ dir . '/' . $ value , $ dir . '/' . $ newFileName ) ; $ value = $ newFileName ; } $ result [ $ dir . '/' . $ value ] = $ value ; $ fileName = $ dir . '/' . $ value ; $ this -> replaceFileTextContent ( $ fileName , $ fileName , $ targetModuleName , $ newModuleName ) ; } } } return $ result ; }
This method will map a directory to change some specific word
that match the target and replace by new word

@param String $dir
@param String $targetModuleName
@param String $newModuleName
@return Array
This method will map a directory to change some specific word that match the target and replace by new word