Parse (Unserialize) value.

@param string $value
@param array  $options

@throws ParseException when unserializing fails
179619
public static function parse($value, $options = [])
    {
        $unserializeHandler = ini_set('unserialize_callback_func', self::class . '::handleUnserializeCallback');
        try {
            if (\PHP_VERSION_ID < 70000) {
                return Thrower::call('unserialize', $value);
            }

            return Thrower::call('unserialize', $value, $options);
        } catch (ParseException $e) {
            throw $e;
        } catch (\Throwable $e) {
        } finally {
            ini_set('unserialize_callback_func', $unserializeHandler);
        }

        throw new ParseException('Error parsing serialized value.', -1, null, 0, $e);
    }
21414
public static function toInteger($value, array $options = array())
    {
        $options['precision'] = 0;
        $options['number_format'] = Zend_Locale_Format::STANDARD;
        return self::toNumber($value, $options);
    }
118691
public function serialize($value, array $options=[])
    {
        if (is_resource($value)) {
            throw new UnsupportedParameterException('You cant serialize a resource');
        }

        if ($value === $this->serializeFalseAs) {
            throw new UnsupportedParameterException('You cant serialize '.$this->serializeFalseAs.' cause its internally used to encode false');
        }

        if ($value === false) {
            $value = $this->serializeFalseAs;
        }

        return serialize($value);
    }
150643
public static function parse($value)
    {
        if (is_array($value)) {
            return static::fromArray((array)$value);
        } elseif (is_string($value)) {
            return static::fromString((string)$value);
        } else {
            return null;
        }
    }
769914
public function isValid($value = null, array $options = []): bool
    {
        if (\count($options) > 0) {
            $this->setOptions($options);
        }
        $this->setValue($value);
        $this->errors = [];

        switch ($this->options['type']) {
            case 'equals':
                $isValid = $this->validateEquals();
                break;
            case 'lower-than':
                $isValid = $this->validateLowerThan();
                break;
            case 'greater-than':
                $isValid = $this->validateGreaterThan();
                break;
            default:
                $isValid = $this->validateEquals();
                break;
        }

        return $isValid;
    }
674866
public function add($key, $value, array $options=[]) {
		$options = array_merge(self::$defaults, $options);
		
		if ($this->attributes === null) {
			$this->attributes = new AttributesObject();
		}
		
		$this->validator->claimUsedFields([$key], Validator::OBJECT_CONTAINER_ATTRIBUTES, $options);
		
		$this->attributes->add($key, $value);
	}
638136
public function filter($value, $options = [])
    {
        $value = (string) $value;
        if ($this->getEncoding()) {
            return mb_strtoupper($value, $this->getEncoding());
        }

        return strtoupper($value);
    }
1199499
public static function isInteger($value, array $options = array())
    {
        if (!self::isNumber($value, $options)) {
            return false;
        }

        if (self::getInteger($value, $options) == self::getFloat($value, $options)) {
            return true;
        }

        return false;
    }
112942
public function parse($value)
    {
        switch (true) {

            case is_string($value):
                $this->initFromString($value);
                break;

            case is_int($value):
                $this->initFromInteger($value);
                break;

            case is_array($value):
                $this->initFromArray($value);
                break;

            case is_object($value):
                $this->initFromObject($value);
                break;

            case is_null($value):
                $this->initFromArray([255, 255, 255, 0]);
                break;

            default:
                throw new \Intervention\Image\Exception\NotReadableException(
                    "Color format ({$value}) cannot be read."
                );
        }

        return $this;
    }
352549
public function filter($value, $options = [])
    {
        $value    = (string) $value;
        $filtered = htmlentities(
            $value,
            $this->getQuoteStyle(),
            $this->getEncoding(),
            $this->getDoubleQuote()
        );

        if (strlen($value) && !strlen($filtered)) {
            if (!function_exists('iconv')) {
                $ex = new \Exception('Encoding mismatch has resulted in htmlentities errors.');
                throw $ex;
            }

            $enc      = $this->getEncoding();
            $value    = iconv('', $enc . '//IGNORE', $value);
            $filtered = htmlentities($value, $this->getQuoteStyle(), $enc, $this->getDoubleQuote());

            if (!strlen($filtered)) {
                $ex = new \Exception('Encoding mismatch has resulted in htmlentities errors.');
                throw $ex;
            }
        }

        return $filtered;
    }
347423
protected function prepareResult(&$data, array $options)
    {
        if (!empty($options['unserialize']) && !empty($data)) {
            foreach ((array) $options['unserialize'] as $field) {
                $data[$field] = empty($data[$field]) ? array() : unserialize($data[$field]);
            }
        }
    }
208062
public static function reset($value, array $options = [])
    {
        self::exclure($options, ['type', 'value']);

        return self::input('reset', 'null', $value, $options);
    }
1276472
public function parse(string $value, int $flags = 0)
    {
        if (false === preg_match('//u', $value)) {
            throw new ParseException('The YAML value does not appear to be valid UTF-8.', -1, null, $this->filename);
        }

        $this->refs = [];

        $mbEncoding = null;
        $data = null;

        if (2 /* MB_OVERLOAD_STRING */ & (int) ini_get('mbstring.func_overload')) {
            $mbEncoding = mb_internal_encoding();
            mb_internal_encoding('UTF-8');
        }

        try {
            $data = $this->doParse($value, $flags);
        } finally {
            if (null !== $mbEncoding) {
                mb_internal_encoding($mbEncoding);
            }
            $this->lines = [];
            $this->currentLine = '';
            $this->refs = [];
            $this->skippedLineNumbers = [];
            $this->locallySkippedLineNumbers = [];
        }

        return $data;
    }
867479
public function serialize($value, array $options, $mode) {
        if ($mode === self::TO && $options['encode']) {
            return serialize($value);
        }

        if ($mode === self::FROM && $options['decode']) {
            return @unserialize($value);
        }

        return $value;
    }
166345
public static function encode($value, int $options = null) : string
    {
        if ($options) {
            $encoded = json_encode($value, $options);
        } else {
            $encoded = json_encode($value);
        }

        if (!is_string($encoded)) {
            throw new \InvalidArgumentException(sprintf(
                "Json encode failed (%s) with '%s' and type '%s'",
                json_last_error(),
                json_last_error_msg(),
                gettype($encoded)
            ));
        }

        return $encoded;
    }
284313
function parse( value, options ) {
	var opts;
	if ( arguments.length > 1 ) {
		opts = options;
		opts.meta = false;
	} else {
		opts = {
			'meta': false
		};
	}
	try {
		return alce.parse( value, opts );
	} catch ( error ) {
		return error;
	}
}
1023578
private static function getChoices(Options $options, $value)
    {
        return $value instanceof ChoiceLoaderInterface && empty($options['choices'])
            ? $value->loadChoiceList()->getStructuredValues()
            : $options['choices'];
    }