This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Invoice { | |
| private $_items; | |
| private $_totalAmount = 0; | |
| private $_sentDate; | |
| public function isSent() { | |
| return !is_null($this->_sentDate); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function __construct($data) { | |
| $address = array('name', 'post_code'); | |
| $business = array('name', 'address', 'post_code', 'intro'); | |
| if ($data['type] == 'business') $fields = $business; | |
| else $fields = $address; | |
| if (count(array_intersect($fields, array_keys($data))) != count($fields)) { | |
| throw new Exception("Required data was not supplied to the Address object"); | |
| } |
NewerOlder