Work on making country nullable. Presently the datamapper cant deal with it though...
[rock.divinelegy.git] / Domain / Entities / UserBuilder.php
1 <?php
2
3 namespace Domain\Entities;
4
5 use Domain\VOs\ICountry;
6 use Domain\VOs\IName;
7 use Domain\Entities\IUserFactory;
8 use Domain\Entities\IUserBuilder;
9
10 class UserBuilder implements IUserBuilder
11 {
12 private $_userFactory;
13 private $_country;
14 private $_displayName;
15 private $_name;
16 private $_tags;
17 private $_facebookId;
18 private $_yearsStepArtist;
19 private $_quota;
20
21 public function __construct(IUserFactory $userFactory)
22 {
23 $this->_userFactory = $userFactory;
24 }
25
26 public function With_Country(ICountry $country = null) {
27 $this->_country = $country;
28 return $this;
29 }
30
31 public function With_DisplayName($name) {
32 $this->_displayName = $name;
33 return $this;
34 }
35
36 public function With_Name(IName $name) {
37 $this->_name = $name;
38 return $this;
39 }
40
41 public function With_Tags(array $tags) {
42 $this->_tags = $tags;
43 return $this;
44 }
45
46 public function With_FacebookId($id) {
47 $this->_facebookId = $id;
48 return $this;
49 }
50
51 public function With_YearsStepArtist($years) {
52 $this->_yearsStepArtist = $years;
53 return $this;
54 }
55
56 public function With_Quota($quota)
57 {
58 $this->_quota = $quota;
59 }
60
61 public function build() {
62 return $this->_userFactory
63 ->createInstance($this->_country,
64 $this->_displayName,
65 $this->_name,
66 $this->_tags,
67 $this->_facebookId,
68 $this->_quota);
69 }
70 }