Подготавливает значение эталонного выражения

@param $rawExpectedValue
@param $typeExpectedValue

@return mixed
@throws \OldTown\Workflow\ZF2\Toolkit\Validator\Exception\InvalidConvertTypeException
774007
protected function getExpectedValue($rawExpectedValue, $typeExpectedValue)
    {
        $result = @settype($rawExpectedValue, $typeExpectedValue);

        if (!$result) {
            throw new Exception\InvalidConvertTypeException('Invalid convert type');
        }

        return $rawExpectedValue;
    }
1109954
public function createObjectType() : ObjectConstructorCallbackDefiner
    {
        return new ObjectConstructorCallbackDefiner($this->class, function (callable $typeCallback) {
            $this->createObjectCallback = function (array $input) use ($typeCallback) {
                $className = $this->class->getClassName();

                /** @var ValueObject $valueObject */
                $valueObject = $typeCallback($input);

                if (!($valueObject instanceof $className)) {
                    throw InvalidReturnValueException::format(
                        'Invalid create object callback return value: expecting class compatible with %s, %s given',
                        $className, is_string($valueObject) ? $valueObject : Debug::getType($valueObject)
                    );
                }

                return $valueObject;
            };
        });
    }
105568
private function getSerializerValSourceExtBasedOn(ValueSourceExtension $ext)
    {
        return new SerializerValueSourceExtensionImpl(
            $ext->getMapper(),
            $ext->getSupportedValueSourceClass(),
            $ext->getUniqueExtensionId()
        );
    }
867950
public function getValue( $qualified = FALSE )
	{
		if( $qualified )
			return $this->decodeQualifiedValues ( $this->value );
		return $this->value;
	}
211029
public static function TreatValueAs( $value, $type)
	{
		if ( $value instanceof Undefined )
		{
			return $value;
		}

		if ( is_null( $value ) )
		{
			$value = CoreFuncs::$False;
		}

		if ( $type->TypeCode == XmlTypeCode::None)
			throw XPath2Exception::withErrorCodeAndParams( "XPDY0050", Resources::XPDY0050,
				array(
					$type,
					"empty-sequence()"
				)
			);

		if ( Type::FromValue( $value ) != $type->ItemType && $type->ItemType != Types::$ObjectType )
		{
			if ( $type->ItemType == Types::$IntegerType )
			{
				return Integer::ToInteger( $value, null );
			}
			else if ( $type->ItemType == Types::$DecimalType )
			{
				return DecimalValue::FromValue( $value );
				return $value + 0.0;
			}
			throw XPath2Exception::withErrorCodeAndParams( "XPDY0050", Resources::XPDY0050,
				array(
					$type,
					SequenceType::WithTypeCodeAndCardinality( SequenceType::GetXmlTypeCodeFromObject( $value ), XmlTypeCardinality::One ),
				)
			);
		}
		return $value;
	}
126954
public static function get($key = null, $type = 'string', $defaultValue = '')
    {
        if (!$key) {
            return $_GET;
        }
        return self::typeConvert(isset($_GET[$key]) ? $_GET[$key] : $defaultValue, $type);
    }
152824
protected function validateNot($value, $parsedValue)
    {
        $return = new ValidateResult($parsedValue, true);

        //Check if $this->not is set and it's not null since its optional
        if ($this->not && $this->not !== null) {
            if (!is_subclass_of(
                $this->not,
                BaseValidator::class,
                true
            )) {
                throw new \Exception(sprintf(
                    'Property "not" MUST extend "%s"',
                    BaseValidator::class
                ));
            }

            $validateNot = $this->not->validate($value);

            if ($validateNot->status === true) {
                //Error
                $return->status = false;

                $return->errorObject = new IncorrectParametersException([[
                    'type' => static::getType(),
                    'failure' => 'not'
                ]]);

                return $return;
            }
        }

        return $return;
    }
792722
public function prepareValue($value, $datatype)
     {
        if ($value === null) {
            return 'NULL';
        }
        switch ($datatype) {
            case Column::TYPE_INTEGER:
                // Filter explicitly because some DBAL silently convert/truncate to integer
                $filtered = filter_var($value, FILTER_VALIDATE_INT);
                if ($filtered === false) {
                    throw new \InvalidArgumentException('Not an integer: '. $value);
                }
                return $filtered; // No quotes necessary
            case Column::TYPE_FLOAT:
            case Column::TYPE_DECIMAL:
                // Filter explicitly because some DBAL silently convert/truncate to float
                $filtered = filter_var($value, FILTER_VALIDATE_FLOAT);
                if ($filtered === false) {
                    throw new \InvalidArgumentException('Not a number: '. $value);
                }
                return $filtered; // No quotes necessary
            case Column::TYPE_BOOL:
                if (is_bool($value)) { // filter_var() does not work with real booleans
                    $filtered = $value;
                } else {
                    $filtered = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
                }
                if ($filtered === null) {
                    throw new \InvalidArgumentException('Not a boolean: ' . $value);
                }
                return (integer)$filtered; // Convert to 0/1 for compatibility with emulated booleans
            case Column::TYPE_BLOB:
                // Handled differently across DBMS and abstraction layers - refuse by default.
                throw new \InvalidArgumentException('Cannot prepare BLOB values');
            default:
                return $this->_link->quoteValue($value, $datatype);
        }
     }
