Skip to content

Instantly share code, notes, and snippets.

@mageekguy
Created May 4, 2014 19:51
Show Gist options
  • Save mageekguy/a5cf869ff2e79c1a4222 to your computer and use it in GitHub Desktop.
Save mageekguy/a5cf869ff2e79c1a4222 to your computer and use it in GitHub Desktop.
<?php
class number
{
private $value = 0;
public function addNumber(number $number)
{
return $number->add($this->value);
}
public function add($value)
{
return new self($this->value + $value); // Is it east oriented? Seems that only void, self and boolean are ok as return value…
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment