Checks the type of the argument `object`, and returns it if everything is
ok.

@return FormInterface|null
@throws InvalidOptionValueException
339278
protected function getFormObjectArgument()
    {
        $objectArgument = $this->arguments['object'];

        if (null === $objectArgument) {
            return null;
        }

        if (false === is_object($objectArgument)) {
            throw InvalidOptionValueException::formViewHelperWrongFormValueType($objectArgument);
        }

        if (false === $objectArgument instanceof FormInterface) {
            throw InvalidOptionValueException::formViewHelperWrongFormValueObjectType($objectArgument);
        }

        $formClassName = $this->getFormClassName();

        if (false === $objectArgument instanceof $formClassName) {
            throw InvalidOptionValueException::formViewHelperWrongFormValueClassName($formClassName, $objectArgument);
        }

        return $objectArgument;
    }
92824
public function getInputType()
    {
        switch (true) {
            case $this->callback instanceof Closure:
                return self::CLOSURE_TYPE;

            case is_callable($this->callback, false):
                return self::CALLABLE_TYPE;

            case is_string($this->callback):
                return self::SELF_METHOD_TYPE;
        }

        throw new InvalidCallbackException(
            "The input provided for Callback filter is not supported or the callable not valid.
            Please refer to the class documentation."
        );
    }
210188
public function type(): string
    {
        if (is_string($this->value)) {

            return $this->string($this->value);

        }

        if (is_array($this->value)) {

            return $this->array($this->value);

        }

        if (is_object($this->value)) {

            return $this->object($this->value);

        }

        return gettype($this->value);
    }
968745
public static function getType($value)
    {
        if ($value === null) {
            return null;
        }

        $type = gettype($value);
        if (is_array($value) && !empty($value)) {
            $arrayType = null;
            foreach ($value as $entry) {
                if ($arrayType == null) {
                    $arrayType = self::getType($entry);
                } else {
                    return "mixed[]";
                }
            }
            return $arrayType . "[]";
        } elseif ($type == 'object') {
            return get_class($value);
        }

        return self::mapToBuiltInType($type);
    }
742568
private function getType($value): string
    {
        if (is_array($value)) {
            if ($value !== array_values($value)) {
                return self::DATATYPE_OBJECT;
            }

            return self::DATATYPE_ARRAY;
        }

        if (is_bool($value)) {
            return self::DATATYPE_BOOLEAN;
        }

        if (is_string($value)) {
            return self::DATATYPE_STRING;
        }

        if (is_int($value) || is_float($value)) {
            return self::DATATYPE_NUMBER;
        }

        if (null === $value) {
            return self::DATATYPE_NULL;
        }

        throw new \InvalidArgumentException(
            sprintf(
                'Value needs to be of type array|bool|string|int|float|null, %s given',
                is_object($value) ? get_class($value) : gettype($value)
            )
        );
    }
1314395
public function getValue() : ?string
    {
        foreach ($this->getOptions() as $option) {
            if ($option->isSelected()) {
                return $option->getValue();
            }
        }

        return null;
    }
1182870
public function checkType($value)
    {
        if (isset($this->name) && null !== $this->name) {
            $fn = 'is_'.$this->name;

            return $fn($value);
        }

        throw new \Exception('Invalid name or name not defined for primitive type.');
    }
1340291
public static function getValue($object, $propertyName)
    {
        $classReflection = new \ReflectionClass(get_class($object));
        if (!$classReflection->hasProperty($propertyName)) {
            throw new \InvalidArgumentException(
                'The class "' . get_class($object) . '" does not have the property "' . $propertyName . '"'
            );
        }
        $propertyReflection = $classReflection->getProperty($propertyName);
        if ($propertyReflection->isPublic()) {
            return $propertyReflection->getValue($object);
        }

        if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
            $propertyReflection->setAccessible(true);
            $value = $propertyReflection->getValue($object);
            $propertyReflection->setAccessible(false);
            return $value;
        }

        throw new \InvalidArgumentException(
            'The property "' . $propertyName . '" of the class "' . get_class($object) . '" is not readable'
        );
    }
412351
protected function getObjectFormStage() : IForm
    {
        $objectValidationCallbacks = $this->objectValidationCallbacks;

        if ($objectValidationCallbacks) {
            /** @var callable $validationCallback */
            $validationCallback = array_shift($objectValidationCallbacks);

            foreach ($objectValidationCallbacks as $otherCallback) {
                $validationCallback = function ($object) use ($validationCallback, $otherCallback) {
                    return $validationCallback($object) && $otherCallback($object);
                };
            }
        } else {
            $validationCallback = null;
        }

        return ObjectForm::build($this->dataSource, $validationCallback);
    }
207394
public function getValue($object) {
		ArgUtils::assertTrue($object instanceof DynamicDispatchable);
		$value = $object->getPropertyValue($this->propertyName);
		if ($this->nullReturnAllowed && $value === null) return $value;
		
		try {
			$value = $this->constraint->validate($value);
		} catch (ValueIncompatibleWithConstraintsException $e) {
			throw new PropertyValueTypeMissmatchException(
					TypeUtils::prettyMethName(get_class($object), 'getPropertyValue') 
							. ' returns invalid value for property \'' . $this->propertyName . '\'', 0, $e);
		}
		return $value;
	}
810032
public function asObjectIdentifier(): Primitive\ObjectIdentifier
    {
        if (!$this->_element instanceof Primitive\ObjectIdentifier) {
            throw new \UnexpectedValueException(
                $this->_generateExceptionMessage(
                    Element::TYPE_OBJECT_IDENTIFIER));
        }
        return $this->_element;
    }
1143579
private function optionalTypeHint() {
    static $array_callable_types = [T_ARRAY, T_CALLABLE];
    $node = NULL;
    if ($node = $this->tryMatchToken($array_callable_types)) {
      return $node;
    }
    elseif (in_array($this->currentType, self::$namespacePathTypes)) {
      return $this->name();
    }
    return NULL;
  }
646212
public function getValue($object = null)
    {
        if (!is_object($object)) {
            throw new Exception('$object is of type ' . gettype($object) . ', instance of class ' . $this->class . ' expected.', 1210859212);
        }
        if ($this->isPublic()) {
            return parent::getValue($object);
        }

        parent::setAccessible(true);
        return parent::getValue($object);
    }
503141
private function validateType(): bool
    {
        switch ($this->options['type']) {
            case 'integer':
                $isValid = \is_int($this->value) ? true : false;
                break;
            case 'float':
                $isValid = \is_int($this->value) || \is_float($this->value) ? true : false;
                break;
            default:
                $isValid = \is_int($this->value) || \is_float($this->value) ? true : false;
                break;
        }
        if (!$isValid) {
            $this->setError(self::VALIDATOR_ERROR_NUMBER_INCORRECT_TYPE);
        }
        return $isValid;
    }
786816
public function isValueValidType($value)
    {
        switch ($this->getType()) {
            case self::TYPE_BOOLEAN:
                $isValid = is_bool($value);
                break;
            case self::TYPE_DATE:
            case self::TYPE_DATETIME:
                $isValid = is_object($value) and get_class($value) == 'DateTime';
                break;
            case self::TYPE_NUMBER:
                $isValid = is_numeric($value);
                break;
            case self::TYPE_STRING:
                $isValid = is_string($value);
                break;
            default:
                $isValid = false;
        }

        return $isValid;
    }
322547
public function getValue($object = null)
    {
        $name = $this->getName();

        if ($object instanceof Proxy && ! $object->__isInitialized()) {
            $originalInitializer = $object->__getInitializer();
            $object->__setInitializer(null);
            $val = $object->$name ?? null;
            $object->__setInitializer($originalInitializer);

            return $val;
        }

        return isset($object->$name) ? parent::getValue($object) : null;
    }
315413
public function getValueFromInput(InputInterface $input, $normalize = true)
    {
        $optionName = $this->getOptionName();
        if (!$input->hasOption($optionName)) {
            return null;
        }
        $value = $input->getOption($optionName);
        if ($this->isEmpty($value)) {
            return null;
        }
        if ($input->getParameterOption('--' . $optionName) === false && $value === $this->default) {
            return null;
        }

        return $normalize ? $this->normalize($value) : $value;
    }