| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2.0078 |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | 2 | public function convertFrom(string $data): DataProviderInterface |
|
| 35 | { |
||
| 36 | 2 | $data = json_decode($data, true); |
|
| 37 | |||
| 38 | 2 | if (!isset($data['data'], $data['class'])) { |
|
| 39 | throw new ConverterException('Data have wrong format to convert (No class or data field)'); |
||
| 40 | } |
||
| 41 | |||
| 42 | 2 | $provider = $data['class']; |
|
| 43 | |||
| 44 | 2 | $provider = $this->createDataProvider($provider); |
|
| 45 | 2 | $provider->fromArray($data['data']); |
|
| 46 | |||
| 47 | 2 | return $provider; |
|
| 48 | } |
||
| 61 |