/**
  * {@inheritdoc}
  */
 public function createProxy($class)
 {
     $proxy = $this->proxyFactory->createProxy($class);
     if ($proxy instanceof ServiceProxyCacheInterface) {
         if (null === $this->cacheProvider) {
             throw new InvalidCacheProviderException();
         }
         $proxy->proxy_setCacheProvider($this->cacheProvider);
     }
     return $proxy;
 }
 /**
  * @return \OpenClassrooms\ServiceProxy\Proxy\Factory\ProxyFactoryInterface
  */
 protected function buildProxyFactory(Configuration $configuration = null)
 {
     $proxyFactory = new ProxyFactory($configuration);
     $proxyFactory->setGenerator($this->buildGenerator());
     return $proxyFactory;
 }