@param       $voiceConstraints
@param array $additionalData

@throws InvalidVoiceCodeException

@return array
502478
private function extractVoiceConstraint(array $voiceConstraints, array $additionalData): array
    {
        if (isset($additionalData['voice']) && $voice = $additionalData['voice']) {
            if (empty($voiceConstraints[$voice])) {
                throw new InvalidVoiceCodeException($voice);
            }

            $voiceConstraint = $voiceConstraints[$voice];
        }

        return [$voice ?? null, $voiceConstraint ?? null];
    }
983242
private function extractConstraints($vars): array
    {
        $form = $this->getFormInterface($this->form, $vars['id']);
        $result = [];
        $required = false;
        $constraints = $form->getConfig()->getOption('constraints');
        foreach($constraints as $q=>$constraint)
        {
            $result[$q] = (array) $constraint;
            $name = explode('\\',get_class($constraint));
            $result[$q]['class'] = end($name);

            switch($result[$q]['class']) {
                case 'NotBlank':
                    $result[$q]['message'] = $this->getTranslator()->trans($result[$q]['message'], [], 'validators');
                    $required = true;
                    break;
                case 'Colour':
                    $result[$q]['message'] = $this->getTranslator()->trans($result[$q]['message'], [], 'validators');
                    break;
                case 'Length':
                    $result[$q]['maxMessage'] = $this->getTranslator()->transChoice($result[$q]['maxMessage'], $result[$q]['max'], ['{{ limit }}' => $result[$q]['max']], 'validators');
                    $result[$q]['minMessage'] = $this->getTranslator()->transChoice($result[$q]['minMessage'], $result[$q]['min'], ['{{ limit }}' => $result[$q]['min']], 'validators');
                    $result[$q]['exactMessage'] = $this->getTranslator()->transChoice($result[$q]['exactMessage'], $result[$q]['min'], ['{{ limit }}' => $result[$q]['max']], 'validators');
                    break;
                case 'Choice':
                    $result[$q]['message'] = $this->getTranslator()->trans($result[$q]['message'], [], 'validators');
                    $result[$q]['multipleMessage'] = $this->getTranslator()->trans($result[$q]['multipleMessage'], [], 'validators');
                    $result[$q]['maxMessage'] = $this->getTranslator()->transChoice($result[$q]['maxMessage'], $result[$q]['max'], ['{{ limit }}' => $result[$q]['max']], 'validators');
                    $result[$q]['minMessage'] = $this->getTranslator()->transChoice($result[$q]['minMessage'], $result[$q]['min'], ['{{ limit }}' => $result[$q]['min']], 'validators');
                    break;
                default:
                    dump($result[$q]);
                    trigger_error(sprintf('The constraint (%s) has no handler in the React Form Manager', $result[$q]['class']), E_USER_ERROR);
            }

        }
        if (! empty($vars['required']) && ! $required)
        {
            $notBlank['message'] = $this->getTranslator()->trans('The value should not be empty!', [], 'validators');
            $notBlank['class'] = 'NotBlank';
            $result[] = $notBlank;
        }
        return $result;
    }
392950
public function setAdditionalData($additionalData) {
        if (is_null($additionalData)) {
            $additionalData = "";
        }
        if (!is_string($additionalData)) {
            throw new \Exception ("Additional Data must be a String");
        }
        $this->additionalData = $additionalData;
    }
35419
private function getErrorParameters(array $entryData)
    {
        $expectedParameterNames = $this->getExpectedParameterNames($entryData[self::KEY_RAW]);
        $parameters = [];
        foreach ($expectedParameterNames as $expectedParameterName) {
            if (isset($entryData[$expectedParameterName])) {
                $parameters[$expectedParameterName] = $entryData[$expectedParameterName];
            } else {
                $parameter = $this->getDerivedParameter($entryData);

                if (is_null($parameter)) {
                    throw new ParserException('Missing expected parameter "'.$expectedParameterName.'"', 2);
                }

                $parameters[$expectedParameterName] = $parameter;
            }
        }

        return $parameters;
    }
209851
protected function getPhpRequiredList($requiredOnly, array $additionalData = null)
    {
        $requiredList = [
            'requiredPhpVersion',
            'requiredPhpLibs',
        ];

        if (!$requiredOnly) {
            $requiredList = array_merge($requiredList, [
                'recommendedPhpLibs',
                'recommendedPhpParams',
            ]);
        }

        return $this->getRequiredList('phpRequirements', $requiredList, $additionalData);
    }
