Set counter value if hotp is being used

@param string $type Type of OTP auth, either HOTP or TOTP
@param int $counter Counter value

@throws \InvalidArgumentException If counter is empty while using HOTP
771267
protected function setCounter($type, $counter)
	{
		if ($type === 'hotp')
		{
			if ($counter !== 0 && empty($counter))
			{
				throw new \InvalidArgumentException("Counter can't be empty if HOTP is being used");
			}

			$this->parameters .= "&counter=$counter";
		}
	}
827880
public function setType(string $type) : void
    {
        if (empty($type)) {
            throw new InvalidArgumentException('Empty field type is not allowed: ' . $this->getName());
        }

        $this->_type = $this->_extractType($type);
    }
286839
public function setOutputAs($type)
    {
        if (!in_array($type, [self::RAW, self::PLAIN, self::COLOR], true)) {
            throw new InvalidArgumentException(sprintf('Invalid output type "%s".', $type));
        }

        $this->_outputAs = $type;
    }
621987
public static function setInstance($type, \Tx_Oelib_Session $instance)
    {
        self::checkType($type);

        self::$instances[$type] = $instance;
    }
1116344
public function set_type($type) {
        if (!in_array($type, [self::TYPE_DEFAULT, self::TYPE_LINE])) {
            throw new coding_exception('Invalid serie type.');
        }
        $this->type = $type;
    }
837917
public function setByType($type)
    {
        if (isset(self::$statusList[$type])) {
            $this->value = self::$statusList[$type];
        } else {
            throw new Exception("undefined index $type");
        }
    }
190695
public function setProductType(string $type)
    {
        $types = [self::TYPE_DIGITAL, self::TYPE_PHYSICAL, self::TYPE_HYBRID];

        if (!in_array($type, $types)) {
            throw new \InvalidArgumentException('Invalid productType \'' . $type . '\'');
        }
        $this->productType = $type;
    }
1020910
public function setType(Type $type = null)
    {
        if ($this->type !== $type) {
            $this->type = $type;
        }

        return $this;
    }
1174160
public function setType($type)
    {
        $allowedValues = $this->getTypeAllowableValues();
        if (!is_null($type) && !in_array($type, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'type', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['type'] = $type;

        return $this;
    }
1210336
protected function setRequestType(string $type):void
    {
        if ($type !== Protocol::REQUEST_TYPE_NOTIFY && $type !== Protocol::REQUEST_TYPE_FORWARD && $type !== protocol::REQUEST_TYPE_REGISTER) {
            throw new \TypeError("Unsupported request type: $type!");
        }

        $this->requestType = $type;
        $this->setHeader(Protocol::VERSION." ".$type);

    }
1149244
public function setType($type = null)
    {
        if (! is_null($type) && ! $this->isValidType($type)) {
            throw new InvalidArgumentException("Given batch modification type is invalid.");
        }

        $this->type = $type;

        return $this;
    }
838021
public function postKey($type, $fileKey): int
    {
        if (!in_array($type, self::$type, true)) {
            throw new \InvalidArgumentException('Invalid type parameter');
        }

        $options = ['json' => ['fileKey' => $fileKey]];

        /** @var JsonStream $stream */
        $stream = $this->client
            ->post(UserApi::generateUrl("csv/{$type}.json"), $options)
            ->getBody();

        return $stream->jsonSerialize()['id'];
    }
510168
protected function handleIncrement($value, Counter $counter, int $number): Counter
    {
        if (false === $value) {
            $counter = $this->set(Counter::create($counter->getName(), $counter->getValue() + $number));
        } else {
            $counter = Counter::create($counter->getName(), $value);
        }

        return $counter;
    }
723154
public function increment($ip, $type)
    {
        $this->assertReady();
        
        $sql = sprintf("INSERT INTO %s SET %s=:type, %s=:ip",
            $this->dbAdapter->platform->quoteIdentifier($this->table),
            $this->dbAdapter->platform->quoteIdentifier($this->typeColumn),
            $this->dbAdapter->platform->quoteIdentifier($this->ipColumn));
        
        $parameters = array(
            'type' => $type,
            'ip' => $ip,
        );
        
        $this->dbAdapter->query($sql, $parameters);
    }
1321792
public function setTypeAttribute($type)
    {
        if (!$type instanceof BlockType) {
            $type = BlockType::getByName($type);
        }
        if (!$type) {
            throw new InvalidArgumentException('Unknown block type');
        }
        $this->type()->associate($type);
    }
880429
public function checkHotpResync($secret, $counter, $key, $counterwindow = 2)
    {
        if (!is_numeric($counter) || $counter < 0) {
            throw new \InvalidArgumentException('Invalid counter supplied');
        }

        if(!is_numeric($counterwindow) || $counterwindow < 0){
            throw new \InvalidArgumentException('Invalid counterwindow supplied');
        }

        for($c = 0; $c <= $counterwindow; $c = $c + 1) {
            if(hash_equals($this->hotp($secret, $counter + $c), $key)){
                return $counter + $c;
            }
        }
        return false;
    }
97187
public function setType($type)
    {
      if(!is_string($type) || strlen(trim($type)) == 0)
        throw new InvalidArgumentException(__METHOD__ . '; Invalid type, must be a non empty string');

      $this->type = $type;
    }