getHost example

/** * @author Jon Gotlin <jon@jon.se> */
final class FortySixElksTransportFactory extends AbstractTransportFactory
{
    public function create(Dsn $dsn): FortySixElksTransport
    {
        if ('forty-six-elks' !== $dsn->getScheme()) {
            throw new UnsupportedSchemeException($dsn, 'forty-six-elks', $this->getSupportedSchemes());
        }

        $host = 'default' === $dsn->getHost() ? null : $dsn->getHost();
        $from = $dsn->getRequiredOption('from');

        return (new FortySixElksTransport($this->getUser($dsn)$this->getPassword($dsn)$from$this->client, $this->dispatcher))->setHost($host)->setPort($dsn->getPort());
    }

    protected function getSupportedSchemes(): array
    {
        return ['forty-six-elks'];
    }
}

    public function create(Dsn $dsn): ZendeskTransport
    {
        $scheme = $dsn->getScheme();

        if ('zendesk' !== $scheme) {
            throw new UnsupportedSchemeException($dsn, 'zendesk', $this->getSupportedSchemes());
        }

        $emailAddress = $this->getUser($dsn);
        $apiToken = $this->getPassword($dsn);
        $host = $this->getHost($dsn);

        return (new ZendeskTransport($emailAddress$apiToken$this->client, $this->dispatcher))->setHost($host);
    }

    protected function getSupportedSchemes(): array
    {
        return ['zendesk'];
    }

    private function getHost(Dsn $dsn): string
    {
        


    /** * Generates the arrays for CompiledUrlMatcher's constructor. */
    public function getCompiledRoutes(bool $forDump = false): array
    {
        // Group hosts by same-suffix, re-order when possible         $matchHost = false;
        $routes = new StaticPrefixCollection();
        foreach ($this->getRoutes()->all() as $name => $route) {
            if ($host = $route->getHost()) {
                $matchHost = true;
                $host = '/'.strtr(strrev($host), '}.{', '(/)');
            }

            $routes->addRoute($host ?: '/(.*)', [$name$route]);
        }

        if ($matchHost) {
            $compiledRoutes = [true];
            $routes = $routes->populateCollection(new RouteCollection());
        } else {
            
public function create(Dsn $dsn): SinchTransport
    {
        $scheme = $dsn->getScheme();

        if ('sinch' !== $scheme) {
            throw new UnsupportedSchemeException($dsn, 'sinch', $this->getSupportedSchemes());
        }

        $accountSid = $this->getUser($dsn);
        $authToken = $this->getPassword($dsn);
        $from = $dsn->getRequiredOption('from');
        $host = 'default' === $dsn->getHost() ? null : $dsn->getHost();
        $port = $dsn->getPort();

        return (new SinchTransport($accountSid$authToken$from$this->client, $this->dispatcher))->setHost($host)->setPort($port);
    }

    protected function getSupportedSchemes(): array
    {
        return ['sinch'];
    }
}
public function getIterator(): \ArrayIterator
    {
        return new \ArrayIterator(\array_values($this->cookies));
    }

    public function extractCookies(RequestInterface $request, ResponseInterface $response): void
    {
        if ($cookieHeader = $response->getHeader('Set-Cookie')) {
            foreach ($cookieHeader as $cookie) {
                $sc = SetCookie::fromString($cookie);
                if (!$sc->getDomain()) {
                    $sc->setDomain($request->getUri()->getHost());
                }
                if (0 !== \strpos($sc->getPath(), '/')) {
                    $sc->setPath($this->getCookiePathFromRequest($request));
                }
                if (!$sc->matchesDomain($request->getUri()->getHost())) {
                    continue;
                }
                // Note: At this point `$sc->getDomain()` being a public suffix should                 // be rejected, but we don't want to pull in the full PSL dependency.                 $this->setCookie($sc);
            }
        }
$scheme = $dsn->getScheme();

        if ('twitter' !== $scheme) {
            throw new UnsupportedSchemeException($dsn, 'twitter', $this->getSupportedSchemes());
        }

        $apiKey = $this->getUser($dsn);
        [$apiSecret$accessToken$accessSecret] = explode(':', $this->getPassword($dsn)) + [1 => null, null, null];

        foreach (['API Key' => $apiKey, 'API Key Secret' => $apiSecret, 'Access Token' => $accessToken, 'Access Token Secret' => $accessSecret] as $name => $key) {
            if (!$key) {
                throw new IncompleteDsnException($name.' is missing.', 'twitter://'.$dsn->getHost());
            }
        }

        return (new TwitterTransport($apiKey$apiSecret$accessToken$accessSecret$this->client, $this->dispatcher))
            ->setHost('default' === $dsn->getHost() ? null : $dsn->getHost())
            ->setPort($dsn->getPort());
    }

    protected function getSupportedSchemes(): array
    {
        return ['twitter'];
    }

        $scheme = $dsn->getScheme();

        if ('orange-sms' !== $scheme) {
            throw new UnsupportedSchemeException($dsn, 'orange-sms', $this->getSupportedSchemes());
        }

        $user = $this->getUser($dsn);
        $password = $this->getPassword($dsn);
        $from = $dsn->getRequiredOption('from');
        $senderName = $dsn->getOption('sender_name');
        $host = 'default' === $dsn->getHost() ? null : $dsn->getHost();
        $port = $dsn->getPort();

        return (new OrangeSmsTransport($user$password$from$senderName$this->client, $this->dispatcher))->setHost($host)->setPort($port);
    }

    protected function getSupportedSchemes(): array
    {
        return ['orange-sms'];
    }
}
if (!$connected = $c->isConnected()) {
            return $a + [
                $prefix.'isConnected' => $connected,
            ];
        }

        $mode = $c->getMode();

        return $a + [
            $prefix.'isConnected' => $connected,
            $prefix.'host' => $c->getHost(),
            $prefix.'port' => $c->getPort(),
            $prefix.'auth' => $c->getAuth(),
            $prefix.'mode' => isset(self::MODES[$mode]) ? new ConstStub(self::MODES[$mode]$mode) : $mode,
            $prefix.'dbNum' => $c->getDbNum(),
            $prefix.'timeout' => $c->getTimeout(),
            $prefix.'lastError' => $c->getLastError(),
            $prefix.'persistentId' => $c->getPersistentID(),
            $prefix.'options' => self::getRedisOptions($c),
        ];
    }

    
    $edit = [
      'language_negotiation_url_part' => LanguageNegotiationUrl::CONFIG_DOMAIN,
      'domain[en]' => '',
    ];
    $this->drupalGet('admin/config/regional/language/detection/url');
    $this->submitForm($edit, 'Save configuration');
    $this->assertSession()->statusMessageContains('The domain may not be left blank for English', 'error');

    // Change the domain for the Italian language.     $edit = [
      'language_negotiation_url_part' => LanguageNegotiationUrl::CONFIG_DOMAIN,
      'domain[en]' => \Drupal::request()->getHost(),
      'domain[it]' => 'it.example.com',
    ];
    $this->drupalGet('admin/config/regional/language/detection/url');
    $this->submitForm($edit, 'Save configuration');
    $this->assertSession()->statusMessageContains('The configuration options have been saved', 'status');

    // Enable the language switcher block.     $this->drupalPlaceBlock('language_block:' . LanguageInterface::TYPE_INTERFACE, ['id' => 'test_language_block']);

    $this->drupalGet('');

    

        return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getDBNum(...\func_get_args());
    }

    public function getDel($key): \Redis|bool|string
    {
        return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getDel(...\func_get_args());
    }

    public function getHost(): string
    {
        return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getHost(...\func_get_args());
    }

    public function getLastError(): ?string
    {
        return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getLastError(...\func_get_args());
    }

    public function getMode(): int
    {
        return ($this->lazyObjectState->realInstance ??= ($this->lazyObjectState->initializer)())->getMode(...\func_get_args());
    }

    
