Utils::escape()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 1
Metric Value
cc 1
eloc 3
c 3
b 1
f 1
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
4
namespace Manticoresearch;
5
6
trait Utils
7
{
8
    public static function escape($string): string
9
    {
10
        $from = ['\\', '(',')','|','-','!','@','~','"','&', '/', '^', '$', '=', '<'];
11
        $to = ['\\\\', '\(','\)','\|','\-','\!','\@','\~','\"', '\&', '\/', '\^', '\$', '\=', '\<'];
12
        return str_replace($from, $to, $string);
13
    }
14
}
15