getDomain example

/** @var string $version */
        $version = $input->getOption('shopware-version');
        if (empty($version)) {
            $version = $this->container->getParameter('shopware.release.version');

            if (!\is_string($version)) {
                throw new RuntimeException('Parameter shopware.release.version has to be an string');
            }
        }

        $plugins = $this->container->get(\Shopware\Bundle\PluginInstallerBundle\Service\PluginLocalService::class)->getPluginsForUpdateCheck();
        $domain = $this->container->get('shopware_plugininstaller.account_manager_service')->getDomain();
        $service = $this->container->get('shopware_plugininstaller.plugin_service_view');
        $request = new UpdateListingRequest('', $version$domain$plugins);
        /** @var UpdateResultStruct $updates */
        $updates = $service->getUpdates($request);
        $plugins = $updates->getPlugins();

        $result = [];
        foreach ($plugins as $plugin) {
            $result[] = [
                $plugin->getId(),
                $plugin->getTechnicalName(),
                


        $prefix = $prefix ?: Cookie::setDefaults()['prefix']; // to retain BC
        $prefixed = $prefix . $name;
        $store    = $this->cookieStore;
        $found    = false;

        /** @var Cookie $cookie */
        foreach ($store as $cookie) {
            if ($cookie->getPrefixedName() === $prefixed) {
                if ($domain !== $cookie->getDomain()) {
                    continue;
                }

                if ($path !== $cookie->getPath()) {
                    continue;
                }

                $cookie = $cookie->withValue('')->withExpired();
                $found  = true;

                $this->cookieStore = $store->put($cookie);
                
$container = $this->getContainer();
        $container->get('security.untracked_token_storage')->setToken($token);

        if (!$container->has('session.factory')) {
            return $this;
        }

        $session = $container->get('session.factory')->createSession();
        $session->set('_security_'.$firewallContextserialize($token));
        $session->save();

        $domains = array_unique(array_map(fn (Cookie $cookie) => $cookie->getName() === $session->getName() ? $cookie->getDomain() : '', $this->getCookieJar()->all())) ?: [''];
        foreach ($domains as $domain) {
            $cookie = new Cookie($session->getName()$session->getId(), null, null, $domain);
            $this->getCookieJar()->set($cookie);
        }

        return $this;
    }

    /** * @param Request $request */
    

    }

    /** * @throws Exception * * @return MetaStruct */
    public function getMetaInformation(MetaRequest $request)
    {
        $params = [
            'domain' => $request->getDomain(),
            'technicalName' => $request->getTechnicalName(),
            'shopwareVersion' => $request->getVersion(),
        ];

        if ($request->getToken()) {
            $result = $this->storeClient->doAuthGetRequestRaw(
                $request->getToken(),
                '/pluginFiles/' . $request->getTechnicalName() . '/data',
                $params
            );
        } else {
            
/** * @throws Exception * * @return UpdateResultStruct */
    public function getUpdates(UpdateListingRequest $context)
    {
        $result = $this->storeClient->doGetRequest(
            '/pluginStore/updateablePlugins',
            [
                'shopwareVersion' => $context->getShopwareVersion(),
                'domain' => $context->getDomain(),
                'locale' => $context->getLocale(),
                'plugins' => $context->getPlugins(),
            ]
        );

        $plugins = $this->hydrator->hydrateStorePlugins($result['data']);
        $gtcAcceptanceRequired = isset($result['gtcAcceptanceRequired']) ? $result['gtcAcceptanceRequired'] : false;
        $result = new UpdateResultStruct($plugins$gtcAcceptanceRequired);

        return $result;
    }

    


    public function __invoke(WarmUpMessage $message): void
    {
        if ($this->cacheIdLoader->load() !== $message->getCacheId()) {
            return;
        }

        $kernel = $this->createHttpCacheKernel($message->getCacheId());

        foreach ($message->getParameters() as $parameters) {
            $url = rtrim($message->getDomain(), '/') . $this->router->generate($message->getRoute()$parameters);

            $request = $this->requestTransformer->transform(Request::create($url));

            $kernel->handle($request);

            // the cache tag collection, collects all cache tags for a single request,             // after the request handled, the collection has to be reset for the next request             $this->cacheTagCollection->reset();
        }
    }

    
static::assertCount(1, $apps);
        /** @var AppEntity $appEntity */
        $appEntity = $apps->first();
        static::assertNotNull($appEntity);
        static::assertEquals('withConfig', $appEntity->getName());
        static::assertTrue($appEntity->isConfigurable());

        $systemConfigService = $this->getContainer()->get(SystemConfigService::class);
        static::assertEquals([
            'withConfig.config.email' => 'no-reply@shopware.de',
        ]$systemConfigService->getDomain('withConfig.config'));
    }

    public function testInstallThrowsIfConfigContainsComponentElement(): void
    {
        $manifest = Manifest::createFromXmlFile(__DIR__ . '/_fixtures/withInvalidConfig/manifest.xml');

        static::expectException(AppException::class);
        static::expectExceptionMessage('Configuration of app "withInvalidConfig" is invalid');
        $this->appLifecycle->install($manifest, true, $this->context);
    }

    

    public function addCookie($cookie$ref_uri = null, $encodeValue = true)
    {
        if (is_string($cookie)) {
            $cookie = Zend_Http_Cookie::fromString($cookie$ref_uri$encodeValue);
        }

        if ($cookie instanceof Zend_Http_Cookie) {
            $domain = $cookie->getDomain();
            $path = $cookie->getPath();
            if (isset($this->cookies[$domain])) $this->cookies[$domain] = array();
            if (isset($this->cookies[$domain][$path])) $this->cookies[$domain][$path] = array();
            $this->cookies[$domain][$path][$cookie->getName()] = $cookie;
            $this->_rawCookies[] = $cookie;
        } else {
            throw new Zend_Http_Exception('Supplient argument is not a valid cookie string or object');
        }
    }

    /** * Parse an HTTP response, adding all the cookies set in that response * to the cookie jar. * * @param Zend_Http_Response $response * @param Zend_Uri_Http|string $ref_uri Requested URI * @param boolean $encodeValue */
$request->setSession($session);
        $response = new Response();
        $listener->onKernelResponse(new ResponseEvent($kernel$request, HttpKernelInterface::MAIN_REQUEST, $response));

        $cookies = $response->headers->getCookies();

        if ($sessionOptions['use_cookies'] ?? true) {
            $this->assertCount(1, $cookies);
            $this->assertSame('PHPSESSID', $cookies[0]->getName());
            $this->assertSame('123456', $cookies[0]->getValue());
            $this->assertSame($expectedSessionOptions['cookie_path']$cookies[0]->getPath());
            $this->assertSame($expectedSessionOptions['cookie_domain']$cookies[0]->getDomain());
            $this->assertSame($expectedSessionOptions['cookie_secure']$cookies[0]->isSecure());
            $this->assertSame($expectedSessionOptions['cookie_httponly']$cookies[0]->isHttpOnly());
            $this->assertSame($expectedSessionOptions['cookie_samesite']$cookies[0]->getSameSite());
        } else {
            $this->assertCount(0, $cookies);
        }
    }

    public static function provideSessionOptions(): \Generator
    {
        yield 'set_samesite_by_php' => [
            

    public function getCookies()
    {
        $cookies = [];

        foreach ($this->headers->getCookies() as $cookie) {
            $data = [
                'name' => $cookie->getName(),
                'value' => $cookie->getValue(),
                'expire' => $cookie->getExpiresTime(),
                'path' => $cookie->getPath(),
                'domain' => $cookie->getDomain(),
                'secure' => $cookie->isSecure(),
                'httpOnly' => $cookie->isHttpOnly(),
            ];

            $cookies[$cookie->getName() . '-' . $cookie->getPath()] = $data;

            if ($cookie->getPath() === '/') {
                $cookies[$cookie->getName() . '-'] = $data;
            }
        }

        


    /** * @return void */
    public function metaDownloadAction()
    {
        try {
            $request = new MetaRequest(
                $this->Request()->getParam('technicalName'),
                $this->getVersion(),
                $this->getDomain(),
                $this->getAccessToken()
            );

            $result = $this->get('shopware_plugininstaller.plugin_download_service')->getMetaInformation($request);
            $this->get('backendsession')->offsetSet('plugin_manager_meta_download', $result);
        } catch (Exception $e) {
            $this->handleException($e);

            return;
        }

        


    /** * @return \Shopware\Components\HttpClient\Response */
    public function updateLicences(UpdateLicencesRequest $request)
    {
        $response = $this->storeClient->doAuthPostRequestRaw(
            $request->getToken(),
            '/licenseupgrades/simple',
            [
                'domain' => $request->getDomain(),
                'shopwareVersion' => $request->getShopwareVersion(),
                'locale' => $request->getLocale(),
            ]
        );

        return $response;
    }

    /** * function to get expired and soon expiring plugins * * @return PluginInformationStruct[] */
if ($domain === '') {
            throw RoutingException::missingRequestParameter('domain');
        }

        $salesChannelId = $request->query->get('salesChannelId');
        if (!\is_string($salesChannelId)) {
            $salesChannelId = null;
        }

        $inherit = $request->query->getBoolean('inherit');

        $values = $this->systemConfig->getDomain($domain$salesChannelId$inherit);
        if (empty($values)) {
            $json = '{}';
        } else {
            $json = json_encode($values, \JSON_PRESERVE_ZERO_FRACTION);
        }

        return new JsonResponse($json, 200, [], true);
    }

    #[Route(path: '/api/_action/system-config', name: 'api.action.core.save.system-config', defaults: ['_acl' => ['system_config:update', 'system_config:create', 'system_config:delete']], methods: ['POST'])]     public function saveConfiguration(Request $request): JsonResponse
    {
$maxAge = $this->getMaxAge();
        if ($maxAge !== null) {
            $fieldValue .= '; Max-Age=' . $maxAge;
        }

        $expires = $this->getExpires();
        if ($expires) {
            $fieldValue .= '; Expires=' . $expires;
        }

        $domain = $this->getDomain();
        if ($domain) {
            $fieldValue .= '; Domain=' . $domain;
        }

        $path = $this->getPath();
        if ($path) {
            $fieldValue .= '; Path=' . $path;
        }

        if ($this->isSecure()) {
            $fieldValue .= '; Secure';
        }

        $cookie = new Cookie('foo', 'bar', 0);
        $this->assertEquals('/', $cookie->getPath(), '->getPath() returns / is no path is defined');

        $cookie = new Cookie('foo', 'bar', 0, '/foo');
        $this->assertEquals('/foo', $cookie->getPath(), '->getPath() returns the cookie path');
    }

    public function testGetDomain()
    {
        $cookie = new Cookie('foo', 'bar', 0, '/', 'foo.com');
        $this->assertEquals('foo.com', $cookie->getDomain(), '->getDomain() returns the cookie domain');
    }

    public function testIsSecure()
    {
        $cookie = new Cookie('foo', 'bar');
        $this->assertFalse($cookie->isSecure(), '->isSecure() returns false if not defined');

        $cookie = new Cookie('foo', 'bar', 0, '/', 'foo.com', true);
        $this->assertTrue($cookie->isSecure(), '->isSecure() returns the cookie secure flag');
    }

    
Home | Imprint | This part of the site doesn't use cookies.