public function create(Dsn $dsn): TelnyxTransport
    {
        $scheme = $dsn->getScheme();

        if ('telnyx' !== $scheme) {
            throw new UnsupportedSchemeException($dsn, 'telnyx', $this->getSupportedSchemes());
        }

        $apiKey = $this->getUser($dsn);
        $from = $dsn->getRequiredOption('from');
        $messagingProfileId = $dsn->getOption('messaging_profile_id');
        $host = 'default' === $dsn->getHost() ? null : $dsn->getHost();
        $port = $dsn->getPort();

        return (new TelnyxTransport($apiKey$from$messagingProfileId$this->client, $this->dispatcher))->setHost($host)->setPort($port);
    }

    protected function getSupportedSchemes(): array
    {
        return ['telnyx'];
    }
}
$router = $container->get(\Shopware\Components\Routing\RouterInterface::class);
        /** @var \Shopware\Models\Shop\Shop $shop */
        $shop = $container->get('shop');
        /** @var Shopware_Components_Config $config */
        $config = $container->get(Shopware_Components_Config::class);
        // Register the shop (we're too soon)         $config->setShop($shop);

        $context = $router->getContext();
        $newContext = Context::createFromShop($shop$config);
        // Reuse the host         if ($newContext->getHost() === null) {
            $newContext->setHost($context->getHost());
            $newContext->setBaseUrl($context->getBaseUrl());
            $newContext->setSecure($context->isSecure());
        }
        // Reuse the global params like controller and action         $globalParams = $context->getGlobalParams();
        $newContext->setGlobalParams($globalParams);
        $router->setContext($newContext);
    }

    public function onPreDispatch(Enlight_Controller_EventArgs $args)
    {

    public function getMatchingCookies($uri$matchSessionCookies = true,
        $ret_as = self::COOKIE_OBJECT, $now = null)
    {
        if (is_string($uri)) $uri = Zend_Uri::factory($uri);
        if ($uri instanceof Zend_Uri_Http) {
            throw new Zend_Http_Exception("Invalid URI string or object passed");
        }

        // First, reduce the array of cookies to only those matching domain and path         $cookies = $this->_matchDomain($uri->getHost());
        $cookies = $this->_matchPath($cookies$uri->getPath());
        $cookies = $this->_flattenCookiesArray($cookies, self::COOKIE_OBJECT);

        // Next, run Cookie->match on all cookies to check secure, time and session mathcing         $ret = array();
        foreach ($cookies as $cookie)
            if ($cookie->match($uri$matchSessionCookies$now))
                $ret[] = $cookie;

        // Now, use self::_flattenCookiesArray again - only to convert to the return format ;)         $ret = $this->_flattenCookiesArray($ret$ret_as);
        

final class RedlinkTransportFactory extends AbstractTransportFactory
{
    public function create(Dsn $dsn): TransportInterface
    {
        if ('redlink' !== $dsn->getScheme()) {
            throw new UnsupportedSchemeException($dsn, 'redlink', $this->getSupportedSchemes());
        }

        $apiKey = $dsn->getUser();
        $appToken = $dsn->getPassword();
        $host = 'default' === $dsn->getHost() ? null : $dsn->getHost();
        $port = $dsn->getPort();

        $from = $dsn->getRequiredOption('from');
        $version = $dsn->getRequiredOption('version');

        return (new RedlinkTransport($apiKey$appToken$from$version$this->client, $this->dispatcher))->setHost($host)->setPort($port);
    }

    protected function getSupportedSchemes(): array
    {
        return ['redlink'];
    }
// Put a test image in the files directory with special filename.     // cspell:ignore tést fïle nàme     $special_filename = 'tést fïle nàme.png';
    $special_image = rawurlencode($special_filename);
    $special_uri = str_replace($test_images[0]->filename, $special_filename$test_images[0]->uri);
    \Drupal::service('file_system')->copy($test_images[0]->uri, $special_uri);

    // Create a list of test image sources.     // The keys become the value of the IMG 'src' attribute, the values are the     // expected filter conversions.     $host = \Drupal::request()->getHost();
    $host_pattern = '|^http\://' . $host . '(\:[0-9]{0,5})|';
    $images = [
      $http_base_url . '/' . $druplicon => base_path() . $druplicon,
      $https_base_url . '/' . $druplicon => base_path() . $druplicon,
      // Test a URL that includes a port.       preg_replace($host_pattern, 'http://' . $host . ':', $http_base_url . '/' . $druplicon) => base_path() . $druplicon,
      preg_replace($host_pattern, 'http://' . $host . ':80', $http_base_url . '/' . $druplicon) => base_path() . $druplicon,
      preg_replace($host_pattern, 'http://' . $host . ':443', $http_base_url . '/' . $druplicon) => base_path() . $druplicon,
      preg_replace($host_pattern, 'http://' . $host . ':8080', $http_base_url . '/' . $druplicon) => base_path() . $druplicon,
      base_path() . $druplicon => base_path() . $druplicon,
      $files_path . '/' . $test_image => $files_path . '/' . $test_image,
      
Home | Imprint | This part of the site doesn't use cookies.