OTPHP\HOTP::setCounter PHP Method

setCounter() private method

private setCounter ( integer $counter )
$counter integer
    private function setCounter($counter)
    {
        Assertion::integer($counter, 'Counter must be at least 0.');
        Assertion::greaterOrEqualThan($counter, 0, 'Counter must be at least 0.');
        $this->setParameter('counter', $counter);
    }

Usage Example

Example #1
0
 /**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage Counter must be at least 0.
  */
 public function testCounterIsNot1OrMore()
 {
     $otp = new HOTP();
     $otp->setCounter(-500);
 }