@param OriginalCustomerData $subject
@param                      $result

@return array
499107
public function afterGetSectionData(\Magento\Customer\CustomerData\Customer $subject, $result)
    {
        $customerId = $subject->currentCustomer->getCustomerId();
        if ($customerId) {
            $customer = $subject->currentCustomer->getCustomer();
            $result['id'] = $customerId;
            $result['email'] = $customer->getEmail();
        }

        return $result;
    }
431773
protected function _success(Subject $subject)
    {
        $subject->set(['success' => true, 'created' => true]);

        $this->_trigger('afterRegister', $subject);
        $this->setFlash('success', $subject);

        $redirectUrl = $this->config('redirectUrl');
        if ($redirectUrl === null && $this->_controller()->components()->has('Auth')) {
            $redirectUrl = $this->_controller()->Auth->config('loginAction');
        }

        return $this->_redirect($subject, $redirectUrl);
    }
218734
protected function authorInfo($result)
    {
        $outputElement = null;

        if ($result['md-title-responsibility'][0]['values']) {
            $outputText = implode('; ', $result['md-title-responsibility'][0]['values']);
            if (!$outputText && $result['md-author']) {
                $authors = [];
                foreach ($result['md-author'] as $index => $author) {
                    if ($index < self::MAX_AUTHORS) {
                        $authorName = $author['values'][0];
                        $authors[] = $authorName;
                    } else {
                        $authors[] = LocalizationUtility::translate('et al.', 'Pazpar2');
                        break;
                    }
                }

                $outputText = implode('; ', $authors);
            }
        }

        if (isset($outputText)) {
            $outputElement = $this->doc->createElement('span');
            $outputElement->setAttribute('class', 'pz2-item-responsibility');
            $outputElement->appendChild($this->doc->createTextNode($outputText));
        }

        return $outputElement;
    }
1259659
public static function getClassAndField($subject, $optional = false)
    {
        /** @var null|SubjectIdentityInterface $subject */
        list($subject, $field) = static::getSubjectAndField($subject, $optional);

        $class = null !== $subject
            ? $subject->getType()
            : null;

        return [$class, $field];
    }
53940
protected function _findRecord($id, Subject $subject)
    {
        $repository = $this->_table();
        $this->_configIndex($repository, $this->_request());

        if ($this->_request()->query('type')) {
            $repository->name($this->_request()->query('type'));
        }

        $query = $repository->find($this->findMethod());
        $query->where(['_id' => $id]);
        $subject->set([
            'repository' => $repository,
            'query' => $query
        ]);
        $this->_trigger('beforeFind', $subject);
        $entity = $query->first();
        if (!$entity) {
            return $this->_notFound($id, $subject);
        }
        $subject->set(['entity' => $entity, 'success' => true]);
        $this->_trigger('afterFind', $subject);

        return $entity;
    }
135276
private function flattenStructure($subject, &$result = [], $prefix = '', $delimiter = '.')
    {
        foreach ($subject as $key => $value) {
            if (is_array($value) || is_object($value)) {
                $this->flattenStructure($value, $result, $prefix ? $prefix.$delimiter.$key : $key);
            } else {
                if ($prefix) {
                    $key = $prefix.$delimiter.$key;
                }
                // Do not nullify existing key/value pairs if already present.
                if (empty($value) && false !== $value && !isset($result[$key])) {
                    $result[$key] = null;
                } else {
                    // Handle repeated arrays without unique keys.
                    $originalKey = $key;
                    $count       = 0;
                    while (isset($result[$key])) {
                        $key = $originalKey.$delimiter.$count;
                        ++$count;
                    }
                    $result[$key] = $value;
                }
            }
        }

        return $result;
    }
856653
protected function getClaimsArray(JwTSubject $subject)
    {
        return array_merge(
            $this->getClaimsForSubject($subject),
            $subject->getJwTCustomClaims(), // custom claims from JwTSubject method
            $this->customClaims // custom claims from inline setter
        );
    }
