Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- protected $num = 0;
- public function add($int)
- {
- if ($this->isInRange($int)
- $this->num += $int;
- return $this;
- }
- public function sub($int)
- {
- if ($this->isInRange($int)
- $this->num -= $int;
- return $this;
- }
- public function mult($int)
- {
- if ($this->isInRange($int)
- $this->num *= $int;
- return $this;
- }
- public function div($int)
- {
- if ($this->isInRange($int)
- $this->num /= $int;
- return $this;
- }
- public function getTotal()
- {
- return $this->num;
- }
- public function isInRange()
- {
- // could be the same as my validatePositiveInts() method I guess....
- // yeah, this would work a hell of a lot better, i DID NOT include
- // error exceptions though, but we could use some of it from my
- // calc method, and even work it farther down to type detect for a
- // more specific error.... show your guys this too maybe? should have
- // though it over for a few more minutes ;)
- }
Advertisement
Add Comment
Please, Sign In to add comment