Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | public static function make(string $data, string $curlResponse = null, string $dto = null): IResponseInterface |
||
23 | { |
||
24 | if (!in_array(IResponseHandlerInterface::class, class_implements($curlResponse))) { |
||
25 | throw new \Exception("{$dto} must be implements the interface " . IResponseHandlerInterface::class . "!"); |
||
26 | } |
||
27 | |||
28 | if (!in_array(IResponseDataInterface::class, class_implements($dto))) { |
||
29 | throw new \Exception("{$dto} must be implements the interface " . IResponseDataInterface::class . "!"); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @var IResponseHandlerInterface $curlResponse |
||
34 | */ |
||
35 | $curlResponse = new $curlResponse(); |
||
36 | |||
37 | return $curlResponse->build($data, $dto); |
||
38 | } |
||
40 |