Пример #1
0
 /**
  * @covers \ProxyManager\Configuration::getClassNameInflector
  * @covers \ProxyManager\Configuration::setClassNameInflector
  */
 public function testSetGetClassNameInflector()
 {
     $this->assertInstanceOf('ProxyManager\\Inflector\\ClassNameInflectorInterface', $this->configuration->getClassNameInflector());
     $inflector = $this->getMock('ProxyManager\\Inflector\\ClassNameInflectorInterface');
     $this->configuration->setClassNameInflector($inflector);
     $this->assertSame($inflector, $this->configuration->getClassNameInflector());
 }
 /**
  * Generates the provided `$proxyClassName` from the given `$className` and `$proxyParameters`
  * @param string $proxyClassName
  * @param string $className
  * @param array  $proxyParameters
  *
  * @return void
  */
 private function generateProxyClass($proxyClassName, $className, array $proxyParameters)
 {
     $className = $this->configuration->getClassNameInflector()->getUserClassName($className);
     $phpClass = new ClassGenerator($proxyClassName);
     $this->getGenerator()->generate(new ReflectionClass($className), $phpClass);
     $phpClass = $this->configuration->getClassSignatureGenerator()->addSignature($phpClass, $proxyParameters);
     $this->configuration->getGeneratorStrategy()->generate($phpClass);
     $this->configuration->getProxyAutoloader()->__invoke($proxyClassName);
 }
Пример #3
0
 /**
  * @param \ProxyManager\Configuration $configuration
  */
 public function __construct(Configuration $configuration = null)
 {
     $this->configuration = $configuration ?: new Configuration();
     // localizing some properties for performance
     $this->inflector = $this->configuration->getClassNameInflector();
 }