| Total Complexity | 5 | 
| Total Lines | 45 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 9 | class ResponseMapper implements ResponseMapperInterface  | 
            ||
| 10 | { | 
            ||
| 11 | /**  | 
            ||
| 12 | * @param array $response  | 
            ||
| 13 | * @param ResultInterface $result  | 
            ||
| 14 | *  | 
            ||
| 15 | * @return ResultInterface  | 
            ||
| 16 | */  | 
            ||
| 17 | public function map(array $response, ResultInterface $result): ResultInterface  | 
            ||
| 18 |     { | 
            ||
| 19 |         foreach ($result->getFields() as $field) { | 
            ||
| 20 | $this->mapField($field, $response, $result);  | 
            ||
| 21 | }  | 
            ||
| 22 | |||
| 23 | return $result;  | 
            ||
| 24 | }  | 
            ||
| 25 | |||
| 26 | /**  | 
            ||
| 27 | * Map single field from response to result object. Omit the fields which  | 
            ||
| 28 | * are not present in response array.  | 
            ||
| 29 | * @param string $field  | 
            ||
| 30 | * @param array $response  | 
            ||
| 31 | * @param ResultInterface $result  | 
            ||
| 32 | * @return void  | 
            ||
| 33 | */  | 
            ||
| 34 | protected function mapField($field, array $response, ResultInterface $result)  | 
            ||
| 41 | }  | 
            ||
| 42 | |||
| 43 | /**  | 
            ||
| 44 | * Convert value to camel case method name with first capital letter  | 
            ||
| 45 | * @param string $value  | 
            ||
| 46 | * @return string  | 
            ||
| 47 | */  | 
            ||
| 48 | protected function toMethodName($value)  | 
            ||
| 54 | }  | 
            ||
| 55 | }  | 
            ||
| 56 |