<NME> FileGeneratorRegistry.php
<BEF> <?php

namespace Zend\Code\Generator;

class FileGeneratorRegistry
{
    /**
     * @todo Complete this when Zend\Tool get's refractored as it is the only 
     *       piece that cares if its "double reflecting" file generators
     */
}

        // 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(['\\', '/'], DIRECTORY_SEPARATOR, $fileName);

        static::$fileCodeGenerators[$fileName] = $fileCodeGenerator;
    }
}

<MSG> Merge branch 'master' of https://github.com/MontmereLimited/zf2 into hotfix/tool-refactoring

<DFF> @@ -2,10 +2,37 @@
 
 namespace Zend\Code\Generator;
 
+use Zend\Code\Generator\Exception\RuntimeException;
+
 class FileGeneratorRegistry
 {
-    /**
-     * @todo Complete this when Zend\Tool get's refractored as it is the only 
-     *       piece that cares if its "double reflecting" file generators
-     */
+	/**
+	 * @var array[string]\Zend\Code\Generator\FileGenerator $_fileCodeGenerators registry for Zend\Code\Generator\FileGenerator
+	 */
+	static private $_fileCodeGenerators = array();
+	
+	/**
+	 * Registry for the Zend_Code package. Zend_Tool uses this
+	 * 
+	 * @param FileGenerator $fileCodeGenerator
+	 * @param string $fileName
+	 * @throws RuntimeException
+	 */
+    public static function registerFileCodeGenerator(FileGenerator $fileCodeGenerator, $fileName = null)
+    {
+        if ($fileName == null) {
+            $fileName = $fileCodeGenerator->getFilename();
+        }
+
+        if ($fileName == '') {
+            throw new RuntimeException('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;
+
+    }
 }
\ No newline at end of file

Merge branch 'master' of https://github.com/MontmereLimited/zf2 into hotfix/tool-refactoring