Artist is allowed to be null.
[rock.divinelegy.git] / Domain / Entities / StepMania / Simfile.php
1 <?php
2
3 namespace Domain\Entities\StepMania;
4
5 use Domain\VOs\StepMania\IArtist;
6 use Domain\VOs\StepMania\IBPM;
7 use Domain\VOs\StepMania\IStepChart;
8 use Domain\Exception\InvalidStepChartException;
9 use Domain\Entities\StepMania\ISimfile;
10 use Domain\Entities\StepMania\IPack;
11 use Domain\Entities\IUser;
12 use Domain\Entities\IFile;
13 use Domain\Entities\AbstractEntity;
14
15 class Simfile extends AbstractEntity implements ISimfile
16 {
17 private $_title;
18 private $_artist;
19 private $_uploader;
20 private $_bpm;
21 private $_bpmChanges = false;
22 private $_stops = false;
23 private $_fgChanges = false;
24 private $_bgChanges = false;
25 private $_banner;
26 private $_simfile;
27 private $_steps;
28 private $_packId;
29
30 public function __construct(
31 $title,
32 IArtist $artist = null,
33 IUser $uploader,
34 IBPM $bpm,
35 $bpmChanges,
36 $stops,
37 $fgChanges,
38 $bgChanges,
39 IFile $banner = null,
40 IFile $simfile = null,
41 $packId = null,
42 array $steps
43 ) {
44 $this->_title = $title;
45 $this->_artist = $artist;
46 $this->_uploader = $uploader;
47 $this->_bpm = $bpm;
48 $this->_bpmChanges = $bpmChanges;
49 $this->_stops = $stops;
50 $this->_fgChanges = $fgChanges;
51 $this->_bgChanges = $bgChanges;
52 $this->_banner = $banner;
53 $this->_simfile = $simfile;
54 $this->_packId = $packId;
55
56 foreach($steps as $stepChart) {
57 if(!$stepChart instanceof IStepChart) {
58 throw new InvalidStepChartException(sprintf('Invalid StepChart array. All array elements must be an instance of Stepchart.'));
59 }
60 }
61
62 $this->_steps = $steps;
63 }
64
65 public function getTitle()
66 {
67 return $this->_title;
68 }
69
70 public function getArtist()
71 {
72 return $this->_artist;
73 }
74
75 public function getUploader()
76 {
77 return $this->_uploader;
78 }
79
80 public function getBPM()
81 {
82 return $this->_bpm;
83 }
84
85 public function hasBPMChanges()
86 {
87 return $this->_bpmChanges;
88 }
89
90 public function hasStops()
91 {
92 return $this->_stops;
93 }
94
95 public function hasFgChanges()
96 {
97 return $this->_fgChanges;
98 }
99
100 public function hasBgChanges()
101 {
102 return $this->_bgChanges;
103 }
104
105 public function addStepChart(IStepChart $stepChart) {
106 $this->_steps[] = $stepChart;
107 }
108
109 public function getBanner()
110 {
111 return $this->_banner;
112 }
113
114 public function getSimfile()
115 {
116 return $this->_simfile;
117 }
118
119 public function getSteps()
120 {
121 return $this->_steps;
122 }
123
124 public function addToPack(IPack $pack) {
125 $this->_packId = $pack->getId();
126 }
127
128 public function getPackId()
129 {
130 return $this->_packId;
131 }
132 }