326561
public function parseDateTime($rawValue) {
		if (null === $rawValue) {
			return null;
		}
		
		try {
			$dateTime = DateUtils::createDateTimeFromFormat(MysqlDateTimeColumn::FORMAT_DATE_TIME, $rawValue);
			if ($dateTime->getTimestamp() === false) {
				throw new DateParseException('Invalid datetime raw value: ' . $rawValue);
			}
			return $dateTime;
		} catch (\n2n\util\DateParseException $e) {
			throw new \InvalidArgumentException($e->getMessage(), 0, $e);
		}
	}
1075487
public static function ToType( $value, $conversionType, $provider = null )
	{
		if ( is_null( $value ) ) return null;

		$valueType = Type::FromValue( $value );

		if ( $valueType->getFullName() ==  $conversionType->getFullName() )
			return $value;

		switch( $conversionType->getFullName() )
		{
			case Type::bool:
				return Convert::ToBoolean( $value, $provider );

			case Type::datetime:
				return Convert::ToDateTime( $value, $provider );

			case DecimalValue::$CLASSNAME:
			case Type::decimal:
				return Convert::ToDecimal( $value, $provider );

			case Type::double:
				return Convert::ToDouble( $value, $provider );

			case Type::float:
				return Convert::ToSingle( $value, $provider );

			case Type::int:
				return Convert::ToInt( $value, $provider );

			case Type::long:
				return Convert::ToInt64( $value, $provider );

			case Type::string:
				return Convert::ToString( $value, $provider );

			default:
				throw new NotSupportedException( "Conversion from {$valueType->getFullName()} to {$conversionType->getFullName()} not supported" );
		}

	}
1042237
public function decodeValue($type, $mOrigValue)
    {
        $value = $mOrigValue;
        switch ($type) {
            case 'arr':
            case 'aarr':
                $value = unserialize($mOrigValue);
                break;
            case 'bool':
                $value = ($mOrigValue == 'true' || $mOrigValue == '1');
                break;
        }

        return $value;
    }
628007
public function reverseTransform($value)
    {
        if (null === $value) {
            return false;
        }

        if (!is_bool($value)) {
            throw new UnexpectedTypeException($value, 'Boolean');
        }

        return true === $value ? $this->trueValue : null;
    }
1092771
public function convert(NodeType $nodeType, $propertyName, $rawValue, Context $context)
    {
        $propertyType = $nodeType->getPropertyType($propertyName);

        switch ($propertyType) {
            case 'string':
                return $rawValue;

            case 'reference':
                return $this->convertReference($rawValue, $context);

            case 'references':
                return $this->convertReferences($rawValue, $context);

            case 'DateTime':
                return $this->convertDateTime($rawValue);

            case 'integer':
                return $this->convertInteger($rawValue);

            case 'boolean':
                return $this->convertBoolean($rawValue);

            case 'array':
                return $this->convertArray($rawValue);

            default:
                $innerType = $propertyType;
                if ($propertyType !== null) {
                    try {
                        $parsedType = TypeHandling::parseType($propertyType);
                        $innerType = $parsedType['elementType'] ?: $parsedType['type'];
                    } catch (InvalidTypeException $exception) {
                    }
                }

                if ((is_string($rawValue) || is_array($rawValue)) && $this->objectManager->isRegistered($innerType) && $rawValue !== '') {
                    $propertyMappingConfiguration = new MvcPropertyMappingConfiguration();
                    $propertyMappingConfiguration->allowOverrideTargetType();
                    $propertyMappingConfiguration->allowAllProperties();
                    $propertyMappingConfiguration->skipUnknownProperties();
                    $propertyMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_MODIFICATION_ALLOWED, true);
                    $propertyMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED, true);

                    return $this->propertyMapper->convert($rawValue, $propertyType, $propertyMappingConfiguration);
                } else {
                    return $rawValue;
                }
        }
    }
464908
public static function create($value, $expectedType, $message = null)
    {
        if ($message === null) {
            $errorMessage = sprintf('Expected %s, got %s', $expectedType, self::getStringRepresentation($value));
        } elseif ($message === '') {
            $errorMessage = sprintf('Expected %s', $expectedType);
        } else {
            $errorMessage = sprintf('Expected %s. %s', $expectedType, $message);
        }
        return $errorMessage;
    }
457139
public function expect($type, $value = null)
    {
        if (!$this->match($type, $value)) {
            $msg = "Unexpected token {$this->current()->type} '{$this->current()->value}', expected {$type}";
            throw new \UnexpectedValueException($msg);
        }
        $current = $this->current();
        $this->next();
        return $current;
    }
77235
private function ensureExpectedType($token, $expectedType)
    {
        static $mapping = [
            '(' => PdfString::class,
            '<' => PdfHexString::class,
            '<<' => PdfDictionary::class,
            '/' => PdfName::class,
            '[' => PdfArray::class,
            'true' => PdfBoolean::class,
            'false' => PdfBoolean::class,
            'null' => PdfNull::class
        ];

        if ($expectedType === null || $mapping[$token] === $expectedType) {
            return true;
        }

        throw new Type\PdfTypeException('Got unexpected token type.', Type\PdfTypeException::INVALID_DATA_TYPE);
    }
568799
public function format( DataValue $value, $dataTypeId, GenericOptions $options = null ) {
		if( $options === null ) {
			$options = new GenericOptions();
		}

		$params = array(
			'datavalue' => json_encode( $this->dataValueSerializer->serialize( $value ) ),
			'datatype' => $dataTypeId,
			'options' => json_encode( $options->getOptions() ),
		);

		$result = $this->api->getRequest( new SimpleRequest( 'wbformatvalue', $params ) );
		return $result['result'];
	}