397334
public function dataSourceFilter($sourceIdent)
    {
        if (!is_string($sourceIdent)) {
            throw new InvalidArgumentException('Data source identifier must be a string');
        }

        $filters = array_merge($this->defaultDataSourceFilters(), $this->dataSourceFilters);

        if (isset($filters[$sourceIdent])) {
            return $filters[$sourceIdent];
        }

        return null;
    }
83858
public static function createFromConstraintViolationList(ConstraintViolationListInterface $errors)
    {
        $exception = static::createUnprocessable('Input validation errors.');

        /** @var ConstraintViolationInterface $error */
        foreach ($errors as $error) {
            $exception->errorValidation($error->getPropertyPath(), $error->getMessage());
        }

        return $exception;
    }
1106683
private static function bindViolations(ConstraintViolationList $violations, ServiceBusContext $context): void
    {
        $errors = [];

        /** @var \Symfony\Component\Validator\ConstraintViolation $violation */
        foreach ($violations as $violation)
        {
            $errors[$violation->getPropertyPath()][] = $violation->getMessage();
        }

        try
        {
            invokeReflectionMethod($context, 'validationFailed', $errors);
        }
        // @codeCoverageIgnoreStart
        catch (\Throwable $throwable)
        {
            /** No exceptions can happen */
        }
        // @codeCoverageIgnoreEnd
    }
1249531
public function extractFromRequest(Request $request, string $commandClass, array $additionalProps = [])
    {
        $requestContent = $request->getContent();
        $requestFormat = $request->getRequestFormat();

        if (empty($requestContent)) {
            return $this->denormalizer->denormalize($additionalProps, $commandClass, $requestFormat);
        }

        $decodedContent = $this->decoder->decode($requestContent, $requestFormat);
        $finalProps = array_merge($decodedContent, $additionalProps);

        return $this->denormalizer->denormalize($finalProps, $commandClass, $requestFormat);
    }
182753
private function validateBundlesSectionInExtra(array $extra)
    {
        if (!isset($extra['phplist/core'])) {
            return;
        }
        $this->validatePhpListSectionInExtra($extra);

        if (!isset($extra['phplist/core']['bundles'])) {
            return;
        }
        if (!is_array($extra['phplist/core']['bundles'])) {
            throw new \InvalidArgumentException(
                'The extras.phplist/core.bundles section in the composer.json must be an array.',
                1505411665
            );
        }

        /** @var array $bundleExtras */
        $bundleExtras = $extra['phplist/core']['bundles'];
        foreach ($bundleExtras as $key => $bundleName) {
            if (!is_string($bundleName)) {
                throw new \InvalidArgumentException(
                    'The extras.phplist/core.bundles. ' . $key . '" section in the composer.json must be a string.',
                    1505412184
                );
            }
        }
    }
1093695
public function getFlattenedLimitationsValues(LookupLimitationResult $lookupLimitations): array
    {
        $limitationsValues = [];

        /** @var \eZ\Publish\API\Repository\Values\User\LookupPolicyLimitations $lookupPolicyLimitation */
        foreach ($lookupLimitations->lookupPolicyLimitations as $lookupPolicyLimitation) {
            /** @var \eZ\Publish\API\Repository\Values\User\Limitation $limitation */
            foreach ($lookupPolicyLimitation->limitations as $limitation) {
                $limitationsValues[] = $limitation->limitationValues;
            }
        }

        return !empty($limitationsValues) ? array_unique(array_merge(...$limitationsValues)) : $limitationsValues;
    }
596172
public static function tokenize(string $plainData) : array
    {
        $tokens = [];

        if(! empty($plainData)) {
            $tokens = (new self($plainData))->tokenizeInternal()->tokens;
        }

        return $tokens;
    }
495277
public function validate(APILimitationValue $limitationValue): array
    {
        $validationErrors = array();
        $existingLanguages = $this->persistenceLanguageHandler->loadListByLanguageCodes(
            $limitationValue->limitationValues
        );
        $missingLanguages = array_diff(
            $limitationValue->limitationValues,
            array_keys($existingLanguages)
        );
        if (!empty($missingLanguages)) {
            $validationErrors[] = new ValidationError(
                "limitationValues[] => '%languageCodes%' translation(s) do not exist",
                null,
                [
                    'languageCodes' => implode(', ', $missingLanguages),
                ]
            );
        }

        return $validationErrors;
    }
