@param mixed            $value
@param ContextInterface $context

@return array

@SuppressWarnings(PHPMD.StaticAccess)
@SuppressWarnings(PHPMD.ElseExpression)
544971
public static function execute($value, ContextInterface $context): array
    {
        // parser guarantees that input will be an array of [$type => $id] where type and id are scalars

        // we will check the type of every pair and send further identities only
        $indexes          = [];
        $foundInvalidType = null;
        $expectedType     = $context->getProperties()->getProperty(static::PROPERTY_RESOURCE_TYPE);
        foreach ($value as $typeAndId) {
            assert(is_array($typeAndId) === true && count($typeAndId) === 1);
            $index = reset($typeAndId);
            $type  = key($typeAndId);
            assert(is_scalar($index) === true && is_scalar($type) === true);
            if ($type === $expectedType) {
                $indexes[] = $index;
            } else {
                $foundInvalidType = $type;
                break;
            }
        }

        $reply = $foundInvalidType === null ?
            static::createSuccessReply($indexes) :
            static::createErrorReply(
                $context,
                $foundInvalidType,
                ErrorCodes::INVALID_RELATIONSHIP_TYPE,
                Messages::INVALID_RELATIONSHIP_TYPE,
                []
            );

        return $reply;
    }
614621
public static function encode($value, Context $context)
    {
        if (is_bool($value)) {
            return new BooleanValue($context->getIsolate(), $value);
        } elseif (is_string($value)) {
            return new StringValue($context->getIsolate(), $value);
        } elseif (is_float($value)) {
            return new NumberValue($context->getIsolate(), $value);
        } elseif (is_int($value)) {
            return new IntegerValue($context->getIsolate(), $value);
        } elseif ($value === null) {
            return new NullValue($context->getIsolate());
        } elseif ($value instanceof \DateTime) {
            return new DateObject($context, $value->getTimestamp() * 1000);
        } elseif ($value instanceof ObjectInterface) {
            return self::encode($value->getProperties(), $context);
        } elseif ($value instanceof \Closure || is_callable($value)) {
            return new FunctionObject($context, function(FunctionCallbackInfo $info) use ($value){
                $args   = $info->arguments();
                $params = [];
                foreach ($args as $arg) {
                    $params[] = Decoder::decode($arg, $info->getContext());
                }

                $return = call_user_func_array($value, $params);

                $info->getReturnValue()->set(self::encode($return, $info->getContext()));
            });
        } elseif ($value instanceof \ArrayObject) {
            return self::encode($value->getArrayCopy(), $context);
        } elseif ($value instanceof \Traversable) {
            return self::encode(iterator_to_array($value), $context);
        } elseif ($value instanceof \JsonSerializable) {
            return self::encode($value->jsonSerialize(), $context);
        } elseif ($value instanceof \stdClass || (is_array($value) && self::isAssoc($value))) {
            $object = new ObjectValue($context);
            foreach ($value as $key => $val) {
                $object->set(
                    $context,
                    self::encode($key, $context),
                    self::encode($val, $context)
                );
            }
            return $object;
        } elseif (is_array($value)) {
            $array = new ArrayObject($context);
            $index = 0;
            foreach ($value as $val) {
                $array->set(
                    $context,
                    self::encode($index, $context),
                    self::encode($val, $context)
                );
                $index++;
            }
            return $array;
        } elseif (is_object($value) && method_exists($value, '__toString')) {
            return new StringValue($context->getIsolate(), $value->__toString());
        } else {
            return new NullValue($context->getIsolate());
        }
    }
