Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function getProxyCode(Definition $definition)
 {
     $generatedClass = new ClassGenerator($this->getProxyClassName($definition));
     $this->proxyGenerator->generate(new \ReflectionClass($definition->getClass()), $generatedClass);
     return $this->classGenerator->generate($generatedClass);
 }
 /**
  * Generates a proxy for the given class name, and retrieves its class name
  *
  * @param string $parentClassName
  *
  * @return string
  */
 private function generateProxy($parentClassName)
 {
     $generatedClassName = __NAMESPACE__ . '\\' . UniqueIdentifierGenerator::getIdentifier('Foo');
     $generator = new LazyLoadingValueHolderGenerator();
     $generatedClass = new ClassGenerator($generatedClassName);
     $strategy = new EvaluatingGeneratorStrategy();
     $generator->generate(new ReflectionClass($parentClassName), $generatedClass);
     $strategy->generate($generatedClass);
     return $generatedClassName;
 }