1165323
protected function _findRecord($id, Subject $subject)
    {
        $repository = $this->_table();

        list($finder, $options) = $this->_extractFinder();
        $query = $repository->find($finder, $options);
        $query->where([current($query->aliasField($repository->getPrimaryKey())) => $id]);

        $subject->set([
            'repository' => $repository,
            'query' => $query
        ]);

        $this->_trigger('beforeFind', $subject);
        $entity = $subject->query->first();

        if (!$entity) {
            $this->_notFound($id, $subject);
        }

        $subject->set(['entity' => $entity, 'success' => true]);
        $this->_trigger('afterFind', $subject);

        return $entity;
    }
809838
protected function filterResult(Result $result)
    {
        $request = $result->getData('request') ?: array();
        foreach (array('AccountNumber', 'RoutingNumber') as $key) {
            if (array_key_exists($key, $request)) {
                $request[$key] = '[filtered]';
            }
        }

        $result->setData('request', $request);

        return $result;
    }
17575
public static function listToEntity(array $result, string $className): array
    {
        $entities = [];
        foreach ($result as $data) {
            if (!\is_array($data)) {
                continue;
            }
            $entities[] = self::arrayToEntity($data, $className);
        }

        return $entities;
    }
845375
public function serialiseResult($executionResult)
    {
        // Format object
        if (!empty($executionResult->errors)) {
            return [
                'data' => $executionResult->data,
                'errors' => array_map($this->errorFormatter, $executionResult->errors),
            ];
        } else {
            return [
                'data' => $executionResult->data,
            ];
        }
    }
1194021
public function parserResult($result)
    {
        if ($this->presenter instanceof PresenterInterface) {
            if ($result instanceof Collection || $result instanceof LengthAwarePaginator) {
                $result->each(function ($model) {
                    if ($model instanceof Presentable) {
                        $model->setPresenter($this->presenter);
                    }

                    return $model;
                });
            } elseif ($result instanceof Presentable) {
                $result = $result->setPresenter($this->presenter);
            }

            if (!$this->skipPresenter) {
                return $this->presenter->present($result);
            }
        }

        return $result;
    }
595239
public static function keyPair(array $result): array
    {
        $firstRow = current($result);
        if (empty($firstRow)) {
            return $result;
        }

        list($keyName, $valueName) = array_keys($firstRow);

        return array_combine(
            array_column($result, $keyName),
            array_column($result, $valueName)
        );
    }
1143239
public function beforeCreate(SpecificationFactory $subject, array $checks): array
    {
        $checks = array_merge(
            $checks,
            $this->additionalChecks
        );
        return [ $checks ];
    }
1302487
protected function formInitialUnsortedChoices($result, $data)
    {
        $unsortedChoices = [];
        $urlParameters = array_merge(
            $data->getResetUrlParameters(),
            $data->getState()->getUrlParameters()
        );

        foreach ($result->getAggregation($data->getName())->getAggregation('name') as $nameBucket) {
            $groupName = $nameBucket['key'];

            foreach ($nameBucket->getAggregation('value') as $bucket) {
                $bucketArray = ['key' => $bucket['key'], 'doc_count' => 0];
                $choice = $this->createChoice($data, $bucket['key'], '', $bucketArray, $urlParameters);
                $unsortedChoices[$groupName][$bucket['key']] = $choice;
            }
        }

        return $unsortedChoices;
    }
635287
public static function all($pattern, $subject, Results\PregObject $object = null): Results\PregObject
    {
        $object = static::pregObject($object);

        $object->flags  = null === $object->flags ? $object->flags : PREG_PATTERN_ORDER;
        $object->result = \preg_match_all(
            $pattern,
            $subject,
            $object->matches,
            $object->flags,
            $object->offset
        );

        return $object;
    }
1035385
public function afterGetVariables(\Magento\Email\Block\Adminhtml\Template\Edit\Form $subject, $result)
    {
        $additionalConfigValues = $this->variables->getAdditionalConfigVariables();
        $optionArray = [];
        foreach ($additionalConfigValues as $variable) {
            $optionArray[] = [
                'value' => '{{config path="' . $variable['value'] . '"}}',
                'label' => $variable['label'],
            ];
        }
        if ($optionArray) {
            $result[] = [
                'label' => __('Imprint'),
                'value' => $optionArray,
            ];
        }
        return $result;
    }