1 | <?php |
||
12 | class Renderer |
||
13 | { |
||
14 | /** |
||
15 | * Constants determining how the library should handle array values |
||
16 | */ |
||
17 | const ARRAY_MODE_ARRAY = 1; |
||
18 | const ARRAY_MODE_CONCAT = 2; |
||
19 | |||
20 | /** |
||
21 | * Constants determining how the library should handle boolean values |
||
22 | */ |
||
23 | const BOOLEAN_MODE_INTEGER = 1; |
||
24 | const BOOLEAN_MODE_BOOL_STRING = 2; |
||
25 | const BOOLEAN_MODE_STRING = 3; |
||
26 | |||
27 | /** |
||
28 | * @var int |
||
29 | */ |
||
30 | protected $arrayMode = self::ARRAY_MODE_ARRAY; |
||
31 | |||
32 | /** |
||
33 | * @var int |
||
34 | */ |
||
35 | protected $booleanMode = self::BOOLEAN_MODE_INTEGER; |
||
36 | |||
37 | /** |
||
38 | * @param int $arrayMode |
||
39 | * @param int $booleanMode |
||
40 | */ |
||
41 | 14 | public function __construct($arrayMode = self::ARRAY_MODE_ARRAY, $booleanMode = self::BOOLEAN_MODE_INTEGER) |
|
46 | |||
47 | /** |
||
48 | * Renders an INI configuration. |
||
49 | * |
||
50 | * @param array $ini |
||
51 | * |
||
52 | * @return string |
||
53 | */ |
||
54 | 13 | public function render(array $ini) |
|
95 | |||
96 | /** |
||
97 | * Renders a key-value pair. |
||
98 | * |
||
99 | * @param string $key |
||
100 | * @param mixed $value |
||
101 | * |
||
102 | * @return array |
||
103 | */ |
||
104 | 12 | protected function renderKeyValuePair($key, $value) |
|
119 | |||
120 | /** |
||
121 | * Normalize value to valid INI format. |
||
122 | * |
||
123 | * @param mixed $value |
||
124 | * |
||
125 | * @return string |
||
126 | */ |
||
127 | 12 | protected function normalizeValue($value) |
|
143 | |||
144 | /** |
||
145 | * Normalizes arrays. |
||
146 | * |
||
147 | * @param array $value |
||
148 | * |
||
149 | * @return array|string |
||
150 | */ |
||
151 | 7 | protected function normalizeArray($value) |
|
177 | |||
178 | /** |
||
179 | * Normalizes a boolean value; |
||
180 | * |
||
181 | * @param bool $value |
||
182 | * |
||
183 | * @return int|string |
||
184 | */ |
||
185 | 4 | protected function normalizeBoolean($value) |
|
205 | } |
||
206 |
The break statement is not necessary if it is preceded for example by a return statement:
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.