605924
protected function getFieldValue($value, FieldDefinition $fieldDefinition, $contentTypeIdentifier, array $context = array())
    {
        $fieldTypeIdentifier = $fieldDefinition->fieldTypeIdentifier;

        if (is_array($value) || $this->fieldHandlerManager->managesField($fieldTypeIdentifier, $contentTypeIdentifier)) {
            // since we now allow refs to be arrays, let's attempt a 1st pass at resolving them here instead of every single fieldHandler...
            if (is_string($value) && $this->fieldHandlerManager->doPreResolveStringReferences($fieldTypeIdentifier, $contentTypeIdentifier)) {
                $value = $this->referenceResolver->resolveReference($value);
            }
            // inject info about the current content type and field into the context
            $context['contentTypeIdentifier'] = $contentTypeIdentifier;
            $context['fieldIdentifier'] = $fieldDefinition->identifier;
            return $this->fieldHandlerManager->hashToFieldValue($fieldTypeIdentifier, $contentTypeIdentifier, $value, $context);
        }

        return $this->getSingleFieldValue($value, $fieldDefinition, $contentTypeIdentifier, $context);
    }
629622
public function isValid($value, $context = array())
    {
        $this->_setValue((string) $value);

        $fieldSet = (boolean) isset($context[$this->_fieldName]) && $context[$this->_fieldName];
        $valueSet = (boolean) $value;

        if ($valueSet && (! $fieldSet))  {
            return true;
        }

        if ((! $valueSet) && $fieldSet)  {
            return true;
        }

        $this->_error(self::NEITHER);
        return false;
    }
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;
    }
1242023
public function resolve(
        ValueInterface $value,
        FixtureInterface $fixture,
        ResolvedFixtureSet $fixtureSet,
        array $scope,
        GenerationContext $context
    ): ResolvedValueWithFixtureSet {
        $this->checkResolver(__METHOD__);

        $quantifier = $value->getQuantifier();
        if ($quantifier instanceof ValueInterface) {
            $result = $this->resolver->resolve($quantifier, $fixture, $fixtureSet, $scope, $context);
            list($quantifier, $fixtureSet) = [$result->getValue(), $result->getSet()];
        }

        if ($quantifier < 0) {
            throw InvalidArgumentExceptionFactory::createForInvalidDynamicArrayQuantifier($fixture, $quantifier);
        }

        $element = $value->getElement();
        if (false === $element instanceof ValueInterface) {
            $array = array_fill(0, $quantifier, $element);

            return new ResolvedValueWithFixtureSet($array, $fixtureSet);
        }

        $array = [];
        for ($i = 0; $i < $quantifier; $i++) {
            $result = $this->resolver->resolve($element, $fixture, $fixtureSet, $scope, $context);

            $array[] = $result->getValue();
            $fixtureSet = $result->getSet();
        }

        return new ResolvedValueWithFixtureSet($array, $fixtureSet);
    }
841983
function applyFilters($value, $valueIdentifier, $context)
    {
        foreach ($this->filters as $selector => $filterSet) {
            /* @var $filterSet FilterSet */
            if ($selector != self::SELECTOR_ROOT && $this->itemMatchesSelector($valueIdentifier, $selector)) {
                $value = $filterSet->applyFilters($value, $valueIdentifier, $context);
            }
        }
        return $value;
    }
243533
public function validate(
        string $path,
        $value,
        ValidatorContextInterface $context,
        ValidatorInterface $validator = null
    ) {
        if (null === $value) {
            return [];
        }

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

        $count = count($value);

        if (null !== $this->min && $count < $this->min || null !== $this->max && $count > $this->max) {
            return [
                new Error(
                    $path,
                    'constraint.count.outofrange',
                    ['count' => $count, 'min' => $this->min, 'max' => $this->max]
                ),
            ];
        }

        return [];
    }
233231
public static function execute($value, ContextInterface $context): array
    {
        if (is_string($value) === true || is_numeric($value) === true) {
            return static::createSuccessReply((int)$value);
        }

        return static::createErrorReply($context, $value, ErrorCodes::IS_INT, Messages::IS_INT, []);
    }
374468
public function resolve(
        ValueInterface $value,
        FixtureInterface $fixture,
        ResolvedFixtureSet $fixtureSet,
        array $scope,
        GenerationContext $context
    ): ResolvedValueWithFixtureSet {
        $parameterKey = $value->getValue();
        $parameters = $fixtureSet->getParameters();
        if (false === $parameters->has($parameterKey)) {
            throw UnresolvableValueExceptionFactory::createForCouldNotFindParameter($parameterKey);
        }

        return new ResolvedValueWithFixtureSet(
            $parameters->get($parameterKey),
            $fixtureSet
        );
    }
407298
public function compareFields($value, $field, $context) {
		if (!isset($context['data'][$field])) {
			return true;
		}
		if ($value === $context['data'][$field]) {
			return true;
		}

		return false;
	}
149974
private function resolveValue(ContainerInterface $container, $value)
    {
        if (is_array($value)) {
            foreach ($value as $key => $val) {
                $value[$key] = $this->resolveValue($container, $val);
            }

            return $value;
        }

        if (!is_string($value)) {
            return $value;
        }

        $escapedValue = preg_replace_callback('/%%|%([^%\s]++)%/', function ($match) use ($container, $value) {
            // skip %%
            if (!isset($match[1])) {
                return '%%';
            }

            $resolved = $container->getParameter($match[1]);
            if (is_string($resolved) || is_numeric($resolved)) {
                return (string) $resolved;
            }

            throw new \RuntimeException(sprintf(
                    'The container parameter "%s" must be a string or numeric, but it is of type %s.',
                    $match[1],
                    gettype($resolved)
                )
            );
        }, $value);

        return str_replace('%%', '%', $escapedValue);
    }
777766
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.numeric.invalidtype',
                ['type' => is_object($value) ? get_class($value) : gettype($value)]
            )];
        }

        $value = (string) $value;

        if (!is_numeric($value)) {
            return [new Error($path, 'constraint.numeric.notnumeric', ['value' => $value])];
        }

        return [];
    }
334442
public function verifyAccount($value, ExecutionContextInterface $context)
    {
        if ($value == 1) {
            $data = $context->getRoot()->getData();
            if (false === $data['password'] || (empty($data['password']) && '0' != $data['password'])) {
                $context->getViolations()->add(new ConstraintViolation(
                    Translator::getInstance()->trans('This value should not be blank.'),
                    'account_password',
                    array(),
                    $context->getRoot(),
                    'children[password].data',
                    'propertyPath'
                ));
            }
        }
    }
772542
public function validate(
        string $path,
        $value,
        ValidatorContextInterface $context,
        ValidatorInterface $validator = null
    ) {
        if (null === $value || '' === $value) {
            return [];
        }

        if ($value instanceof \DateTimeInterface) {
            return $this->validateDateTime($path, $value);
        }

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

        $value = trim((string) $value);

        \DateTime::createFromFormat('!'.$this->format, $value);

        $dateTimeErrors = \DateTime::getLastErrors();

        return array_merge(
            $this->errorsByDateTimeLastErrors(
                $path,
                $value,
                'error',
                $dateTimeErrors['error_count'],
                $dateTimeErrors['errors']
            ),
            $this->errorsByDateTimeLastErrors(
                $path,
                $value,
                'warning',
                $dateTimeErrors['warning_count'],
                $dateTimeErrors['warnings']
            )
        );
    }
568109
public function validate(
        string $path,
        $value,
        ValidatorContextInterface $context,
        ValidatorInterface $validator = null
    ) {
        if (!is_numeric($value)) {
            return [];
        }

        if (null !== $this->min && $value < $this->min || null !== $this->max && $value > $this->max) {
            return [
                new Error(
                    $path,
                    'constraint.numericrange.outofrange',
                    ['value' => $value, 'min' => $this->min, 'max' => $this->max]
                ),
            ];
        }

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

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

        if (!isset($value['lat']) || !isset($value['lon'])) {
            return [new Error($path, 'constraint.coordinatearray.invalidformat', ['value' => json_encode($value)])];
        }

        $lat = $value['lat'];
        $lon = $value['lon'];

        if ($lat < -90 || $lat > 90 || $lon < -180 || $lon > 180) {
            return [new Error($path, 'constraint.coordinatearray.invalidvalue', ['value' => json_encode($value)])];
        }

        return [];
    }