d67447bb9e7f051ee6f8336ee24bd153d6ef599d
[rock.divinelegy.git] / Domain / Entities / FileBuilder.php
1 <?php
2
3 namespace Domain\Entities;
4
5 use Domain\Entities\IFileFactory;
6
7 class FileBuilder implements IFileBuilder
8 {
9 private $_fileFactory;
10 private $_hash;
11 private $_path;
12 private $_filename;
13 private $_mimetype;
14 private $_size;
15 private $_date;
16
17 public function __construct(IFileFactory $fileFactory)
18 {
19 $this->_fileFactory = $fileFactory;
20 }
21
22 public function With_Filename($filename)
23 {
24 $this->_filename = $filename;
25 }
26
27 public function With_Hash($hash)
28 {
29 $this->_hash = $hash;
30 }
31
32 public function With_Mimetype($mimetype)
33 {
34 $this->_mimetype = $mimetype;
35 }
36
37 public function With_Path($path)
38 {
39 $this->_path = $path;
40 }
41
42 public function With_Size($size)
43 {
44 $this->_size = $size;
45 }
46
47 public function With_UploadDate($date)
48 {
49 $this->_date = $date;
50 }
51
52 public function build()
53 {
54 return $this->_fileFactory
55 ->createInstance(
56 $this->_hash,
57 $this->_path,
58 $this->_filename,
59 $this->_mimetype,
60 $this->_size,
61 $this->_date);
62 }
63 }