Execute method.

@param \Magento\Framework\Event\Observer $observer

@return $this

@SuppressWarnings(PHPMD.UnusedFormalParameter)
493206
public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $numImported = $this->contactFactory->create()
            ->getNumberOfImportedContacs();

        $updated = $this->contactResource->resetAllContacts();

        $this->helper->log(
            '-- Imported contacts: ' . $numImported
            . ' reseted :  ' . $updated . ' --'
        );

        return $this;
    }
711001
public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $order = $observer->getEvent()->getOrder();
        $incrementId = $order->getIncrementId();
        $websiteId = $this->storeManager->getStore($order->getStoreId())
            ->getWebsiteId();

        $orderSync = $this->helper->isOrderSyncEnabled($websiteId);

        if ($this->helper->isEnabled($websiteId) && $orderSync) {
            //register in queue with importer
            $this->importerFactory->create()
                ->registerQueue(
                    \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_ORDERS,
                    [$incrementId],
                    \Dotdigitalgroup\Email\Model\Importer::MODE_SINGLE_DELETE,
                    $websiteId
                );
        }

        return $this;
    }
1196050
public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $creditmemo = $observer->getEvent()->getCreditmemo();
        $storeId = $creditmemo->getStoreId();
        $order = $creditmemo->getOrder();
        $orderId = $order->getEntityId();
        $quoteId = $order->getQuoteId();

        try {
            /*
             * Reimport transactional data.
             */
            $emailOrder = $this->emailOrderFactory->create()
                ->loadByOrderId($orderId, $quoteId, $storeId);
            if (!$emailOrder->getId()) {
                $this->helper->log(
                    'ERROR Creditmemmo Order not found :'
                    . $orderId . ', quote id : ' . $quoteId . ', store id '
                    . $storeId
                );

                return $this;
            }

            $emailOrder->setEmailImported(\Dotdigitalgroup\Email\Model\Contact::EMAIL_CONTACT_NOT_IMPORTED);
            $this->orderResource->save($emailOrder);
        } catch (\Exception $e) {
            $this->helper->debug((string)$e, []);
        }

        return $this;
    }
534291
public function addComposerAutoloader(Varien_Event_Observer $observer)
    {
        if (self::$added === false) {
            /** @var Fontis_ComposerAutoloader_Helper_Data $helper */
            $helper = Mage::helper('fontis_composerautoloader');
            $helper->registerAutoloader();
            self::$added = true;
        }
    }
645155
public function attach(ObserverInterface $observer)
	{
		if ($this->isAttached($observer)) {
			return false;
		}

		$this->observers[] = $observer;

		return true;
	}
1148167
public function controllerActionPredispatch(Varien_Event_Observer $observer)
    {
        if (!$this->_getHelper()->isActive()) {
            return $this;
        }

        /* @var $controllerAction Mage_Core_Controller_Front_Action */
        $controllerAction = $observer->getControllerAction();

        $this->_getHelper()->setCurrentPage(
            strtolower($controllerAction->getFullActionName('_'))
        );
        
        $surrogateCompatibility = $controllerAction->getRequest()->getServer('HTTP_SURROGATE_CAPABILITY', '');
        
        if (strpos($surrogateCompatibility, 'ESI/') !== false) {
            $this->_getHelper()->setIsEsiAllowed(true);
        }
        
        if ($this->_getHelper()->isAllowedCurrentPage() 
            || $this->_getHelper()->getIsInternal()) {
            // Disable ?__SID=U in urls
            Mage::app()->setUseSessionVar(false);
            Mage::app()->setUseSessionInUrl(false);
        }
        
        Mage::getSingleton('ecomdev_varnish/cookie')->setRequest($controllerAction->getRequest());

        if ($token = $controllerAction->getRequest()->getParam('form_key')) {
            if ($this->_getHelper()->validateToken($token)) {
                Mage::getSingleton('core/session')->setData('_form_key', $token);
                // After we set token, it is not valid anymore for next request, so we need to generate a new one
                $this->_getHelper()->generateToken();
            }
        }

        return $this;
    }
972387
public function detach(ObserverInterface $observer): void
    {
        $key = spl_object_hash($observer);

        unset($this->observers[$key]);
    }
247870
public function execute(Observer $observer)
    {
        // Get the order
        $order = $observer->getEvent()->getOrder();

        // Get the method id
        $methodId = $order->getPayment()->getMethodInstance()->getCode();

        if ($this->backendAuthSession->isLoggedIn() && $methodId == 'checkout_com_admin_method') {



        }
        
        return $this;
    }
850173
public function detach($observer)
	{
		$retval = false;

		$key = array_search($observer, $this->_observers);

		if ($key !== false)
		{
			unset($this->_observers[$key]);
			$retval = true;

			foreach ($this->_methods as &$method)
			{
				$k = array_search($key, $method);

				if ($k !== false)
				{
					unset($method[$k]);
				}
			}
		}

		return $retval;
	}
681550
public function registerObserver(Garp_Util_Observer $observer, $name = false) {
        $name = $name ?: $observer->getName();
        $this->_observers[$name] = $observer;
        return $this;
    }
753912
public function execute(\Magento\Framework\Event\Observer $observer)
    {
        if (!$this->redirect->isAllowed()) {
            $this->session->unsetScript();

            return;
        }

        foreach ($this->getRedirects() as $redirect) {
            $redirect->run();
        }
    }
841472
public function attach(ObserverInterface $observer): SubjectInterface
    {
        $this->__construct();
        parent::attach($observer);
        return $this;
    }
1299785
public function execute(Observer $observer)
    {
        /** @var Layout $layout */
        if (!$layout = $observer->getData('layout')) {
            return;
        }

        if (!$update = $layout->getUpdate()) {
            return;
        }

        # Set footer - Applied to all pages
        $update->addHandle($this->_getFooterHandleName());

        # Set header - Applied to all pages
        $update->addHandle($this->_getHeaderHandleName());

        # Set footer - Applied product list pages only
        if ($this->_shouldApplyProductListItemHandle()) {
            $update->addHandle($this->_getProductListItemHandleName());
        }

        # Temporary until we have a banners module
        # Adds the banner handle only when at the home page
        if ($this->_shouldApplyBannerHandle()) {
            $update->addHandle($this->_getBannerHandleName());
        }

        # In all pages, add the theme customization AFTER all of the above
        $update->addHandle(self::THEME_CUSOMIZATION_HANDLE_NAME);
    }
1055960
public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $productCollection = $observer->getEvent()->getData('product_collection');
        $storeId           = $observer->getEvent()->getData('store_id');

        if (($productCollection instanceof \Magento\Catalog\Model\ResourceModel\Product\Collection) && $storeId) {
            $this->logEvent($productCollection, $storeId);
        }
    }
148263
public function setObserverType($observerType)
    {
        $allowedValues = $this->getObserverTypeAllowableValues();
        if (!in_array($observerType, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'observerType', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['observerType'] = $observerType;

        return $this;
    }
507611
public function execute(Observer $observer) {
        // Get the order
        $order = $observer->getEvent()->getOrder();

        // Get 3D Secure setting
        $is3ds = (int) $this->gatewayConfig->isVerify3DSecure();

        // Force the order status to what is in config for Frames only
        if ($is3ds == 1 && $order->getPayment()->getMethod() == 'checkout_com') {
            // Update order status
            $order->setStatus($this->gatewayConfig->getNewOrderStatus());
        }

        return $this;
    }
922058
protected function validateObserver($observer): bool
    {
        return !$this->isDisable($observer)
            && (new ReflectionClass($observer))->implementsInterface(EventHandlerInterface::class)
            && $this->accessible($observer);
    }