Pack entity builder stuff. Not tested yet.
[rock.divinelegy.git] / Domain / Entities / StepMania / PackBuilder.php
1 <?php
2
3 namespace Domain\Entities\StepMania;
4
5 use Domain\Entities\IUser;
6 use Domain\Entities\IFile;
7 use Domain\Entities\StepMania\IPackFactory;
8 use Domain\Entities\StepMania\IPackBuilder;
9
10 class PackBuilder implements IPackBuilder
11 {
12
13 private $_packFactory;
14 private $_title;
15 private $_uploader;
16 private $_simfiles;
17 private $_file;
18
19 //override parent
20 public function __construct(IPackFactory $packFactory)
21 {
22 $this->_packFactory = $packFactory;
23 }
24
25 public function With_Title($title)
26 {
27 $this->_title = $title;
28 return $this;
29 }
30
31 public function With_File(IFile $file)
32 {
33 $this->_file = $file;
34 return $this;
35 }
36
37 public function With_Simfiles(array $simfiles)
38 {
39 $this->_simfiles = $simfiles;
40 return $this;
41 }
42
43 public function With_Uploader(IUser $uploader)
44 {
45 $this->_uploader = $uploader;
46 return $this;
47 }
48
49 public function build()
50 {
51 return $this->_packFactory->createInstance($this->_title,
52 $this->_uploader,
53 $this->_simfiles);
54 }
55 }