Производим "безопасные" замены в значении статьи (например: "11.23 Ч.2" или "12.18") для осуществления более
"мягкого" поиска (без зависимости точного указания, например, "Ч" или "часть").

@param string $value

@return string
543706
protected function clearArticleValue($value)
    {
        // Заменяем все символы, кроме чисел - на точки + trim по точкам
        $value = \trim(\preg_replace('/[\D]/', '.', (string) $value), '.');

        // Множественные точки - заменяем на одинарные
        $value = \preg_replace('/\.+/', '.', $value);

        // И возвращаем значение
        return (string) $value;
    }
434135
public static function kebabCase($value)
    {
        $key = $value;
        if (isset(static::$kebabCache[$key])) {
            return static::$kebabCache[$key];
        }

        $value = preg_replace('/\s+/', '', ucwords($value));
        $value = str_replace('_', '-', $value);
        $value = static::normalizeScreamingCase($value);
        return static::$kebabCache[$key] =  strtolower(preg_replace('~(?<=\\w)([A-Z])~', '-$1', $value));
    }
98607
public function transform(string $value): string {
        
        if (strpos($value, 'hdl.handle.net') !== false) {
            $value = str_replace("http://", "", $value);
        }else if(strpos($value, 'https') !== false) {
            $value = str_replace("https://", "", $value);
        }else {
            $value = str_replace("http://", "", $value);
        }
        return $value;
        
    }
232747
public static function getStringValue($value): string
    {
        if ($value instanceof \DateTime) {
            return $value->format(self::DEFAULT_DATETIME_FORMAT);
        } elseif (is_bool($value)) {
            return $value ? 'true' : 'false';
        } elseif (is_array($value)) {
            return implode(', ', array_map('self::getStringValue', $value));
        }

        return (string) $value;
    }
1174969
public function encode($value)
    {
        $encryptedValue = $this->getEncryptor()->encrypt($value);
        $encodedValue = base64_encode($encryptedValue);

        return $encodedValue;
    }
89002
public function value($value)
    {
        //terminal case
        if (!is_array($value)) {
            if (strpbrk($value, Lexer::ESCAPED_STRING) !== false) {
                if (!(substr($value, 0, 1) == '"' && substr($value, -1) == '"')) {
                    return '(' . addcslashes($value, Lexer::ESCAPED_STRING_PAREN_ENCAPSED) . ')';
                }
            }
            return $value;
        }

        //composite value case
        $pairs = array();
        foreach ($value as $key => $subval) {
            $pairs[] = "{$this->identifier($key)} = {$this->value($subval)}";
        }

        return '(' . implode(', ', $pairs) . ')';
    }
1180519
public function filter ($value)
    {
        //translitere specific chars
        $value = $this->_transliterateCzech($value);
        $value = $this->_transliterateSlovak($value);
        $value = $this->_transliterateRussian($value);
        $value = $this->_transliterateGerman($value);
        $value = $this->_transliterateFrench($value);
        $value = $this->_transliterateHungarian($value);
        $value = $this->_transliteratePolish($value);
        $value = $this->_transliterateDanish($value);
        $value = $this->_transliterateCroatian($value);
        
        //split string to single characters
        $characters = mb_split("~(.)~", $value);

        $return = '';
        foreach ($characters as $character) {
            /*  maybe should contain also //IGNORE  */
            $converted = iconv("utf-8", "ASCII//TRANSLIT", $character);
            
            //if character was converted, strip out wrong marks
            if ($character !== $converted) {
                $return .= preg_replace('~["\'^]+~', '', $converted);
            } else {
                $return .= $converted;
            }
        }
        return $return;
    }
