Delete partial payment registry data before quote deletion.

@param $subject
@param \Magento\Quote\Api\Data\CartInterface $quote
@return array

@SuppressWarnings(PHPMD.UnusedFormalParameter)
507758
public function beforeDelete(
        $subject,
        \Magento\Quote\Api\Data\CartInterface $quote
    ) {
        $quoteId = $quote->getId();
        $this->daoPartialQuote->deleteById($quoteId);
        return [$quote];
    }
331199
public static function getStoreKey($subjectModel, $alias) {
        if ($subjectModel == $alias) {
            $subjectModel .= '1';
            $alias .= '2';
        }
        $models = array($subjectModel, $alias);
        sort($models);
        $key = implode('.', $models);
        return $key;
    }
1048265
public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null)
    {
        $this->_logger->debug("isAvaliable Payapi");

        if (!$this->getConfigData('payapi_api_key') || !$this->getConfigData('payapi_public_id')) {
            return false;
        }

        return parent::isAvailable($quote);
    }
848396
private function replaceMatches($type, $pattern, $subject, $responseBody)
    {
        $matches = [];

        $matchCount = preg_match_all(
            $pattern,
            $subject,
            $matches
        );

        if ($matchCount > 0) {
            // we don't need full matches
            unset($matches[0]);
            $responseBody = $this->replaceMatchesInBody($matches, $type, $responseBody);
        }

        return $responseBody;
    }
397644
def delete(self, subject):
        
        session = subject.get_session(False)
        if (session):
            session.remove_internal_attribute(self.dsc_ask)
            session.remove_internal_attribute(self.dsc_isk)
1066060
private function removePatternPropertiesFromSubject(array $subject, array $schema): array
    {
        if (isset($schema['patternProperties']) && \is_array($schema['patternProperties'])) {
            $patterns = \array_keys($schema['patternProperties']);
            $propertyNames = \array_keys($subject);

            foreach ($patterns as $pattern) {
                foreach ($propertyNames as $propertyName) {
                    if (\preg_match(sprintf('/%s/', $pattern), $propertyName)) {
                        unset($subject[$propertyName]);
                    }
                }
            }
        }
        return $subject;
    }
905379
public function subject($subject = null)
    {
        if ($subject !== null) {
            $this->_subject = $subject;

            return $this;
        }

        return $this->_subject;
    }
807339
protected function encryptRequestData(
        QuoteTransfer $quoteTransfer,
        ComputopApiHeaderPaymentTransfer $computopApiHeaderPayment
    ): array {
        $computopApiPaymentTransfer = $this->getComputopPaymentTransfer($quoteTransfer, $computopApiHeaderPayment);

        return $this->computopApiService->getEncryptedArray(
            $this->getDataSubArray($computopApiPaymentTransfer),
            $this->config->getBlowfishPass()
        );
    }
644681
public function beforeEntityDelete($entity, &$idx)
    {
        $this->undeleteReasons = [];

        $entityMetadata = $this->em->getClassMetadata(get_class($entity));

        $associations = $entityMetadata->getAssociationMappings();

        foreach ($associations as $association) {
            if (in_array('remove', $association['cascade'])) {
                continue; // Skip of cascading enabled
            }

            if (!in_array($association['type'], [ClassMetadata::ONE_TO_MANY])) {
                continue; // Handling only _TO_MANY relations
            }

            $propertyAccessor = new PropertyAccessor();
            $associationData = $propertyAccessor->getValue($entity, $association['fieldName']);

            if ($associationData instanceof Collection) {
                if ($associationData->count() > 0) {
                    $this->removeFromIdsArray($entityMetadata->getIdentifierValues($entity), $idx, $association);
                }
            } elseif ($associationData !== null) {
                $this->removeFromIdsArray($entityMetadata->getIdentifierValues($entity), $idx, $association);
            }
        }

        return $this->undeleteReasons;
    }
297631
private function deleteRedundantQuotes($quote)
    {
        $connection = $this->resourceConnection->getConnection();

        // get table name with prefix
        $tableName = $this->resourceConnection->getTableName('quote');

        $sql = "DELETE FROM {$tableName} WHERE bolt_parent_quote_id = :bolt_parent_quote_id AND entity_id != :entity_id";
        $bind = [
            'bolt_parent_quote_id' => $quote->getBoltParentQuoteId(),
            'entity_id' => $quote->getBoltParentQuoteId()
        ];

        $connection->query($sql, $bind);
    }
555283
public function beforeDispatch(
        \Magento\Framework\App\FrontControllerInterface $subject,
        \Magento\Framework\App\RequestInterface $request
    ) {
        $code = $request->getParam(static::REQ_REFERRAL);
        if (!empty($code)) {
            $this->session->logout();
        }
        $this->hlpRefCode->processHttpRequest($code);
    }
267399
public static function delete(
        int $cashRegisterId,
        string $tabUuid,
        int $tabItemShopId,
        int $monetaryAccountId = null,
        array $customHeaders = []
    ): BunqResponseNull {
        $apiClient = new ApiClient(static::getApiContext());
        $responseRaw = $apiClient->delete(
            vsprintf(
                self::ENDPOINT_URL_DELETE,
                [
                    static::determineUserId(),
                    static::determineMonetaryAccountId($monetaryAccountId),
                    $cashRegisterId,
                    $tabUuid,
                    $tabItemShopId,
                ]
            ),
            $customHeaders
        );

        return BunqResponseNull::castFromBunqResponse(
            new BunqResponse(null, $responseRaw->getHeaders())
        );
    }
80621
private function resolveSubject(Subject $part)
    {
        $subject = $part->getSubject();
        foreach ($part->getParameters() as $search => $replace) {
            $subject = str_replace($search, $replace, $subject);
        }

        return $subject;
    }
388317
public function decorate($subject)
    {
        foreach ($subject as $key => $atom) {
            $subject[$key] = $this->autoPresenter->decorate($atom);
        }

        return $subject;
    }
209132
public function isValidJsonpCallback($subject)
    {
        $identifier_syntax
          = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u';

        $reserved_words = array('break', 'do', 'instanceof', 'typeof', 'case',
          'else', 'new', 'var', 'catch', 'finally', 'return', 'void', 'continue',
          'for', 'switch', 'while', 'debugger', 'function', 'this', 'with',
          'default', 'if', 'throw', 'delete', 'in', 'try', 'class', 'enum',
          'extends', 'super', 'const', 'export', 'import', 'implements', 'let',
          'private', 'public', 'yield', 'interface', 'package', 'protected',
          'static', 'null', 'true', 'false');

        return preg_match($identifier_syntax, $subject)
            && ! in_array(mb_strtolower($subject, 'UTF-8'), $reserved_words);
    }
51774
public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null)
    {
        // check for product restrictions
        if ($this->cartHelper->hasProductRestrictions($quote)) {
            return false;
        }
        return parent::isAvailable();
    }
126985
public function trackUse($string, $subject)
    {
        $id = $this->resolveUserID($subject);

        // If the subject is invalid return false
        if (!$id) {
            return false;
        }

        if (!is_string($string)) {
            throw new \InvalidArgumentException(t('Invalid mixed value provided. Must be a string.'));
        }

        if ($this->maxReuse) {
            // Store the use in the database
            $this->entityManager->transactional(function (EntityManagerInterface $em) use ($id, $string) {
                $reuse = new UsedString();
                $reuse->setDate(Carbon::now());
                $reuse->setSubject($id);
                $reuse->setUsedString(password_hash($string, PASSWORD_DEFAULT));

                $em->persist($reuse);
            });
        }

        // Prune extra tracked uses
        $this->pruneUses($id);

        return true;
    }