protected function compileScopedProxies(ContainerBuilder $builder, $proxyCachePath, array $additionalProxies = [])
	{			
		$code = "\t\tpublic function loadScopedProxy(\$typeName) {\n";
		$code .= "\t\tswitch(\$typeName) {\n";
		
		$proxyTypes = [];
		
		foreach($builder->getProxyBindings() as $binding)
		{
			$ref = new \ReflectionClass($binding->getTypeName());
			$proxyTypes[$ref->name] = $ref;
		}
		
		foreach($additionalProxies as $add)
		{
			$ref = new \ReflectionClass($add);
			$proxyTypes[$ref->name] = $ref;
		}
		
		foreach($proxyTypes as $ref)
		{	
			$parent = $ref;
			$mtime = filemtime($ref->getFileName());
			
			while($parent = $ref->getParentClass())
			{
				$mtime = max($mtime, filemtime($parent->getFileName()));
			}
				
			$file = $proxyCachePath . '/' . md5(strtolower($ref->name)) . '.php';
			$create = !is_file($file) || filemtime($file) < $mtime;
				
			if($create)
			{
				$proxyCode = '<?php' . "\n\n" . $this->proxyGenerator->generateProxyCode($ref);
				
				Filesystem::writeFile($file, $proxyCode);
			}
			
			$code .= "\t\t\tcase " . var_export($ref->name, true) . ":\n";
			$code .= "\t\t\t\trequire_once " . var_export($file, true) . ";\n";
			$code .= "\t\t\t\treturn \$typeName . '__scoped';\n";
			$code .= "\t\t\t\tbreak;\n";
		}
		
		$code .= "\t\t}\n";
		$code .= "\t\treturn parent::loadScopedProxy(\$typeName);\n";
		$code .= "\t\t}\n\n";
		
		return $code;
	}
protected function compileScopedProxies(ContainerBuilder $builder, $proxyCachePath, array $additionalProxies = [])
	{			
		$code = "\t\tpublic function loadScopedProxy(\$typeName) {\n";
		$code .= "\t\tswitch(\$typeName) {\n";
		
		$proxyTypes = [];
		
		foreach($builder->getProxyBindings() as $binding)
		{
			$ref = new \ReflectionClass($binding->getTypeName());
			$proxyTypes[$ref->name] = $ref;
		}
		
		foreach($additionalProxies as $add)
		{
			$ref = new \ReflectionClass($add);
			$proxyTypes[$ref->name] = $ref;
		}
		
		foreach($proxyTypes as $ref)
		{	
			$parent = $ref;
			$mtime = filemtime($ref->getFileName());
			
			while($parent = $ref->getParentClass())
			{
				$mtime = max($mtime, filemtime($parent->getFileName()));
			}
				
			$file = $proxyCachePath . '/' . md5(strtolower($ref->name)) . '.php';
			$create = !is_file($file) || filemtime($file) < $mtime;
				
			if($create)
			{
				$proxyCode = '<?php' . "\n\n" . $this->proxyGenerator->generateProxyCode($ref);
				
				Filesystem::writeFile($file, $proxyCode);
			}
			
			$code .= "\t\t\tcase " . var_export($ref->name, true) . ":\n";
			$code .= "\t\t\t\trequire_once " . var_export($file, true) . ";\n";
			$code .= "\t\t\t\treturn \$typeName . '__scoped';\n";
			$code .= "\t\t\t\tbreak;\n";
		}
		
		$code .= "\t\t}\n";
		$code .= "\t\treturn parent::loadScopedProxy(\$typeName);\n";
		$code .= "\t\t}\n\n";
		
		return $code;
	}
protected function compileScopedProxies ( ContainerBuilder $ builder , $ proxyCachePath , array $ additionalProxies = [ ] ) { $ code = "\t\tpublic function loadScopedProxy(\$typeName) {\n" ; $ code .= "\t\tswitch(\$typeName) {\n" ; $ proxyTypes = [ ] ; foreach ( $ builder -> getProxyBindings ( ) as $ binding ) { $ ref = new \ ReflectionClass ( $ binding -> getTypeName ( ) ) ; $ proxyTypes [ $ ref -> name ] = $ ref ; } foreach ( $ additionalProxies as $ add ) { $ ref = new \ ReflectionClass ( $ add ) ; $ proxyTypes [ $ ref -> name ] = $ ref ; } foreach ( $ proxyTypes as $ ref ) { $ parent = $ ref ; $ mtime = filemtime ( $ ref -> getFileName ( ) ) ; while ( $ parent = $ ref -> getParentClass ( ) ) { $ mtime = max ( $ mtime , filemtime ( $ parent -> getFileName ( ) ) ) ; } $ file = $ proxyCachePath . '/' . md5 ( strtolower ( $ ref -> name ) ) . '.php' ; $ create = ! is_file ( $ file ) || filemtime ( $ file ) < $ mtime ; if ( $ create ) { $ proxyCode = '<?php' . "\n\n" . $ this -> proxyGenerator -> generateProxyCode ( $ ref ) ; Filesystem :: writeFile ( $ file , $ proxyCode ) ; } $ code .= "\t\t\tcase " . var_export ( $ ref -> name , true ) . ":\n" ; $ code .= "\t\t\t\trequire_once " . var_export ( $ file , true ) . ";\n" ; $ code .= "\t\t\t\treturn \$typeName . '__scoped';\n" ; $ code .= "\t\t\t\tbreak;\n" ; } $ code .= "\t\t}\n" ; $ code .= "\t\treturn parent::loadScopedProxy(\$typeName);\n" ; $ code .= "\t\t}\n\n" ; return $ code ; }
Compiles scoped proxy types and saves them on the filesystem.

@param ContainerBuilder $builder
@param string $proxyCachePath
@param array<stribg> $additionalProxies
@return string
Compiles scoped proxy types and saves them on the filesystem .