Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | public static function stringToInt(string $searchStr, $typeClassName) |
||
20 | { |
||
21 | $items = []; |
||
22 | /** @var BaseType $type */ |
||
23 | $type = \Yii::createObject($typeClassName); |
||
24 | if (!$type instanceof BaseType) { |
||
|
|||
25 | throw new InternalException('search string to Int fail'); |
||
26 | } |
||
27 | $searchArr = explode(', ', $searchStr); |
||
28 | foreach ($searchArr as $search) { |
||
29 | if (in_array($search, $type::names())) { |
||
30 | $items[] = $type::toEnumValue($search); |
||
31 | } |
||
32 | } |
||
33 | return implode(', ', $items); |
||
34 | } |
||
36 |