These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php /** MicroUploader */ |
||
2 | |||
3 | namespace Micro\web; |
||
4 | |||
5 | /** |
||
6 | * Uploader class file. |
||
7 | * |
||
8 | * Interface for upload files |
||
9 | * |
||
10 | * @author Oleg Lunegov <[email protected]> |
||
11 | * @link https://github.com/lugnsk/micro |
||
12 | * @copyright Copyright © 2013 Oleg Lunegov |
||
13 | * @license /LICENSE |
||
14 | * @package micro |
||
15 | * @subpackage web |
||
16 | * @version 1.0 |
||
17 | * @since 1.0 |
||
18 | */ |
||
19 | class Uploader |
||
20 | { |
||
21 | /** @var array $files upload files */ |
||
22 | public $files = []; |
||
23 | |||
24 | /** |
||
25 | * Constructor uploads |
||
26 | * |
||
27 | * @access public |
||
28 | * |
||
29 | * @param array $rawData Raw data for setup |
||
30 | * |
||
31 | * @result void |
||
32 | */ |
||
33 | public function __construct(array $rawData = null) |
||
34 | { |
||
35 | $this->setup($rawData); |
||
0 ignored issues
–
show
|
|||
36 | } |
||
37 | |||
38 | /** |
||
39 | * Setup uploader from config array |
||
40 | * |
||
41 | * @access public |
||
42 | * |
||
43 | * @param array $rawData Raw data |
||
44 | * |
||
45 | * @return void |
||
46 | */ |
||
47 | public function setup(array $rawData = []) |
||
48 | { |
||
49 | if (0 === count($rawData)) { |
||
50 | return; |
||
51 | } |
||
52 | |||
53 | if (!empty($rawData['name'])) { |
||
54 | foreach (range(0, count($rawData['name']) - 1) AS $i) { |
||
55 | if (empty($rawData['name'][$i])) { |
||
56 | continue; |
||
57 | } |
||
58 | $this->files[] = [ |
||
59 | 'name' => $rawData['name'][$i], |
||
60 | 'type' => $rawData['type'][$i], |
||
61 | 'error' => $rawData['error'][$i], |
||
62 | 'tmp_name' => $rawData['tmp_name'][$i], |
||
63 | 'size' => $rawData['size'][$i] |
||
64 | ]; |
||
65 | } |
||
66 | } else { |
||
67 | $this->files[] = $rawData; |
||
68 | } |
||
69 | } |
||
70 | } |
||
71 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.