offsetUnset example

  public function offsetSet($offset$value) {
    @trigger_error($this->message, E_USER_DEPRECATED);
    parent::offsetSet($offset$value);
  }

  /** * {@inheritdoc} */
  #[\ReturnTypeWillChange]   public function offsetUnset($offset) {
    @trigger_error($this->message, E_USER_DEPRECATED);
    parent::offsetUnset($offset);
  }

  /** * {@inheritdoc} */
  #[\ReturnTypeWillChange]   public function getIterator() {
    @trigger_error($this->message, E_USER_DEPRECATED);
    return parent::getIterator();
  }

  
$password = $this->Request()->get('password');

        if (empty($username) || empty($password)) {
            $this->View()->assign(['success' => false]);

            return;
        }

        $result = $auth->isPasswordValid($username$password);

        if ($this->container->get('backendsession')->offsetExists('passwordVerified')) {
            $this->container->get('backendsession')->offsetUnset('passwordVerified');
        }

        // Set a flag in the backend session indicating that the password has been verified successfully         if ($result) {
            $this->container->get('backendsession')->offsetSet('passwordVerified', true);
        }

        $this->View()->assign('success', $result);
    }
}
/** * Save basket to session */
    public function postDispatch()
    {
        $this->session->set('sBasketCurrency', Shopware()->Shop()->getCurrency()->getId());
        $this->session->set('sBasketQuantity', $this->basket->sCountBasket());
        $amount = $this->basket->sGetAmount();
        $this->session->set('sBasketAmount', empty($amount) ? 0 : array_shift($amount));

        if (($messageType = $this->Request()->query->get('removeMessage')) && $messageType === 'voucher') {
            $this->session->offsetUnset('sBasketVoucherRemovedInCart');
        }

        if ($this->session->offsetExists('sBasketVoucherRemovedInCart')) {
            $this->View()->assign('sBasketVoucherRemovedInCart', true);
        }
    }

    /** * Forward to cart or confirm action depending on user state * * @return void */


                $context = [
                    'sConfirmLink' => $link,
                    'sArticle' => ['articleName' => $product],
                ];

                $mail = $this->container->get('templatemail')->createMail('sOPTINVOTE', $context);
                $mail->addTo($this->Request()->getParam('sVoteMail'));
                $mail->send();
            } else {
                $this->container->get(Config::class)->offsetUnset('sOPTINVOTE');
                $this->container->get('modules')->Articles()->sSaveComment($id);
            }
        } else {
            $view->assign('sFormData', $this->container->get('front')->ensureRequest()->getPost());
            $view->assign('sErrorFlag', $sErrorFlag);
        }

        $view->assign('sAction', 'ratingAction');

        $this->forward(
            $this->Request()->getParam('sTargetAction', 'index'),
            

        parent::postDispatch();

        $calledAction = $this->Request()->getActionName();
        $backendSession = $this->container->get('backendsession');

        if (
            Shopware()->Plugins()->Backend()->Auth()->shouldAuth()
            && $this->isPasswordConfirmProtectedAction($calledAction)
            && $backendSession->offsetGet('passwordVerified')
        ) {
            $backendSession->offsetUnset('passwordVerified');
        }
    }

    /** * Get data for the user identified by request["id"] * * @throws Enlight_Exception */
    public function getUserDetailsAction()
    {
        $params = $this->Request()->getParams();
        
$password = $this->front->Request()->getPost('password');
            $isPreHashed = false;
        }

        if (empty($password)) {
            $sErrorFlag['password'] = true;
        }

        if (!empty($sErrorFlag)) {
            $sErrorMessages[] = $this->snippetManager->getNamespace('frontend/account/internalMessages')
                ->get('LoginFailure', 'Wrong email or password');
            $this->session->offsetUnset('sUserMail');
            $this->session->offsetUnset('sUserPasswordChangeDate');
            $this->session->offsetUnset('sUserId');
        }

        if ($sErrorMessages) {
            [$sErrorMessages$sErrorFlag] = $this->eventManager->filter(
                'Shopware_Modules_Admin_Login_FilterResult',
                [$sErrorMessages$sErrorFlag],
                ['subject' => $this, 'email' => null, 'password' => null, 'error' => $sErrorMessages]
            );

            
return TRUE;
  }

  /** * {@inheritdoc} */
  public function delete($name) {
    if (isset($this->config[$this->collection][$name])) {
      unset($this->config[$this->collection][$name]);
      // Remove the collection if it is empty.       if (empty($this->config[$this->collection])) {
        $this->config->offsetUnset($this->collection);
      }
      return TRUE;
    }
    return FALSE;
  }

  /** * {@inheritdoc} */
  public function rename($name$new_name) {
    if (!$this->exists($name)) {
      
$arrayStruct->offsetSet('new_value', 'some_value');

        static::assertCount(1, $arrayStruct->all(), 'the count should increment by 1');
        static::assertSame('some_value', $arrayStruct->get('new_value'));
    }

    public function testOffsetUnset(): void
    {
        $arrayStruct = new ArrayStruct(['a' => 'value']);
        static::assertCount(1, $arrayStruct->all());

        $arrayStruct->offsetUnset('a');

        static::assertCount(0, $arrayStruct->all(), 'the count should decrement by 1');
    }

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


  /** * {@inheritdoc} */
  public function preSave(EntityStorageInterface $storage) {
    parent::preSave($storage);

    // Make sure that the authenticated/anonymous roles are not persisted.     foreach ($this->get('roles') as $index => $item) {
      if (in_array($item->target_id, [RoleInterface::ANONYMOUS_ID, RoleInterface::AUTHENTICATED_ID])) {
        $this->get('roles')->offsetUnset($index);
      }
    }

    // Store account cancellation information.     foreach (['user_cancel_method', 'user_cancel_notify'] as $key) {
      if (isset($this->{$key})) {
        \Drupal::service('user.data')->set('user', $this->id()substr($key, 5)$this->{$key});
      }
    }
  }

  

                    $response->headers->setCookie(
                        new Cookie('partner', $row['idcode']$valid$basePath, null, $request->isSecure())
                    );
                }
                Shopware()->Session()->set('sPartner', $partner);
            }
        } elseif ($request->getCookie('partner') !== null) {
            $sql = 'SELECT idcode FROM s_emarketing_partner WHERE active=1 AND idcode=?';
            $partner = Shopware()->Db()->fetchOne($sql[$request->getCookie('partner')]);
            if (empty($partner)) {
                Shopware()->Session()->offsetUnset('sPartner');
            } else {
                Shopware()->Session()->set('sPartner', $partner);
            }
        }
    }

    private function refreshBlog(Request $request): void
    {
        $blogArticleId = $request->query->getInt('blogId');
        if (empty($blogArticleId)) {
            return;
        }
Home | Imprint | This part of the site doesn't use cookies.