Passed
Push — master ( 58b65e...aa71b5 )
by WEBEWEB
04:28
created

SyntaxHighlighterEncoder::booleanToString()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 4
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of the syntaxhighligter-bundle package.
5
 *
6
 * (c) 2018 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Bundle\SyntaxHighlighterBundle\Encoder;
13
14
use WBW\Library\Core\Utility\StringUtility;
15
16
/**
17
 * SyntaxHighlighter encoder.
18
 *
19
 * @author webeweb <https://github.com/webeweb/>
20
 * @package WBW\Bundle\SyntaxHighlighterBundle\Encoder
21
 * @final
22
 */
23
final class SyntaxHighlighterEncoder {
24
25
    /**
26
     * Convert a array value.
27
     *
28
     * @param array $value The array value.
29
     * @param array $output The output array.
30
     * @param string $prefix The prefix.
31
     * @param string $suffix The suffix.
32
     */
33
    public static function arrayToString(array $value, array &$output, $prefix, $suffix) {
34
        if (null !== $value) {
0 ignored issues
show
introduced by
The condition null !== $value is always true.
Loading history...
35
            $output[] = $prefix . "[" . implode(", ", $value) . "]" . $suffix;
36
        }
37
    }
38
39
    /**
40
     * Convert a boolean value.
41
     *
42
     * @param boolean $value The boolean value.
43
     * @param array $output The output array.
44
     * @param string $prefix The prefix.
45
     * @param string $suffix The suffix.
46
     */
47
    public static function booleanToString($value, array &$output, $prefix, $suffix) {
48
        if (null !== $value) {
0 ignored issues
show
introduced by
The condition null !== $value is always true.
Loading history...
49
            $output[] = $prefix . StringUtility::parseBoolean($value) . $suffix;
50
        }
51
    }
52
53
    /**
54
     * Convert a string value.
55
     *
56
     * @param string $value The string value.
57
     * @param array $output The output array.
58
     * @param string $prefix The prefix.
59
     * @param string $suffix The suffix.
60
     */
61
    public static function stringToString($value, array &$output, $prefix, $suffix) {
62
        if (null !== $value) {
0 ignored issues
show
introduced by
The condition null !== $value is always true.
Loading history...
63
            $output[] = $prefix . $value . $suffix;
64
        }
65
    }
66
67
}
68