/** * @return \OpenClassrooms\ServiceProxy\ServiceProxyCacheInterface|\OpenClassrooms\ServiceProxy\ServiceProxyInterface */ public function create($class, $tagParameters) { $builder = $this->serviceProxyBuilder->create($class); if (null !== ($cache = $this->buildCache($tagParameters))) { $builder->withCache($cache); } return $builder->build(); }
/** * @return \OpenClassrooms\ServiceProxy\ServiceProxyBuilderInterface */ protected function getServiceProxyBuilder($cacheDir = null) { $serviceProxyBuilder = new ServiceProxyBuilder(); $configuration = new Configuration(); $configuration->setProxiesTargetDir($cacheDir); $serviceProxyBuilder->setProxyFactory($this->buildProxyFactory($configuration)); return $serviceProxyBuilder; }
/** * {@inheritdoc} */ protected function setUp() { $this->serviceProxyBuilder = $this->getServiceProxyBuilder(self::$cacheDir); $this->cacheProviderDecorator = new CacheProviderDecoratorMock(); $this->proxy = $this->serviceProxyBuilder->create(new CacheAnnotationClass())->withCache($this->cacheProviderDecorator)->build(); }