| Conditions | 3 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | 48 | public static function parse($name, $config): ?Method |
|
| 38 | { |
||
| 39 | 48 | assert(in_array($name, [self::LIST, self::POST, self::GET, self::PUT, self::DELETE])); |
|
| 40 | 48 | assert(is_string($name)); |
|
| 41 | |||
| 42 | 48 | $method = new Method(); |
|
| 43 | 48 | $method->name = $name; |
|
| 44 | 48 | if (is_bool($config) && true === $config) { |
|
| 45 | 28 | return $method; |
|
| 46 | } |
||
| 47 | |||
| 48 | 48 | $method->right = Right::parse($config['right']?? null); |
|
| 49 | 48 | $method->defaultIncludes = ParseUtils::parseStringArray($config['defaultIncludes'] ?? null); |
|
| 50 | |||
| 51 | 48 | return $method; |
|
| 52 | } |
||
| 53 | } |
||
| 54 |