Total Complexity | 7 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Coverage | 92.31% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
22 | class Request implements RequestCreatorInterface |
||
23 | { |
||
24 | /** |
||
25 | * {@inheritdoc} |
||
26 | */ |
||
27 | 3 | public function __construct(QueryBuilderInterface $builder, Query $query) |
|
28 | { |
||
29 | 3 | $this->builder = $builder; |
|
|
|||
30 | 3 | $this->query = $query; |
|
31 | 3 | } |
|
32 | |||
33 | protected $detectedClass; |
||
34 | |||
35 | /** |
||
36 | * {@inheritdoc} |
||
37 | */ |
||
38 | 3 | public function createRequest() |
|
39 | { |
||
40 | 3 | if ($this->detectedClass === null) { |
|
41 | 3 | $this->detectedClass = $this->detectClass(); |
|
42 | } |
||
43 | |||
44 | 3 | return new $this->detectedClass($this->builder, $this->query); |
|
45 | } |
||
46 | |||
47 | public $tryClasses = [ |
||
48 | \hiqdev\hiart\guzzle\Request::class, |
||
49 | \hiqdev\hiart\httpclient\Request::class, |
||
50 | \hiqdev\hiart\curl\Request::class, |
||
51 | \hiqdev\hiart\stream\Request::class, |
||
52 | ]; |
||
53 | |||
54 | 3 | public function detectClass() |
|
63 | } |
||
64 | } |
||
65 |