| Total Complexity | 9 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | class RestrictionFormatter |
||
| 6 | { |
||
| 7 | 4 | public static function format($preference, $restrictions) |
|
| 8 | { |
||
| 9 | 4 | foreach ($restrictions as $restrictionType => $query) { |
|
| 10 | 4 | if (!in_array($restrictionType, ['And', 'Not', 'Or'])) { |
|
| 11 | 4 | $restrictions[$restrictionType] = self::formatExpression($preference, $query); |
|
| 12 | } else { |
||
| 13 | 2 | $restrictions[$restrictionType] = self::format($preference, $query); |
|
| 14 | } |
||
| 15 | } |
||
| 16 | |||
| 17 | 4 | return $restrictions; |
|
| 18 | } |
||
| 19 | |||
| 20 | 4 | private static function formatExpression($preference, $expression) |
|
| 29 | } |
||
| 30 | |||
| 31 | 4 | private static function formatFieldURI($preference, $expression) |
|
| 48 |