offsetGet example

$this->View()->assign(CheckoutKey::AMOUNT_TAX, $this->View()->getAssign('sBasket')[CheckoutKey::AMOUNT_TAX]);
        $this->View()->assign('sAmountNet', $this->View()->getAssign('sBasket')[CartKey::AMOUNT_NET_NUMERIC]);

        $this->View()->assign('sMinimumSurcharge', $this->getMinimumCharge());
        $this->View()->assign('sPremiums', $this->getPremiums());

        $this->View()->assign('sInquiry', $this->getInquiry());
        $this->View()->assign('sInquiryLink', $this->getInquiryLink());

        $this->View()->assign('sTargetAction', 'cart');

        $this->View()->assign('sBasketInfo', $this->session->offsetGet('sErrorMessages'));
        $this->session->offsetUnset('sErrorMessages');

        if (!\is_array($country) || !$this->isShippingAllowed((int) $country['id'])) {
            $this->View()->assign('countryNotAllowedForShipping', true);
        }
    }

    /** * Mostly equivalent to cartAction * Get user, basket and payment data for view assignment * Create temporary entry in s_order table * Check some conditions (minimum charge) * * @return void */

            [$this->_id]
        );
        if (!\is_array($positions)) {
            $positions = [];
        }
        $this->_positions = new ArrayObject($positions, ArrayObject::ARRAY_AS_PROPS);

        foreach ($this->_positions as $key => $unusedPosition) {
            $position = $this->_positions->offsetGet($key);

            $attributes = Shopware()->Db()->fetchRow(
                'SELECT * FROM s_order_details_attributes WHERE detailID = ?',
                [$position['id']]
            );
            $position['attributes'] = \is_array($attributes) ? $attributes : [];

            if (\in_array((int) $position['modus'][CartPositionsMode::PRODUCT, CartPositionsMode::PREMIUM_PRODUCT], true)) {
                $kind = (int) $position['kind'];
                $translation = $translator->read(
                    $orderLocale,
                    


    /** * Generate new secret by API call */
    private function generateApiShopSecret(): string
    {
        $allowedClassList = [
            AccessTokenStruct::class,
        ];

        $token = @unserialize(Shopware()->BackendSession()->offsetGet('store_token')['allowed_classes' => $allowedClassList]);

        if ($token === null || $token === false) {
            $token = Shopware()->BackendSession()->get('accessToken');
        }

        $params = [
            'domain' => $this->getDomain(),
        ];

        $data = $this->storeClient->doAuthGetRequest(
            $token,
            


    /** * @param string $locale * * @throws RuntimeException */
    public function updateLocaleSettings($locale)
    {
        $serviceName = 'database.dump_iterator_' . strtolower($locale);
        if ($this->container->offsetExists($serviceName)) {
            $dump = $this->container->offsetGet($serviceName);
            foreach ($dump as $row) {
                $this->connection->query($row);
            }
        }
    }
}
// Check additional rules             if ($this->sManageRisks($payValue['id'], null, $user)
                && $payValue['id'] != ($user['additional']['user']['paymentpreset'] ?? 0)
            ) {
                unset($paymentMethods[$payKey]);
            }
        }

        // If no payment is left use always the fallback payment no matter if it has any restrictions too         if (!\count($paymentMethods)) {
            $paymentMethods[] = ['id' => $this->config->offsetGet('paymentdefault')];
        }

        $paymentMethods = Shopware()->Container()->get(PaymentGatewayInterface::class)
            ->getList(array_column($paymentMethods, 'id')$this->contextService->getShopContext());

        $paymentMethods = array_map(static function D$payment) {
            return Shopware()->Container()->get(LegacyStructConverter::class)->convertPaymentStruct($payment);
        }$paymentMethods);

        return $this->eventManager->filter(
            'Shopware_Modules_Admin_GetPaymentMeans_DataFilter',
            

    public function preDispatch()
    {
        parent::preDispatch();

        $calledAction = $this->Request()->getActionName();

        if (Shopware()->Plugins()->Backend()->Auth()->shouldAuth()
            && $this->isPasswordConfirmProtectedAction($calledAction)
            && !$this->container->get('backendsession')->offsetGet('passwordVerified')
        ) {
            $this->forward('passwordConfirmationRequired');
        }
    }

    /** * Displays a JSON string indicating failure for password confirmation */
    public function passwordConfirmationRequiredAction()
    {
        $this->Front()->Plugins()->Json()->setRenderer();

        
$this->validateField('phone', $address->getPhone()$this->getPhoneConstraints());
        $this->validateField('additionalAddressLine1', $address->getAdditionalAddressLine1()$this->getAdditionalAddressline1Constraints());
        $this->validateField('additionalAddressLine2', $address->getAdditionalAddressLine2()$this->getAdditionalAddressline2Constraints());

        if ($address->getCountry() && $address->getCountry()->getForceStateInRegistration()) {
            $this->validateField('state', $address->getState()[new NotBlank()]);
        }

        if ($customerType === Customer::CUSTOMER_TYPE_BUSINESS) {
            $this->validateField('company', $address->getCompany()[new NotBlank()]);

            if ($this->config->offsetGet('vatcheckrequired')) {
                $this->validateField('vatId', $address->getVatId()[new NotBlank()]);
            }
        }

        if ($this->validationContext && $this->validationContext->getViolations()->count()) {
            throw new ValidationException($this->validationContext->getViolations());
        }
    }

    /** * {@inheritdoc} */
public function testOffsetExists(array $dataSet, int|string $searchFor, bool $expectFound): void
    {
        $arrayStruct = new ArrayStruct($dataSet);
        static::assertSame($expectFound$arrayStruct->offsetExists($searchFor));
    }

    public function testOffsetGet(): void
    {
        $dataSet = ['a' => 'a', 'b' => ['b']];
        $arrayStruct = new ArrayStruct($dataSet);
        foreach ($dataSet as $offset => $value) {
            static::assertSame($arrayStruct->offsetGet($offset)$value);
        }
    }

    public function testOffsetSet(): void
    {
        $arrayStruct = new ArrayStruct([]);
        static::assertCount(0, $arrayStruct->all());

        $arrayStruct->offsetSet('new_value', 'some_value');

        static::assertCount(1, $arrayStruct->all(), 'the count should increment by 1');
        
    // bake isset() in here. See https://bugs.php.net/bug.php?id=41727.     return array_key_exists($offset$this->definition) && isset($this->definition[$offset]);
  }

  /** * {@inheritdoc} * * This is for BC support only. * @todo: Remove in https://www.drupal.org/node/1928868. */
  #[\ReturnTypeWillChange]   public function DoffsetGet($offset) {
    if (!isset($this->definition[$offset])) {
      $this->definition[$offset] = NULL;
    }
    return $this->definition[$offset];
  }

  /** * {@inheritdoc} * * This is for BC support only. * @todo: Remove in https://www.drupal.org/node/1928868. */


    /** * @return array{password: string, encoder: string}|null */
    private function getUserData(): ?array
    {
        $userData = $this->modelManager->getConnection()->createQueryBuilder()
            ->select(['password', 'encoder'])
            ->from('s_user')
            ->where('id = :sUserId')
            ->setParameter('sUserId', $this->session->offsetGet('sUserId'))
            ->execute()
            ->fetch();

        if ($userData === false) {
            return null;
        }

        return $userData;
    }
}


    /** * Magic getter * * @param string $name * * @return mixed config value */
    public function __get($name)
    {
        return $this->offsetGet($name);
    }

    /** * Magic setter * * @param string $name */
    public function __set($name$value)
    {
        $this->offsetSet($name$value);
    }

    
$accountMode = (int) $customer->getAccountMode();
        $doubleOptinWithAccount = ($accountMode === 0) && $config->get('optinregister');
        $doubleOptInAccountless = ($accountMode === 1) && $config->get('optinaccountless');

        $doubleOptinRegister = $doubleOptinWithAccount || $doubleOptInAccountless;
        $shop = $context->getShop();
        $shop->addAttribute('sendOptinMail', new Attribute([
            'sendOptinMail' => $doubleOptinRegister,
        ]));

        $customer->setReferer((string) $session->offsetGet('sReferer'));
        $customer->setValidation((string) ($data['register']['personal']['sValidation'] ?? ''));
        $customer->setAffiliate((int) $session->offsetGet('sPartner'));
        $customer->setPaymentId((int) $session->offsetGet('sPaymentID'));
        $customer->setDoubleOptinRegister($doubleOptinRegister);
        $customer->setDoubleOptinConfirmDate(null);

        /** @var Enlight_Event_EventManager $eventManager */
        $eventManager = $this->get('events');

        $errors = ['occurred' => false];
        $errors = $eventManager->filter(
            
return $this->getShop()->getId();
    }

    private function getStoreFrontCurrencyId(): int
    {
        return $this->getShop()->getCurrency()->getId();
    }

    private function getStoreFrontCurrentCustomerGroupKey(): string
    {
        $session = $this->container->get('session');
        if ($session->offsetExists('sUserGroup') && $session->offsetGet('sUserGroup')) {
            return $session->offsetGet('sUserGroup');
        }

        return $this->getShop()->getCustomerGroup()->getKey();
    }

    private function getStoreFrontAreaId(): ?int
    {
        $session = $this->container->get('session');
        if ($session->offsetGet('sArea')) {
            return $session->offsetGet('sArea');
        }
'#element' => '2',
        '#parameters' => [],
        '#quantity' => '2',
        '#route_name' => '',
        '#tags' => '',
      ],
    ];
    template_preprocess_pager($variables);

    $this->assertEquals(['first', 'previous', 'pages']array_keys($variables['items']));
    /** @var \Drupal\Core\Template\AttributeString $attribute */
    $attribute = $variables['items']['pages']['2']['attributes']->offsetGet('aria-current');
    $this->assertInstanceOf(AttributeString::class$attribute);
    $this->assertEquals('Current page', $attribute->value());
  }

}
$sql_add_where[] = "(v.instock>={$this->sSettings['instock_filter']} OR (v.instock IS NULL AND d.instock>={$this->sSettings['instock_filter']}))";
        }
        if (!empty($this->sSettings['price_filter'])) {
            if ($this->sCurrency === false) {
                throw new RuntimeException('Currency could not be fetched correctly.');
            }
            $sql_add_where[] = "ROUND(CAST(IFNULL($grouppricefield,$pricefield)*(100+t.tax-IF(pd.discount IS NULL,0,pd.discount)-{$this->sCustomergroup['discount']})/100*{$this->sCurrency['factor']} AS DECIMAL(10,3)),2)>=" . $this->sSettings['price_filter'];
        }
        if (!empty($this->sSettings['own_filter']) && trim($this->sSettings['own_filter'])) {
            $sql_add_where[] = '(' . $this->sSettings['own_filter'] . ')';
        }
        if ($this->config->offsetGet('hideNoInStock')) {
            $sql_add_where[] = '( (a.laststock * v.instock >= a.laststock * v.minpurchase) OR (a.laststock * d.instock >= a.laststock * d.minpurchase) )';
        }

        $sql_add_join = implode(' ', $sql_add_join);
        if (!empty($sql_add_select)) {
            $sql_add_select = ', ' . implode(', ', $sql_add_select);
        } else {
            
Home | Imprint | This part of the site doesn't use cookies.