1 | <?php |
||
18 | class Download |
||
19 | { |
||
20 | |||
21 | /** |
||
22 | * Language model instance |
||
23 | * @var \gplcart\core\models\Language $language |
||
24 | */ |
||
25 | protected $language; |
||
26 | |||
27 | /** |
||
28 | * Installer model class instance |
||
29 | * @var \gplcart\modules\installer\models\Install $install |
||
30 | */ |
||
31 | protected $install; |
||
32 | |||
33 | /** |
||
34 | * File transfer model instance |
||
35 | * @var \gplcart\core\models\FileTransfer $file_transfer |
||
36 | */ |
||
37 | protected $file_transfer; |
||
38 | |||
39 | /** |
||
40 | * An array of errors |
||
41 | * @var array |
||
42 | */ |
||
43 | protected $errors = array(); |
||
44 | |||
45 | /** |
||
46 | * An array of the current job |
||
47 | * @var array |
||
48 | */ |
||
49 | protected $job = array(); |
||
50 | |||
51 | /** |
||
52 | * The current processing URL |
||
53 | * @var string |
||
54 | */ |
||
55 | protected $data_url; |
||
56 | |||
57 | /** |
||
58 | * Download constructor. |
||
59 | * @param FileTransfer $file_transfer |
||
60 | * @param Install $install |
||
61 | */ |
||
62 | public function __construct(FileTransfer $file_transfer, Install $install) |
||
67 | |||
68 | /** |
||
69 | * Processes one job iteration |
||
70 | * @param array $job |
||
71 | */ |
||
72 | public function process(array &$job) |
||
86 | |||
87 | /** |
||
88 | * Install a module |
||
89 | * @return boolean |
||
90 | */ |
||
91 | protected function install() |
||
114 | |||
115 | /** |
||
116 | * Download a module file from a remote source |
||
117 | * @return boolean|string |
||
118 | */ |
||
119 | protected function download() |
||
134 | |||
135 | /** |
||
136 | * Returns a total number of errors and logs them |
||
137 | * @return integer |
||
138 | */ |
||
139 | protected function countErrors() |
||
149 | |||
150 | /** |
||
151 | * Logs all errors happened for the URL |
||
152 | * @param integer $url |
||
153 | * @param array $errors |
||
154 | * @return boolean |
||
155 | */ |
||
156 | protected function logErrors($url, array $errors) |
||
161 | |||
162 | /** |
||
163 | * Sets a error |
||
164 | * @param string|array $error |
||
165 | */ |
||
166 | protected function setError($error) |
||
172 | |||
173 | } |
||
174 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.