Created
January 11, 2012 07:38
-
-
Save andho/1593580 to your computer and use it in GitHub Desktop.
Normal Doctrinized Invoice
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); | |
| } | |
| public function removeItem() { | |
| if ($this->isSent()) { | |
| throw new Exception('Items cannot be changed after invoice is sent'); | |
| } | |
| $this->_totalAmount -= $this->_items[$index]; | |
| unset($this->_items[$index]); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment