Exemple #1
0
 /**
  * Fix all files in the directory according to the composed map
  * 
  * @param string $directory 
  */
 public function fix($directory)
 {
     $transformations = $this->map->getClassTransformations();
     $rdi = new RecursiveDirectoryIterator($directory, FilesystemIterator::SKIP_DOTS);
     foreach (new RecursiveIteratorIterator($rdi) as $file) {
         if ($file->getExtension() != 'php') {
             continue;
         }
         $this->fixNamespacesFromMap($file->getRealPath(), $transformations);
     }
 }
 public function modifyContentForUseStatements()
 {
     $files = $this->map->getNewFiles();
     $classTransformations = $this->map->getClassTransformations();
     foreach ($files as $file) {
         if (!file_exists($file)) {
             throw new \RuntimeException('The file ' . $file . ' could not be found in the filesystem, check your map file is correct.');
         }
         $this->modifyFileWithNewUseStatements($file, $classTransformations);
     }
 }