1 | <?php |
||||
2 | /** |
||||
3 | * ActiveRecord for API |
||||
4 | * |
||||
5 | * @link https://github.com/hiqdev/yii2-hiart |
||||
6 | * @package yii2-hiart |
||||
7 | * @license BSD-3-Clause |
||||
8 | * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/) |
||||
9 | */ |
||||
10 | |||||
11 | namespace hiqdev\hiart\auto; |
||||
12 | |||||
13 | use hiqdev\hiart\Query; |
||||
14 | use hiqdev\hiart\QueryBuilderInterface; |
||||
15 | use hiqdev\hiart\RequestCreatorInterface; |
||||
16 | use hiqdev\hiart\RequestErrorException; |
||||
17 | |||||
18 | /** |
||||
19 | * Auto Request. |
||||
20 | * Detects best available transport in the system. |
||||
21 | */ |
||||
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; |
|||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||||
30 | 3 | $this->query = $query; |
|||
0 ignored issues
–
show
|
|||||
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, |
||||
0 ignored issues
–
show
The type
hiqdev\hiart\guzzle\Request was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
49 | \hiqdev\hiart\httpclient\Request::class, |
||||
0 ignored issues
–
show
The type
hiqdev\hiart\httpclient\Request was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
50 | \hiqdev\hiart\curl\Request::class, |
||||
51 | \hiqdev\hiart\stream\Request::class, |
||||
52 | ]; |
||||
53 | |||||
54 | 3 | public function detectClass() |
|||
55 | { |
||||
56 | 3 | foreach ($this->tryClasses as $class) { |
|||
57 | 3 | if (class_exists($class) && $class::isSupported()) { |
|||
58 | 3 | return $class; |
|||
59 | } |
||||
60 | } |
||||
61 | |||||
62 | throw new RequestErrorException('could not auto detect Request class'); |
||||
0 ignored issues
–
show
The call to
hiqdev\hiart\RequestErrorException::__construct() has too few arguments starting with request .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||
63 | } |
||||
64 | } |
||||
65 |