Last active
January 23, 2016 04:33
-
-
Save colindecarlo/c0f91594cf9c9b702506 to your computer and use it in GitHub Desktop.
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 Numberset | |
{ | |
protected $min; | |
protected $max; | |
protected $numbers; | |
public static function create($min, $max) | |
{ | |
$set = new static($min, $max); | |
$set->initialize(); | |
return $set; | |
} | |
public function __construct($min, $max) | |
{ | |
$this->min = $min; | |
$this->max = $max; | |
} | |
public function initialize() | |
{ | |
$this->numbers = range($this->min, $this->max); | |
} | |
public function average() | |
{ | |
// return the average value of the set | |
} | |
public function odd() | |
{ | |
// filter the set so it contains only odd numbers | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment