示例#1
0
文件: PhpFile.php 项目: hjr3/zf2
 /**
  * registerFileCodeGnereator()
  * 
  * A file code generator registry
  * 
  * @param PHPFile $fileCodeGenerator
  * @param string $fileName
  */
 public static function registerFileCodeGenerator(PHPFile $fileCodeGenerator, $fileName = null)
 {
     if ($fileName == null) {
         $fileName = $fileCodeGenerator->getFilename();
     }
     if ($fileName == '') {
         throw new Exception('FileName does not exist.');
     }
     // cannot use realpath since the file might not exist, but we do need to have the index
     // in the same DIRECTORY_SEPARATOR that realpath would use:
     $fileName = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $fileName);
     self::$_fileCodeGenerators[$fileName] = $fileCodeGenerator;
 }