@param mixed            $value
@param ContextInterface $context

@return array

@SuppressWarnings(PHPMD.StaticAccess)
170054
public static function execute($value, ContextInterface $context): array
    {
        $properties      = $context->getProperties();
        $filterId        = $properties->getProperty(static::PROPERTY_FILTER_ID);
        $filterOptions   = $properties->getProperty(static::PROPERTY_FILTER_OPTIONS);
        $errorCode       = $properties->getProperty(static::PROPERTY_FILTER_ERROR_CODE);
        $messageTemplate = $properties->getProperty(static::PROPERTY_MESSAGE_TEMPLATE);

        $output = filter_var($value, $filterId, $filterOptions);

        return $output !== false ?
            static::createSuccessReply($output) :
            static::createErrorReply($context, $value, $errorCode, $messageTemplate, [$filterId, $filterOptions]);
    }
351786
public static function execute($value, ContextInterface $context): array
    {
        return $value instanceof DateTimeInterface ?
            static::createSuccessReply($value) :
            static::createErrorReply($context, $value, ErrorCodes::IS_DATE_TIME, Messages::IS_DATE_TIME, []);
    }
440872
public function validate(
        string $path,
        $value,
        ValidatorContextInterface $context,
        ValidatorInterface $validator = null
    ) {
        if (null === $value || '' === $value) {
            return [];
        }

        if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) {
            return [new Error(
                $path,
                'constraint.email.invalidtype',
                ['type' => is_object($value) ? get_class($value) : gettype($value)]
            )];
        }

        $value = (string) $value;

        if (false === filter_var($value, FILTER_VALIDATE_EMAIL)) {
            return [new Error($path, 'constraint.email.invalidformat', ['value' => $value])];
        }

        return [];
    }
505388
public function set(string $name, $value): ContextInterface
    {
        $this->bagContext->offsetSet($name, $value);

        return $this;
    }
1315828
public static function execute($value, ContextInterface $context): array
    {
        return is_array($value) === true ?
            static::createSuccessReply($value) :
            static::createErrorReply($context, $value, ErrorCodes::IS_ARRAY, Messages::IS_ARRAY, []);
    }
656018
public function isValid($value, $context = null)
    {
        $this->_getValidators();
        $this->messages = array();
        $result         = false;
        foreach ($this->validators as $element) {
            /** @var $validator ValidatorInterface */
            $validator = $element['instance'];
            if (!$validator->isValid($value, $context)) {
                $messages       = $validator->getMessages();
                $this->messages = array_replace_recursive($this->messages, $messages);
                continue;
            }
            $result         = true;
        }
        return $result;
    }
197621
public static function execute($value, ContextInterface $context): array
    {
        $context->getStates()->setState(static::STATE_HAS_BEEN_CALLED, true);

        return static::createSuccessReply($value);
    }
515822
public function getValuesData(AttributeInterface $attribute, array $context = null)
    {
        $this->checkAttribute($attribute);
        $valuesData = new ArrayCollection();
        try {
            foreach ($this->getValues($attribute, $context) as $value) {
                $valuesData->add($value->getValueData());
            }
        } catch (ExceptionInterface $e) {
            throw new InvalidValueDataException("Unable to access data for attribute {$attribute->getCode()}", 0, $e);
        }


        return $valuesData;
    }
504136
public function check($value, array $context = [])
    {
        $hound = new TypeHound($value);

        return $this->expectedType === $hound->resolve();
    }
816459
public function validate(
        string $path,
        $value,
        ValidatorContextInterface $context,
        ValidatorInterface $validator = null
    ) {
        if (null === $value) {
            return [];
        }

        if (true !== $value) {
            return [new Error($path, 'constraint.true.nottrue')];
        }

        return [];
    }
102434
protected function getSingleFieldValue($value, FieldDefinition $fieldDefinition, $contentTypeIdentifier, array $context = array())
    {
        // booleans were handled here. They are now handled as complextypes

        // q: do we really want this to happen by default on all scalar field values?
        // Note: if you want this *not* to happen, register a complex field for your scalar field...
        $value = $this->referenceResolver->resolveReference($value);

        return $value;
    }
1126465
public static function execute($value, ContextInterface $context): array
    {
        return is_bool($value) === true ?
            static::createSuccessReply($value) :
            static::createErrorReply($context, $value, ErrorCodes::IS_BOOL, Messages::IS_BOOL, []);
    }
840338
public function isContextMatching(ContextualValueInterface $value, array $context)
    {
        if (!$value->getContext()) {
            return true;
        }
        $value::checkContext($context);
        foreach ($this->getContextMask() as $key) {
            $contextKey = array_key_exists($key, $context) ? $context[$key] : null;
            if ($contextKey !== $value->getContextValue($key)) {
                return false;
            }
        }

        return true;
    }
1175268
public function validate(
        string $path,
        $value,
        ValidatorContextInterface $context,
        ValidatorInterface $validator = null
    ) {
        if (null === $value) {
            return [];
        }

        if (!is_array($value) && !$value instanceof \Traversable) {
            return [new Error(
                $path.'[_all]',
                'constraint.all.invalidtype',
                ['type' => is_object($value) ? get_class($value) : gettype($value)]
            )];
        }

        $errors = [];
        foreach ($value as $i => $subValue) {
            foreach ($this->constraints as $constraint) {
                $errors = array_merge(
                    $errors,
                    $constraint->validate($path.'['.$i.']', $subValue, $context, $validator)
                );
            }
        }

        return $errors;
    }
112391
public function prepareValue(Context $context)
    {
        if (isset($this->name) && isset($context[$this->name])) {
            $value = $context[$this->name];
        } elseif ($this->value instanceof VariableOperand) {
            $value = $this->value->prepareValue($context);
        } else {
            $value = $this->value;
        }

        return ($value instanceof Value) ? $value : new Value($value);
    }
1335166
public function context(ContextInterface $context)
    {
        if (!empty($this->vary)) {
            $this->varyValue = $context->get($this->vary);
        }
    }
439150
public function context($context, $value = null)
    {
        if (! is_array($context)) {
            $context = [$context => $value];
        }

        foreach ($context as $key => $value) {
            $this->context[$key] = $value;
        }

        return $this;
    }