Conditions | 2 |
Paths | 2 |
Total Lines | 23 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | 2 | public function getPhpFileArray() |
|
15 | { |
||
16 | 2 | if ($this->getValue()) { |
|
17 | 1 | $tmpFile = tempnam(sys_get_temp_dir(), 'crawler-uploaded-file'); |
|
18 | 1 | copy($this->getValue(), $tmpFile); |
|
19 | |||
20 | return [ |
||
21 | 1 | 'tmp_name' => $tmpFile, |
|
22 | 1 | 'size' => filesize($this->getValue()), |
|
23 | 1 | 'error' => UPLOAD_ERR_OK, |
|
24 | 1 | 'name' => $this->getValue(), |
|
25 | 1 | 'type' => Psr7\mimetype_from_filename($this->getValue()) |
|
26 | 1 | ]; |
|
27 | } else { |
||
28 | return [ |
||
29 | 1 | 'tmp_name' => '', |
|
30 | 1 | 'size' => '0', |
|
31 | 1 | 'error' => UPLOAD_ERR_NO_FILE, |
|
32 | 1 | 'name' => '', |
|
33 | 'type' => '' |
||
34 | 1 | ]; |
|
35 | } |
||
36 | } |
||
37 | } |
||
38 |