Example #1
0
 /**
  * Public method for generating fibonnaci numer. This method checks if the position is valid
  * 
  * @param int $positionToGenerate of the fibonacci numbers we want to generate
  *
  * @return int
  */
 public function generate($positionToGenerate)
 {
     $result = false;
     if (!$this->isValidPosition($positionToGenerate)) {
         throw new InvalidPositionException();
     }
     $this->_generateIfNotExist($positionToGenerate);
     return (int) $this->_db->get($positionToGenerate);
 }
Example #2
0
 /**
  * Reset all the values generated
  *  
  *  @return void
  */
 public static function reset()
 {
     self::$_db->reset();
 }