| Conditions | 3 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public static function forName(string $name): PermissionInterface |
||
| 21 | { |
||
| 22 | $names = explode("_", strtolower($name)); |
||
| 23 | $func = $names[0]; |
||
| 24 | if (count($names) > 1) { |
||
| 25 | for ($i = 1; $i < count($names); $i += 1) { |
||
|
|
|||
| 26 | $func .= ucfirst($names[$i]); |
||
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | return self::$func(); |
||
| 31 | } |
||
| 47 |
If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration: