Conditions | 4 |
Paths | 5 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4.0119 |
Changes | 0 |
1 | <?php |
||
9 | 3 | protected function createLabel(string $content, array $options): Label |
|
10 | { |
||
11 | 3 | $label = new Label($content); |
|
12 | |||
13 | 3 | foreach ($options as $option => $value) { |
|
14 | 3 | $option = str_replace('_', '', $option); |
|
15 | |||
16 | 3 | $set = 'set' . $option; |
|
17 | 3 | $with = 'with' . $option; |
|
18 | |||
19 | 3 | if (method_exists($label, $set)) { |
|
20 | 3 | $label->$set($value); |
|
21 | } |
||
22 | |||
23 | 3 | if (method_exists($label, $with)) { |
|
24 | $label->$with($value); |
||
25 | } |
||
26 | } |
||
27 | |||
28 | 3 | return $label; |
|
29 | } |
||
31 |