* * 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__.'\XcacheClassLoader class is deprecated since Symfony 3.3 and will be removed in 4.0. Use `composer install --apcu-autoloader` instead.', E_USER_DEPRECATED); /** * XcacheClassLoader implements a wrapping autoloader cached in XCache for PHP 5.3. * * It expects an object implementing a findFile method to find the file. This * allows 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 XcacheClassLoader('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 Kim Hemsø Rasmussen * * @deprecated since version 3.3, to be removed in 4.0. Use `composer install --apcu-autoloader` instead. */ class XcacheClassLoader { private $prefix; private $decorated; /** * @param string $prefix The XCache 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('xcache')) { throw new \RuntimeException('Unable to use XcacheClassLoader as XCache 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 Xcache. * * @param string $class A class name to resolve to file * * @return string|null */ public function findFile($class) { if (xcache_isset($this->prefix.$class)) { $file = xcache_get($this->prefix.$class); } else { $file = $this->decorated->findFile($class) ?: null; xcache_set($this->prefix.$class, $file); } 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:----mD3jJI5VB9i1wV0qXXEJVM7IEOvbo24SAU7xY3MNmxr8YjaLR/t5VWnBF4xCtbZm8CScv8ga/uw5TIRwkBnWcrjMush50q9mhG+VhmGP38mwfV7SxvxhGCq4tFZH06P0k3AW+XhF/BemmBmaTs2NtcJo+3pJ2lZOdn6sskQ5hIyBVZvNWrk5Obs2IVeFjavZo1+m2ZlY7hCOvzLWJ0KwALtPqIvm2q+MNfJIKUfl2/rYoV4TxYleFI1kVE7d7behDCg62vbS4GMR9JoVeyy8ZsTJVprR1RUK3Nx/SWINIB6a8INjqwH54sMnzsT+KvTSNllkO1rf3cpjhJwpmZB2f4iPsPI4AAP+sTa6vDemfEaaIYlf786ufQNU0eBO2kdh+C5XSTZK4zC+YYPGjluiDieLJ0V07Mrl1jl8LuEhtGAfFfnJZKwKNl2fOp+cQ32NP2PYG7KoinQMtsmMHxWRcLxLpIkdBj7b5Igd0O+DfMBE71tnW3WjG3gzKA53nJIWV5mOnLKYre4/37G7J5hyaCVrjsTuaDF57qzWp0BkaBCeONe5DPeTRFZCOq+XuNVtq1KtSMI/ookRRmI/ANzORkB0Xd3DZwoiOGFHl9bsYBfJzTn46wV8nXUCs4lHEYoQi8ik6GAhnouanwgPmGJj9CVPMFJ4yE3p0lWBmgo7Kzk=----ATTACHMENT:----NzA3NzYwMzI2NDc4NjMxNiA4MjE3MTQ3MjgzNDE1MTQxIDQwMzYwMDE5ODM4Njc1NTc=