/** * Repeat the card * * This method takes an instance of SM2 and a quality factor to update * the flash card accordingly after a repetition. * * @param \Memorize\SM2 $SM2 An instance of an SM2 object * @param int $quality The quality of the answer */ public function repeat($SM2, $quality) { if ($quality >= 3) { $this->numberOfRepeats++; } else { $this->numberOfRepeats = 1; } $newFactor = $SM2->calcNewFactor($this->factor, $quality); $this->factor = $newFactor; $interval = $SM2->calcInterval($this->numberOfRepeats, $newFactor); $this->nextTime = time() + $interval * 24 * 60 * 60; }
/** * calcNewFactor should always return a float. */ public function testFactorIsFloat() { $mem = new SM2(); $this->assertInternalType('float', $mem->calcNewFactor()); }