1 | <?php |
||
11 | class UploadableFile implements Buildable |
||
12 | { |
||
13 | /** |
||
14 | * @var ExtensibleClassMetadata |
||
15 | */ |
||
16 | private $classMetadata; |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | private $fieldName; |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | private $type; |
||
27 | |||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | private static $validTypes = ['Path', 'Name', 'Size', 'MimeType']; |
||
32 | |||
33 | /** |
||
34 | * UploadableFile constructor. |
||
35 | * |
||
36 | * @param ExtensibleClassMetadata $classMetadata |
||
37 | * @param string $fieldName |
||
38 | * @param string $type |
||
39 | */ |
||
40 | 83 | public function __construct(ExtensibleClassMetadata $classMetadata, $fieldName, $type = 'Name') |
|
48 | |||
49 | /** |
||
50 | * Enable the UploadableFile extension. |
||
51 | * |
||
52 | * @return void |
||
53 | */ |
||
54 | 78 | public static function enable() |
|
62 | |||
63 | /** |
||
64 | * Execute the build process |
||
65 | */ |
||
66 | 82 | public function build() |
|
72 | |||
73 | /** |
||
74 | * Validate the given type of file field. |
||
75 | * |
||
76 | * @param string $type |
||
77 | * |
||
78 | * @return void |
||
79 | */ |
||
80 | 83 | private function validateType($type) |
|
88 | } |
||
89 |