[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/ocramius/proxy-manager/src/ProxyManager/ -> Configuration.php (source)

   1  <?php
   2  /*
   3   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   4   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   5   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
   6   * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
   7   * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   8   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   9   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  10   * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  11   * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  12   * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  13   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14   *
  15   * This software consists of voluntary contributions made by many individuals
  16   * and is licensed under the MIT license.
  17   */
  18  
  19  namespace ProxyManager;
  20  
  21  use ProxyManager\Autoloader\Autoloader;
  22  use ProxyManager\Autoloader\AutoloaderInterface;
  23  use ProxyManager\FileLocator\FileLocator;
  24  use ProxyManager\GeneratorStrategy\FileWriterGeneratorStrategy;
  25  use ProxyManager\GeneratorStrategy\GeneratorStrategyInterface;
  26  use ProxyManager\Inflector\ClassNameInflector;
  27  use ProxyManager\Inflector\ClassNameInflectorInterface;
  28  use ProxyManager\Signature\ClassSignatureGenerator;
  29  use ProxyManager\Signature\ClassSignatureGeneratorInterface;
  30  use ProxyManager\Signature\SignatureChecker;
  31  use ProxyManager\Signature\SignatureCheckerInterface;
  32  use ProxyManager\Signature\SignatureGenerator;
  33  use ProxyManager\Signature\SignatureGeneratorInterface;
  34  
  35  /**
  36   * Base configuration class for the proxy manager - serves as micro disposable DIC/facade
  37   *
  38   * @author Marco Pivetta <ocramius@gmail.com>
  39   * @license MIT
  40   */
  41  class Configuration
  42  {
  43      const DEFAULT_PROXY_NAMESPACE = 'ProxyManagerGeneratedProxy';
  44  
  45      /**
  46       * @var string|null
  47       */
  48      protected $proxiesTargetDir;
  49  
  50      /**
  51       * @var string
  52       */
  53      protected $proxiesNamespace = self::DEFAULT_PROXY_NAMESPACE;
  54  
  55      /**
  56       * @var GeneratorStrategyInterface|null
  57       */
  58      protected $generatorStrategy;
  59  
  60      /**
  61       * @var callable|null
  62       */
  63      protected $proxyAutoloader;
  64  
  65      /**
  66       * @var ClassNameInflectorInterface|null
  67       */
  68      protected $classNameInflector;
  69  
  70      /**
  71       * @var SignatureGeneratorInterface|null
  72       */
  73      protected $signatureGenerator;
  74  
  75      /**
  76       * @var SignatureCheckerInterface|null
  77       */
  78      protected $signatureChecker;
  79  
  80      /**
  81       * @var ClassSignatureGeneratorInterface|null
  82       */
  83      protected $classSignatureGenerator;
  84  
  85      /**
  86       * @deprecated deprecated since version 0.5
  87       * @codeCoverageIgnore
  88       */
  89      public function setAutoGenerateProxies()
  90      {
  91      }
  92  
  93      /**
  94       * @return bool
  95       *
  96       * @deprecated deprecated since version 0.5
  97       * @codeCoverageIgnore
  98       */
  99      public function doesAutoGenerateProxies()
 100      {
 101          return true;
 102      }
 103  
 104      /**
 105       * @param AutoloaderInterface $proxyAutoloader
 106       */
 107      public function setProxyAutoloader(AutoloaderInterface $proxyAutoloader)
 108      {
 109          $this->proxyAutoloader = $proxyAutoloader;
 110      }
 111  
 112      /**
 113       * @return AutoloaderInterface
 114       */
 115      public function getProxyAutoloader()
 116      {
 117          return $this->proxyAutoloader
 118              ?: $this->proxyAutoloader = new Autoloader(
 119                  new FileLocator($this->getProxiesTargetDir()),
 120                  $this->getClassNameInflector()
 121              );
 122      }
 123  
 124      /**
 125       * @param string $proxiesNamespace
 126       */
 127      public function setProxiesNamespace($proxiesNamespace)
 128      {
 129          $this->proxiesNamespace = $proxiesNamespace;
 130      }
 131  
 132      /**
 133       * @return string
 134       */
 135      public function getProxiesNamespace()
 136      {
 137          return $this->proxiesNamespace;
 138      }
 139  
 140      /**
 141       * @param string $proxiesTargetDir
 142       */
 143      public function setProxiesTargetDir($proxiesTargetDir)
 144      {
 145          $this->proxiesTargetDir = (string) $proxiesTargetDir;
 146      }
 147  
 148      /**
 149       * @return string
 150       */
 151      public function getProxiesTargetDir()
 152      {
 153          return $this->proxiesTargetDir ?: $this->proxiesTargetDir = sys_get_temp_dir();
 154      }
 155  
 156      /**
 157       * @param GeneratorStrategyInterface $generatorStrategy
 158       */
 159      public function setGeneratorStrategy(GeneratorStrategyInterface $generatorStrategy)
 160      {
 161          $this->generatorStrategy = $generatorStrategy;
 162      }
 163  
 164      /**
 165       * @return GeneratorStrategyInterface
 166       */
 167      public function getGeneratorStrategy()
 168      {
 169          return $this->generatorStrategy
 170              ?: $this->generatorStrategy = new FileWriterGeneratorStrategy(
 171                  new FileLocator($this->getProxiesTargetDir())
 172              );
 173      }
 174  
 175      /**
 176       * @param ClassNameInflectorInterface $classNameInflector
 177       */
 178      public function setClassNameInflector(ClassNameInflectorInterface $classNameInflector)
 179      {
 180          $this->classNameInflector = $classNameInflector;
 181      }
 182  
 183      /**
 184       * @return ClassNameInflectorInterface
 185       */
 186      public function getClassNameInflector()
 187      {
 188          return $this->classNameInflector
 189              ?: $this->classNameInflector = new ClassNameInflector($this->getProxiesNamespace());
 190      }
 191  
 192      /**
 193       * @param SignatureGeneratorInterface $signatureGenerator
 194       */
 195      public function setSignatureGenerator(SignatureGeneratorInterface $signatureGenerator)
 196      {
 197          $this->signatureGenerator = $signatureGenerator;
 198      }
 199  
 200      /**
 201       * @return SignatureGeneratorInterface
 202       */
 203      public function getSignatureGenerator()
 204      {
 205          return $this->signatureGenerator ?: $this->signatureGenerator = new SignatureGenerator();
 206      }
 207  
 208      /**
 209       * @param SignatureCheckerInterface $signatureChecker
 210       */
 211      public function setSignatureChecker(SignatureCheckerInterface $signatureChecker)
 212      {
 213          $this->signatureChecker = $signatureChecker;
 214      }
 215  
 216      /**
 217       * @return SignatureCheckerInterface
 218       */
 219      public function getSignatureChecker()
 220      {
 221          return $this->signatureChecker
 222              ?: $this->signatureChecker = new SignatureChecker($this->getSignatureGenerator());
 223      }
 224  
 225      /**
 226       * @param ClassSignatureGeneratorInterface $classSignatureGenerator
 227       */
 228      public function setClassSignatureGenerator(ClassSignatureGeneratorInterface $classSignatureGenerator)
 229      {
 230          $this->classSignatureGenerator = $classSignatureGenerator;
 231      }
 232  
 233      /**
 234       * @return ClassSignatureGeneratorInterface
 235       */
 236      public function getClassSignatureGenerator()
 237      {
 238          return $this->classSignatureGenerator
 239              ?: new ClassSignatureGenerator($this->getSignatureGenerator());
 240      }
 241  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1