1259040
public function validateDataWithRules(array $data, array $validateRules, array $validateMessages = [], array $parametricConverter = [])
    {
        foreach ($validateRules as $key => $rules) {
            $value = array_key_exists($key, $data) ? $data[$key] : null;

            if (array_key_exists('nullable', $rules) && $rules['nullable'] && is_null($value)) {
                continue;
            }

            unset($rules['nullable']);

            $defaultParametricConverter = (method_exists($this, 'getParametricConverter') && is_array($this->getParametricConverter())) ? $this->getParametricConverter() : [];
            $parametricConverter = array_merge($defaultParametricConverter, $parametricConverter);
            $parameter = (array_key_exists($key, $parametricConverter)) ? $parametricConverter[$key] : $key;

            foreach ($rules as $ruleName => $ruleParameter) {
                if ($ruleName === 'callback') {
                    if (!is_callable($ruleParameter)) {
                        throw new BadMethodCallException('The reference of rule named `callback` must be a valid callable. You provided ' . $this->getValueDescription($ruleParameter) . '.');
                    }

                    call_user_func($ruleParameter, $value, InvalidRequestException::class);
                } else {
                    $method = 'check'.ucfirst(Helper::camelCase($ruleName));

                    if (!method_exists($this, $method)) {
                        throw new BadMethodCallException('Call to undefined the ' .get_class($this). '::' .$method. '() validator that associated with the `' .$ruleName. '` rule');
                    }

                    if (!$this->$method($value, $ruleParameter)) {
                        $message = isset($validateMessages[$key][$ruleName]) ? $validateMessages[$key][$ruleName] : null;

                        throw new InvalidRequestException($this->formatMessage($parameter, $ruleName, $ruleParameter, $message));
                    }
                }
            }
        }
    }
534279
public function getInvoices(Get\RequestData $requestData)
    {
        $request = new Get\Request($requestData);

        $apiResponse = $this->sendRequest($request, Get\ApiResponse::class);
        /** @var Get\Response $response */
        $response = $apiResponse->getResponse();
        foreach ($response->getInvoices() as $invoice) {
            $invoiceDate = $invoice->getInvoiceDate();
            if ($invoiceDate !== null) {
                $invoiceDate->setTime(0, 0, 0);
            }

            // We need to convert the due date to DateTime because of inconsistencies in the Monsum API response.
            $dueDate = $invoice->getDueDate();
            if ($dueDate !== null) {
                $dueDate = new \DateTime($dueDate);
                $dueDate->setTime(0, 0, 0);
                $invoice->setDueDate($dueDate);
            }
        }

        return $apiResponse;
    }
1308390
public function availability_info($text, $additionalclasses = '') {

        $data = ['text' => $text, 'classes' => $additionalclasses];
        $additionalclasses = array_filter(explode(' ', $additionalclasses));

        if (in_array('ishidden', $additionalclasses)) {
            $data['ishidden'] = 1;

        } else if (in_array('isstealth', $additionalclasses)) {
            $data['isstealth'] = 1;

        } else if (in_array('isrestricted', $additionalclasses)) {
            $data['isrestricted'] = 1;

            if (in_array('isfullinfo', $additionalclasses)) {
                $data['isfullinfo'] = 1;
            }
        }

        return $this->render_from_template('core/availability_info', $data);
    }
1294124
public function getSuggestions(SearchRequest $searchRequest, array $additionalFilters = []) : array
    {
        $requestId = (int)$this->tsfe->getRequestedId();
        $groupList = (string)$this->tsfe->gr_list;

        $suggestQuery = $this->queryBuilder->buildSuggestQuery($searchRequest->getRawUserQuery(), $additionalFilters, $requestId, $groupList);
        $solrSuggestions = $this->getSolrSuggestions($suggestQuery);

        if ($solrSuggestions === []) {
            return ['status' => false];
        }

        $maxSuggestions = $this->typoScriptConfiguration->getSuggestNumberOfSuggestions();
        $showTopResults = $this->typoScriptConfiguration->getSuggestShowTopResults();
        $suggestions    = $this->getSuggestionArray($suggestQuery, $solrSuggestions, $maxSuggestions);

        if (!$showTopResults) {
            return $this->getResultArray($searchRequest, $suggestions, [], false);
        }

        return $this->addTopResultsToSuggestions($searchRequest, $suggestions, $additionalFilters);
    }