Passed
Push — master ( 8f1d03...3f48a5 )
by Bingo
02:51
created

AbstractEscaper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 25
ccs 0
cts 10
cp 0
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A escape() 0 11 3
1
<?php
2
3
namespace PhpDocxTemplate\Escaper;
4
5
abstract class AbstractEscaper implements EscaperInterface
6
{
7
    /**
8
     * @param string $input
9
     *
10
     * @return string
11
     */
12
    abstract protected function escapeSingleValue(string $input): string;
13
14
    /**
15
     * @param mixed $input
16
     *
17
     * @return mixed
18
     */
19
    public function escape($input)
20
    {
21
        if (is_array($input)) {
22
            foreach ($input as &$item) {
23
                $item = $this->escapeSingleValue($item);
24
            }
25
        } else {
26
            $input = $this->escapeSingleValue($input);
27
        }
28
29
        return $input;
30
    }
31
}
32