Skip to content

Instantly share code, notes, and snippets.

@colindecarlo
Last active January 23, 2016 04:33
Show Gist options
  • Save colindecarlo/c0f91594cf9c9b702506 to your computer and use it in GitHub Desktop.
Save colindecarlo/c0f91594cf9c9b702506 to your computer and use it in GitHub Desktop.
<?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