* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\ClassLoader; @trigger_error('The '.__NAMESPACE__.'\WinCacheClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use `composer install --apcu-autoloader` instead.', E_USER_DEPRECATED); /** * WinCacheClassLoader implements a wrapping autoloader cached in WinCache. * * It expects an object implementing a findFile method to find the file. This * allow using it as a wrapper around the other loaders of the component (the * ClassLoader for instance) but also around any other autoloaders following * this convention (the Composer one for instance). * * // with a Symfony autoloader * $loader = new ClassLoader(); * $loader->addPrefix('Symfony\Component', __DIR__.'/component'); * $loader->addPrefix('Symfony', __DIR__.'/framework'); * * // or with a Composer autoloader * use Composer\Autoload\ClassLoader; * * $loader = new ClassLoader(); * $loader->add('Symfony\Component', __DIR__.'/component'); * $loader->add('Symfony', __DIR__.'/framework'); * * $cachedLoader = new WinCacheClassLoader('my_prefix', $loader); * * // activate the cached autoloader * $cachedLoader->register(); * * // eventually deactivate the non-cached loader if it was registered previously * // to be sure to use the cached one. * $loader->unregister(); * * @author Fabien Potencier * @author Kris Wallsmith * @author Artem Ryzhkov * * @deprecated since version 3.3, to be removed in 4.0. Use `composer install --apcu-autoloader` instead. */ class WinCacheClassLoader { private $prefix; /** * A class loader object that implements the findFile() method. * * @var object */ protected $decorated; /** * @param string $prefix The WinCache namespace prefix to use * @param object $decorated A class loader object that implements the findFile() method * * @throws \RuntimeException * @throws \InvalidArgumentException */ public function __construct($prefix, $decorated) { if (!extension_loaded('wincache')) { throw new \RuntimeException('Unable to use WinCacheClassLoader as WinCache is not enabled.'); } if (!method_exists($decorated, 'findFile')) { throw new \InvalidArgumentException('The class finder must implement a "findFile" method.'); } $this->prefix = $prefix; $this->decorated = $decorated; } /** * Registers this instance as an autoloader. * * @param bool $prepend Whether to prepend the autoloader or not */ public function register($prepend = false) { spl_autoload_register(array($this, 'loadClass'), true, $prepend); } /** * Unregisters this instance as an autoloader. */ public function unregister() { spl_autoload_unregister(array($this, 'loadClass')); } /** * Loads the given class or interface. * * @param string $class The name of the class * * @return bool|null True, if loaded */ public function loadClass($class) { if ($file = $this->findFile($class)) { require $file; return true; } } /** * Finds a file by class name while caching lookups to WinCache. * * @param string $class A class name to resolve to file * * @return string|null */ public function findFile($class) { $file = wincache_ucache_get($this->prefix.$class, $success); if (!$success) { wincache_ucache_set($this->prefix.$class, $file = $this->decorated->findFile($class) ?: null, 0); } return $file; } /** * Passes through all unknown calls onto the decorated object. */ public function __call($method, $args) { return call_user_func_array(array($this->decorated, $method), $args); } } __halt_compiler();----SIGNATURE:----IZTI7PutopBCZnlD4bioPXPlharS02iYZ8wlTOiRVif2qlH5No0r6SnCpSILoh0+xeN0RDRnGYLzmOpieGXcbMauqailsXVZz2e9BAWlWcM0lb2i53iR5bxk88xZcEtSFYBwzqsJGcMvSQkSCrMU7EFUP+q6sHGo83qNXfNShU8cbA/iJUkzd+4WsGgtuXh/N9tD70HMFX2uNAEOjL46qOc3xyVluI6dS7BreapjUYpwEn0uJGuE9oO7fGgSYe/6VXUsTvE7riGaMaIYjFP4CAz8kEApJKEu4X/ioKKIFnbS+jSlo0/8RNNIxePCUlyYeRNTTj3mL1bIRSgcbt3xT1nFWqI0kdOqH3r6Yxo+J336Y8XRbftdlJYPS4L2OVJvIfIeEop5c5GGQbElY2DH4UhYYtPXhIdGLEzhYdQ6aEaKgxDuCGvaKgNcmTCvH2jwkfF58UQlcigCwpG7/CZ6kugr9kRVEHR2ufxfmUJIojtkUfqxfSMYtFAw/CAiLmrtFv7mkCkeLyMS9ouX25yDytFr7pwF6TI++Y8YOb+UjMXDu8pgGWrFjNJxuGurh16RA6MkVtEBTCEM3P4Qarn2YYjTdI0XavYObMXBWlEa0TyXTSs6CIprHrMiRrQdAQ964R1z6g3W1K200S8Wv406SXj9/JWTFODv81TAEcxmMQ0=----ATTACHMENT:----NTM0MDgwMDcwOTA1MzY3MCAyNTg2MzU2MTg1MTQ4NzkyIDE5MDY1ODU5NDMwMDQ2MzM=