1 | <?php |
||
29 | abstract class Factory |
||
30 | { |
||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | protected static $fileKeys = array('error', 'name', 'size', 'tmp_name', 'type'); |
||
35 | |||
36 | /** |
||
37 | * Factory for save instance creation. |
||
38 | * |
||
39 | * <code> |
||
40 | * // Create an instance using the factory method. |
||
41 | * $file = \Pimf\Util\Uploaded\Factory::get($_FILES); |
||
42 | * </code> |
||
43 | * |
||
44 | * @param mixed $file A $_FILES multi-dimensional array of uploaded file information. |
||
45 | * @param bool $test Whether the test mode is active for essayer unit-testing. |
||
46 | * |
||
47 | * @return null|Uploaded |
||
48 | */ |
||
49 | public static function get(array $file, $test = false) |
||
71 | |||
72 | /** |
||
73 | * Heals a malformed PHP $_FILES array. |
||
74 | * |
||
75 | * PHP has a bug that the format of the $_FILES array differs, depending on |
||
76 | * whether the uploaded file fields had normal field names or array-like |
||
77 | * field names ("normal" vs. "parent[child]"). |
||
78 | * |
||
79 | * This method fixes the array to look like the "normal" $_FILES array. |
||
80 | * |
||
81 | * @param array $data |
||
82 | * |
||
83 | * @return array |
||
84 | */ |
||
85 | public static function heal($data) |
||
118 | |||
119 | } |
||
120 |