Files can now have mirrors. Implemented SMOMatcher service to attempt to automaticall...
[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 private $_mirrors;
17
18 public function __construct(IFileFactory $fileFactory)
19 {
20 $this->_fileFactory = $fileFactory;
21 }
22
23 public function With_Filename($filename)
24 {
25 $this->_filename = $filename;
26 }
27
28 public function With_Hash($hash)
29 {
30 $this->_hash = $hash;
31 }
32
33 public function With_Mimetype($mimetype)
34 {
35 $this->_mimetype = $mimetype;
36 }
37
38 public function With_Path($path)
39 {
40 $this->_path = $path;
41 }
42
43 public function With_Size($size)
44 {
45 $this->_size = $size;
46 }
47
48 public function With_UploadDate($date)
49 {
50 $this->_date = $date;
51 }
52
53 public function With_Mirrors(array $mirrors = null)
54 {
55 $this->_mirrors = $mirrors;
56 }
57
58 public function build()
59 {
60 return $this->_fileFactory
61 ->createInstance(
62 $this->_hash,
63 $this->_path,
64 $this->_filename,
65 $this->_mimetype,
66 $this->_size,
67 $this->_date,
68 $this->_mirrors);
69 }
70 }