860535
protected function getType(&$value)
    {
        switch (true) {
            // Punctuation
            case ($value[0] === ','):
                $type = self::T_COMMA;
                break;

            // Recognize numeric values
            case (is_numeric($value)):
                if (strpos($value, '.') !== false || stripos($value, 'e') !== false) {
                    $value = (float)$value;
                    $type = self::T_FLOAT;
                    break;
                }

                $value = (int)$value;
                $type = self::T_INTEGER;
                break;

            // Recognize quoted strings
            case ($value[0] === '"'):
                $value = str_replace('""', '"', substr($value, 1, strlen($value) - 2));

                $type = self::T_STRING;
                break;
            case ($value[0] === "'"):
                $value = str_replace("''", "'", substr($value, 1, strlen($value) - 2));

                $type = self::T_STRING;
                break;

            case (preg_match('/[a-z_][a-z0-9_]*/i', $value)):
                $type = self::T_INPUT_PARAMETER;
                break;

            // Comparison operator
            case ($value === '='):
                $type = self::T_EQUALS;
                break;
            case ($value === '≠'):
            case ($value === '!='):
                $value = '≠';
                $type = self::T_NOT_EQUALS;
                break;
            case ($value === '>'):
                $type = self::T_GREATER_THAN;
                break;
            case ($value === '>='):
            case ($value === '≥'):
                $value = '≥';
                $type = self::T_GREATER_THAN_EQUALS;
                break;
            case ($value === '<'):
                $type = self::T_LOWER_THAN;
                break;
            case ($value === '<='):
            case ($value === '≤'):
                $value = '≤';
                $type = self::T_LOWER_THAN_EQUALS;
                break;

            // Composite operator
            case ($value === '&'):
                $type = self::T_AND;
                break;
            case ($value === '!&'):
                $type = self::T_NOT_AND;
                break;
            case ($value === '|'):
                $type = self::T_OR;
                break;
            case ($value === '!|'):
                $type = self::T_NOT_OR;
                break;
            case ($value === '^|'):
            case ($value === '⊕'):
                $value = '⊕';
                $type = self::T_XOR;
                break;

            // Brace
            case ($value === '('):
                $type = self::T_OPEN_PARENTHESIS;
                break;
            case ($value === ')'):
                $type = self::T_CLOSE_PARENTHESIS;
                break;
            case ($value === '['):
                $type = self::T_OPEN_SQUARE_BRACKET;
                break;
            case ($value === '!['):
                $type = self::T_NOT_OPEN_SQUARE_BRACKET;
                break;
            case ($value === ']'):
                $type = self::T_CLOSE_SQUARE_BRACKET;
                break;
            case ($value === '{{'):
                $type = self::T_DOUBLE_OPEN_CURLY_BRACKET;
                break;
            case ($value === '!{{'):
                $type = self::T_NOT_DOUBLE_OPEN_CURLY_BRACKET;
                break;
            case ($value === '}}'):
                $type = self::T_DOUBLE_CLOSE_CURLY_BRACKET;
                break;

            // Default
            default:
                throw new UnknownTokenTypeException($value);
        }

        return $type;
    }
228701
public static function encode($value)
    {
        $value = gmp_init($value, 10);
        $octets = chr(gmp_strval(gmp_and($value, 0x7f), 10));

        $rightShift = function ($number, $positions) {
            return gmp_div($number, gmp_pow(2, $positions));
        };

        $value = $rightShift($value, 7);
        while (gmp_cmp($value, 0) > 0) {
            $octets .= chr(gmp_strval(gmp_or(0x80, gmp_and($value, 0x7f)), 10));
            $value = $rightShift($value, 7);
        }

        return strrev($octets);
    }
1130567
protected function csvEncode($value)
    {
        if (!$value) {
            return null;
        }
        return implode(
            ',',
            array_map(
                function ($x) {
                    return str_replace(',', '', $x);
                },
                array_values($value)
            )
        );
    }
1193438
protected function replaceSymbols($value)
    {
        $language = $this->translator->getCurrentLanguage();

        if (!isset($this->symbols[$language])) {
            $this->symbols[$language] = array(
                '.' => $this->translator->translate('Intl_NumberSymbolDecimal'),
                ',' => $this->translator->translate('Intl_NumberSymbolGroup'),
                '+' => $this->translator->translate('Intl_NumberSymbolPlus'),
                '-' => $this->translator->translate('Intl_NumberSymbolMinus'),
                '%' => $this->translator->translate('Intl_NumberSymbolPercent'),
            );
        }

        return strtr($value, $this->symbols[$language]);
    }
677207
private function stringify($value)
    {
        if (is_bool($value)) {
            return $value ? '<TRUE>' : '<FALSE>';
        } elseif (is_scalar($value)) {
            $val = (string) $value;

            if (strlen($val) > 100) {
                $val = substr($val, 0, 97).'...';
            }

            return $val;
        } elseif (is_array($value)) {
            return '<ARRAY>';
        } elseif (is_object($value)) {
            return sprintf('%s [%s]', get_class($value), spl_object_hash($value));
        } elseif (is_resource($value)) {
            return '<RESOURCE>';
        } elseif (is_null($value)) {
            return '<NULL>';
        } else {
            return 'unknown';
        }
    }
