@param  string $value
@param  array $options

@return mixed

@throws \Exception
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;
    }
1282542
protected function findData($value, array $options)
    {
        if (!\is_array($value)) {
            $msg = 'Value must be an array';
            throw new \UnexpectedValueException($msg);
        }

        /** @var FamilyInterface $family */
        $family = $options['family'];
        /** @var DataRepository $repository */
        $repository = $options['repository'];

        $eavQb = $repository->createFamilyQueryBuilder($family, 'e');

        $queryParts = [];
        /** @noinspection ForeachSourceInspection */
        foreach ($value as $attributeCode => $attributeValue) {
            if (\is_array($attributeValue)) {
                $queryParts[] = $eavQb->a($attributeCode)->in($attributeValue);
            } elseif (null !== $attributeValue
                && $attributeValue === $family->getAttribute($attributeCode)->getDefault()
            ) {
                $queryParts[] = $eavQb->getOr(
                    [
                        $eavQb->a($attributeCode)->equals($attributeValue),
                        $eavQb->a($attributeCode)->isNull(), // Handles default values not persisted to database
                    ]
                );
            } else {
                $queryParts[] = $eavQb->a($attributeCode)->equals($attributeValue);
            }
        }

        $qb = $eavQb->apply($eavQb->getAnd($queryParts));
        $qb->distinct();

        try {
            $data = $qb->getQuery()->getOneOrNullResult();
        } catch (NonUniqueResultException $e) {
            $msg = "Non unique entity for family {$family->getCode()} and";
            foreach ($value as $attribute => $attributeValue) {
                $msg .= " attribute {$attribute} with value '{$attributeValue}'";
            }
            throw new \UnexpectedValueException($msg);
        }

        if (null === $data && !$options['ignore_missing']) {
            $msg = "Missing entity for family {$family->getCode()} and";
            foreach ($value as $attribute => $attributeValue) {
                $msg .= " attribute {$attribute} with value '{$attributeValue}'";
            }
            throw new \UnexpectedValueException($msg);
        }

        return $data;
    }
1298290
public function isValid($value = null, array $options = []): bool
    {
        if (\count($options) > 0) {
            $this->setOptions($options);
        }
        $this->setValue($value);
        $this->errors = [];

        $validType = $this->validateType();
        $validGT = $this->validateGreaterThan();
        $validLT = $this->validateLowerThan();

        return $validType && $validGT && $validLT;
    }
333225
public function option(String $options, $value) : CURL
    {
        $this->options[Helper::toConstant($options, 'CURLOPT_')] = $value;

        return $this;
    }
535979
public function isValid($value = null, array $options = []): bool
    {
        $this->setOptions($options);
        $this->setValue($value);
        $this->errors = [];

        $isValid = $this->validatePesel();

        return $isValid;
    }
132385
public function isValid($value = null, array $options = []): bool
    {
        $this->setOptions($options);
        $this->setValue(\str_replace(['-', ' '], '', $value));
        $this->errors = [];

        return $this->validateNip();
    }
464424
public function serialize($value, array $options = [])
    {

        if (!is_object($value) && !is_array($value)) {
            return $value;
        }

        if (is_array($value) || $value instanceof Serializable) {
            return serialize($value);
        }

        if (!$value instanceof Identifiable) {
            throw new UnsupportedParameterException("Cannot serialize value of type " . Type::of($value));
        }

        if($pointer = $this->entityManager->pointer($value)) {
            return $this->serialize($pointer);
        };

        throw new UnsupportedParameterException("Cannot serialize value of type " . Type::of($value));

    }
1217773
public static function json(&$value, $options = ['json_assoc'=>true, 'json_schema'=>[], 'default'=>null])
    {
        $json_assoc = isset($options['json_assoc']) && $options['json_assoc'] ? true : false;
        $value = @json_decode(trim($value), $json_assoc);

        if ($value !== null && $json_assoc && isset($options['json_schema']) && $options['json_schema'] && is_array($options['json_schema'])) {
            foreach ($options['json_schema'] as $field => $opt_arr) {
                self::validate(
                    $value[$field],
                    isset($opt_arr[0]) ? $opt_arr[0] : self::NONE_TYPE,
                    isset($opt_arr[1]) && is_array($opt_arr[1]) ? $opt_arr[1] : []
                );
            }
        } elseif ($value === null) {
            $value = isset($options['default']) ? $options['default'] : null;
        }

        return $value;
    }
263865
public function make($value, array $options = array())
    {
        $cost = isset($options['rounds']) ? $options['rounds'] : $this->rounds;

        $hash = password_hash($value, PASSWORD_DEFAULT, array('cost' => $cost));

        if ($hash === false) {
            throw new \RuntimeException("Bcrypt hashing not supported.");
        }

        return $hash;
    }
771190
public function isValid($value = null, array $options = []): bool
    {
        if (\count($options) > 0) {
            $this->setOptions($options);
        }
        $this->setValue($value);
        $this->errors = [];

        if (\strpos($this->value, '..') !== false || !\preg_match('/^(.+)@([^@]+)$/', $this->value, $matches)) {
            $this->setError(self::VALIDATOR_ERROR_EMAIL_INCORRECT_FORMAT);
            return false;
        }
        if (!\filter_var($this->value, FILTER_VALIDATE_EMAIL) !== false) {
            $this->setError(self::VALIDATOR_ERROR_EMAIL_INCORRECT_FORMAT);
            return false;
        }
        $host = $matches[2];
        if ($this->options['domain-check'] === true && @\gethostbyname($host) === $host) {
            $this->setError(self::VALIDATOR_ERROR_EMAIL_INVALID_DOMAIN);
            return false;
        }
        if ($this->options['mx-check'] === true) {
            return $this->mxCheck($host);
        }

        return true;
    }
461532
final public static function hasNumber ($value, array $options=[]) : bool
	{
		if (!self::hasValue($value))  new ErrorCode(1001);

		// Submitted values are strings, so use is_numeric instead of is_int
		if (!is_numeric($value)) return FALSE;

		if (!empty($options)) return static::hasLength($value, $options);

		return TRUE;
	}
157380
protected function mapValuesToOptions(array $value, array $options)
    {
        $result = [];
        foreach ($value as $key) {
            $result[] = $this->mapValueToOption($key, $options);
        }
        return $result;
    }
239580
public static function Base64Encode ($value, $options = []) {
		$to_encoding = isset($options['to_encoding']) ? $options['to_encoding'] : false;
		if ($to_encoding !== false) {
			$from_encoding = isset($options['from_encoding']) ? $options['from_encoding'] : static::DEFAULT_ENCODING;
			$value = mb_convert_encoding($value, $to_encoding, $from_encoding);
		}
		return base64_encode($value);
	}
208062
public static function reset($value, array $options = [])
    {
        self::exclure($options, ['type', 'value']);

        return self::input('reset', 'null', $value, $options);
    }
22523
protected function link($value, array $options)
    {
        $return = is_string($value) ? $value : (is_array($value) ? implode(',', $value) : $value);

        if ($options['link']) {
            return sprintf('<a href="%s">%s</a>', $options['link'], $return);
        }

        if ($options['route']) {
            $url = $this->generator->generate($options['route'], $options['parameters'] ?? []);

            return sprintf('<a href="%s">%s</a>', $url, $return);
        }

        return $return;
    }
870313
public static function toFloat($value, array $options = array())
    {
        $options['number_format'] = Zend_Locale_Format::STANDARD;
        return self::toNumber($value, $options);
    }
957631
protected static function processUNum(&$value, $options)
    {
        if (!isset($options['min']) || empty($options['min']) || $options['min'] < 0) {
            $options['min'] = 0;
        }
        self::processNum($value, $options);
    }