getProxy example

$this->multi = new AmpClientState($clientConfigurator$maxHostConnections$maxPendingPushes$this->logger);
    }

    /** * @see HttpClientInterface::OPTIONS_DEFAULTS for available options */
    public function request(string $method, string $url, array $options = []): ResponseInterface
    {
        [$url$options] = self::prepareRequest($method$url$options$this->defaultOptions);

        $options['proxy'] = self::getProxy($options['proxy']$url$options['no_proxy']);

        if (null !== $options['proxy'] && !class_exists(Http1TunnelConnector::class)) {
            throw new \LogicException('You cannot use the "proxy" option as the "amphp/http-tunnel" package is not installed. Try running "composer require amphp/http-tunnel".');
        }

        if ($options['bindto']) {
            if (str_starts_with($options['bindto'], 'if!')) {
                throw new TransportException(__CLASS__.' cannot bind to network interfaces, use e.g. CurlHttpClient instead.');
            }
            if (str_starts_with($options['bindto'], 'host!')) {
                $options['bindto'] = substr($options['bindto'], 5);
            }

    private function loadModule(string $name): void
    {
        if ($name === 'sSystem') {
            $this->modules_container[$name] = $this->system;

            return;
        }

        Shopware()->Hooks()->setAlias($name$name);
        $proxy = Shopware()->Hooks()->getProxy($name);
        $this->modules_container[$name] = new $proxy();
        if (property_exists($this->modules_container[$name], 'sSYSTEM')) {
            $this->modules_container[$name]->sSYSTEM = $this->system;
        }
    }
}


        $context = stream_context_create($context['notification' => $notification]);

        $resolver = static function D$multi) use ($context$options$url, &$info$onProgress) {
            [$host$port] = self::parseHostPort($url$info);

            if (!isset($options['normalized_headers']['host'])) {
                $options['headers'][] = 'Host: '.$host.$port;
            }

            $proxy = self::getProxy($options['proxy']$url$options['no_proxy']);

            if (!self::configureHeadersAndProxy($context$host$options['headers']$proxy, 'https:' === $url['scheme'])) {
                $ip = self::dnsResolve($host$multi$info$onProgress);
                $url['authority'] = substr_replace($url['authority']$ip, -\strlen($host) - \strlen($port), \strlen($host));
            }

            return [self::createRedirectResolver($options$host$port$proxy$info$onProgress)implode('', $url)];
        };

        return new NativeResponse($this->multi, $contextimplode('', $url)$options$info$resolver$onProgress$this->logger);
    }

    
$class = \get_called_class();
        }

        if (\is_object($class)) {
            $class = \get_class($class);
        } elseif (!class_exists($class)) {
            throw new Enlight_Exception(sprintf('Class "%s" does not exist and could not be loaded', $class));
        }

        $classImplements = class_implements($class);
        if (\is_array($classImplements) && \in_array(Enlight_Hook::class$classImplements, true)) {
            $class = Shopware()->Hooks()->getProxy($class);
        }

        return $class;
    }

    /** * Returns a class instance. If the class is already initialed the existing instance will returned. * Otherwise the class will be initialed with the given arguments. * * @template TClass of (Enlight_Class|object) * * @param class-string<TClass>|null $class * @param array<mixed>|null $args * * @throws \ReflectionException * * @return TClass */

    }

    /** * Returns the proxy for the given class. If the Enlight_Hook_ProxyFactory hasn't * already instantiated it, the function instantiates it automatically. * * @param class-string $class */
    public function getProxy($class)
    {
        return $this->getProxyFactory()->getProxy($class);
    }

    /** * Checks if a proxy exists for the given class. * * @param class-string $class * * @return bool */
    public function hasProxy($class)
    {
        
$class = $path;
            $path = null;
        }

        if (!\is_object($class)) {
            try {
                Shopware()->Loader()->loadClass($class$path);
            } catch (Exception $e) {
                throw new Enlight_Exception(sprintf('Controller "%s" could not be loaded', $class));
            }

            $proxy = Shopware()->Hooks()->getProxy($class);

            /** @var Enlight_Controller_Action $controller */
            $controller = new $proxy();
        } else {
            /** @var Enlight_Controller_Action $controller */
            $controller = $class;
        }

        if ($controller instanceof ContainerAwareInterface) {
            $container = Shopware()->Container();
            $controller->setContainer($container);
        }


namespace Shopware\Components\DependencyInjection;

use Enlight_Hook_HookManager;

class ProxyFactory
{
    public static function getProxy(Enlight_Hook_HookManager $hookManager$className, array $arguments)
    {
        $proxy = $hookManager->getProxy($className);

        return new $proxy(...$arguments);
    }
}
private function createRepository(EntityManagerInterface $entityManager$entityName)
    {
        $metadata = $entityManager->getClassMetadata($entityName);

        /** @var class-string<ObjectRepository<TEntityClass>>|null $repositoryClassName */
        $repositoryClassName = $metadata->customRepositoryClassName;
        if ($repositoryClassName === null) {
            $repositoryClassName = $entityManager->getConfiguration()->getDefaultRepositoryClassName();
        }

        /** @var class-string<ObjectRepository<TEntityClass>> $repositoryClassName */
        $repositoryClassName = $this->hookManager->getProxy($repositoryClassName);

        return new $repositoryClassName($entityManager$metadata);
    }
}
Home | Imprint | This part of the site doesn't use cookies.