1 | <?php |
||
5 | class FileBagBuilder |
||
6 | { |
||
7 | |||
8 | private $uploadedFileBuilder = null; |
||
9 | |||
10 | |||
11 | 6 | public function __construct(UploadedFileBuilder $builder) |
|
15 | |||
16 | |||
17 | /** |
||
18 | * Used for producinf a FileBag instance from standard $_FILES values |
||
19 | * |
||
20 | * @param array $list |
||
21 | * @return FileBag |
||
22 | */ |
||
23 | 6 | public function create($list) |
|
24 | { |
||
25 | 6 | $instance = new FileBag; |
|
26 | |||
27 | 6 | foreach ($list as $key => $value) { |
|
28 | 5 | $item = $this->createItem($value); |
|
29 | 5 | $instance[$key] = $item; |
|
30 | } |
||
31 | |||
32 | 6 | return $instance; |
|
33 | } |
||
34 | |||
35 | |||
36 | 5 | private function createItem($params) |
|
46 | |||
47 | |||
48 | /** |
||
49 | * When using <input type="file" name="foobar[]"> type of definitions, |
||
50 | * this method is repsonsible for re-packeging the inputs into a sub-filebag |
||
51 | */ |
||
52 | 1 | private function createFromList($list) |
|
70 | } |
||
71 |