| Conditions | 4 |
| Paths | 3 |
| Total Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4.0582 |
| Changes | 0 | ||
| 1 | <?php |
||
| 30 | 83 | public function buildOptions(array $annotations, ReflectionMethod $reflectionMethod): RestRequestOptions |
|
| 31 | { |
||
| 32 | 83 | $options = new RestRequestOptions(); |
|
| 33 | 83 | $wrapper = new ReflectionMethodWrapper($reflectionMethod); |
|
| 34 | 83 | $usedAnnotations = []; |
|
| 35 | |||
| 36 | 83 | foreach ($annotations as $annotation) { |
|
| 37 | 83 | $className = get_class($annotation); |
|
| 38 | 83 | if (!$annotation->isSeveralSupported() && isset($usedAnnotations[$className])) { |
|
| 39 | throw new ConfigurationException( |
||
| 40 | sprintf('Only one annotation of type %s is supported', $className) |
||
| 41 | ); |
||
| 42 | } |
||
| 43 | 83 | $usedAnnotations[$className] = true; |
|
| 44 | |||
| 45 | 83 | $annotation->apply($options, $wrapper); |
|
| 46 | } |
||
| 47 | |||
| 48 | 82 | $this->validator->validateRestRequestOptions($options, $wrapper->getFriendlyName()); |
|
| 49 | |||
| 50 | 82 | return $options; |
|
| 51 | } |
||
| 52 | } |
||
| 53 |