668444
private static function stringify($value)
    {
        if (is_bool($value)) {
            return $value ? '<TRUE>' : '<FALSE>';
        }

        if (is_scalar($value)) {
            $val = (string)$value;

            if (strlen($val) > 100) {
                $val = substr($val, 0, 97) . '...';
            }

            return $val;
        }

        if (is_array($value)) {
            return '<ARRAY>';
        }

        if (is_object($value)) {
            return get_class($value);
        }

        if (is_resource($value)) {
            return '<RESOURCE>';
        }

        if ($value === NULL) {
            return '<NULL>';
        }

        return 'unknown';
    }
233536
public static function convertFromSQLKeywords($value)
    {
        $pattern = array(
            '/(?:is\s+null)|(like\s+null)|' .
            '(?:(?:^|\W)in[+\s]*\([\s\d"]+[^()]*\))/ims'
        );
        $value   = preg_replace($pattern, '"=0', $value);

        $value   = preg_replace('/[^\w\)]+\s*like\s*[^\w\s]+/ims', '1" OR "1"', $value);
        $value   = preg_replace('/null([,"\s])/ims', '0$1', $value);
        $value   = preg_replace('/\d+\./ims', ' 1', $value);
        $value   = preg_replace('/,null/ims', ',0', $value);
        $value   = preg_replace('/(?:between)/ims', 'or', $value);
        $value   = preg_replace('/(?:and\s+\d+\.?\d*)/ims', '', $value);
        $value   = preg_replace('/(?:\s+and\s+)/ims', ' or ', $value);

        $pattern = array(
            '/(?:not\s+between)|(?:is\s+not)|(?:not\s+in)|' .
            '(?:xor|<>|rlike(?:\s+binary)?)|' .
            '(?:regexp\s+binary)|' .
            '(?:sounds\s+like)/ims'
        );
        $value   = preg_replace($pattern, '!', $value);
        $value   = preg_replace('/"\s+\d/', '"', $value);
        $value   = preg_replace('/(\W)div(\W)/ims', '$1 OR $2', $value);
        $value   = preg_replace('/\/(?:\d+|null)/', null, $value);

        return $value;
    }
227506
private function generateMessage($value)
    {
        if (is_object($value)) {
            return sprintf('An instance of "%s" is not suitable as cache key data', get_class($value));
        }

        return sprintf('A variable of type "%s" is not suitable as cache key data', gettype($value));
    }
1181907
private function serializeField($value)
    {
        if (is_string($value)) {
            // @todo Could be decimal (D) or byte array (x)
            // @see https://github.com/recoilphp/amqp/issues/25
            return 'S' . $this->serializeLongString($value);
        }
        if (is_int($value)) {
            // @todo Could be timestamp (T)
            // @see https://github.com/recoilphp/amqp/issues/25
            if ($value >= 0) {
                if ($value < 0x80) {
                    return 'b' . $this->serializeSignedInt8($value);
                }
                if ($value < 0x8000) {
                    return 's' . $this->serializeSignedInt16($value);
                }
                if ($value < 0x80000000) {
                    return 'I' . $this->serializeSignedInt32($value);
                }
            } else {
                if ($value >= -0x80) {
                    return 'b' . $this->serializeSignedInt8($value);
                }
                if ($value >= -0x8000) {
                    return 's' . $this->serializeSignedInt16($value);
                }
                if ($value >= -0x80000000) {
                    return 'I' . $this->serializeSignedInt32($value);
                }
            }

            return 'l' . $this->serializeSignedInt64($value);
        }
        if (true === $value) {
            return "t\x01";
        }
        if (false === $value) {
            return "t\x00";
        }
        if (null === $value) {
            return 'V';
        }
        if (is_float($value)) {
            return 'd' . $this->serializeDouble($value);
        }
        if (is_array($value)) {
            return $this->serializeArrayOrTable($value);
        }
        throw new InvalidArgumentException(
            'Could not serialize value (' . chr($value) . ').'
        );
    }
1326924
static function lowercase($value, &$error, $args)
    {
        $result = mb_strtolower($value, 'utf-8');
        if ($value != $result){
            $error = new Error('Не все символы в нижнем регистре', 'lowercase');
        }
        return $result;
    }