| 1 | <?php |
||
| 6 | class PatientBuilder |
||
| 7 | { |
||
| 8 | |||
| 9 | private $patient = NULL; |
||
| 10 | |||
| 11 | function __construct() |
||
| 15 | |||
| 16 | function name($name) |
||
| 17 | { |
||
| 18 | $this->patient->setName($name); |
||
| 19 | return $this; |
||
| 20 | } |
||
| 21 | |||
| 22 | function pesel($pesel) |
||
| 23 | { |
||
| 24 | $this->patient->setPesel($pesel); |
||
| 25 | return $this; |
||
| 26 | } |
||
| 27 | |||
| 28 | function dataKategoryzacji($dataKategoryzacji) |
||
| 29 | { |
||
| 30 | $this->patient->setDataKategoryzacji($dataKategoryzacji); |
||
| 31 | return $this; |
||
| 32 | } |
||
| 33 | |||
| 34 | function build() |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Maps properities of an $obj to $patient by calling setter of each property. |
||
| 41 | * |
||
| 42 | * E.g. value of $obj->prop will become $patient->prop by calling $patient->setProp |
||
| 43 | * |
||
| 44 | * @param unknown $patient |
||
| 45 | * @param unknown $obj |
||
| 46 | * @return unknown |
||
| 47 | */ |
||
| 48 | public static function map($patient, $obj) |
||
| 61 | |||
| 62 | } |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.