src/Authenticator.php
public function getUri(string $label, string $issuer, int $hotpCounter = null):string{

		$values = [
			'secret'    => $this->getSecret(),
			'issuer'    => $issuer,
			'digits'    => $this->options->digits,
			'algorithm' => $this->options->algorithm,
		];

		if($this->options->mode === 'totp'){
			$values['period'] = $this->options->period;
		}

		if($this->options->mode === 'hotp' && $hotpCounter !== null){
			$values['counter'] = $hotpCounter;
		}

		return 'otpauth://'.$this->options->mode.'/'.rawurlencode($label).'?'.http_build_query($values, '', '&', PHP_QUERY_RFC3986);
	}
public function getUri(string $label, string $issuer, int $hotpCounter = null):string{

		$values = [
			'secret'    => $this->getSecret(),
			'issuer'    => $issuer,
			'digits'    => $this->options->digits,
			'algorithm' => $this->options->algorithm,
		];

		if($this->options->mode === 'totp'){
			$values['period'] = $this->options->period;
		}

		if($this->options->mode === 'hotp' && $hotpCounter !== null){
			$values['counter'] = $hotpCounter;
		}

		return 'otpauth://'.$this->options->mode.'/'.rawurlencode($label).'?'.http_build_query($values, '', '&', PHP_QUERY_RFC3986);
	}
public function getUri ( string $ label , string $ issuer , int $ hotpCounter = null ) : string { $ values = [ 'secret' => $ this -> getSecret ( ) , 'issuer' => $ issuer , 'digits' => $ this -> options -> digits , 'algorithm' => $ this -> options -> algorithm , ] ; if ( $ this -> options -> mode === 'totp' ) { $ values [ 'period' ] = $ this -> options -> period ; } if ( $ this -> options -> mode === 'hotp' && $ hotpCounter !== null ) { $ values [ 'counter' ] = $ hotpCounter ; } return 'otpauth://' . $ this -> options -> mode . '/' . rawurlencode ( $ label ) . '?' . http_build_query ( $ values , '' , '&' , PHP_QUERY_RFC3986 ) ; }
Creates an URI for use in QR codes for example

@link https://github.com/google/google-authenticator/wiki/Key-Uri-Format#parameters

@param string   $label
@param string   $issuer
@param int|null $hotpCounter

@return string
Creates an URI for use in QR codes for example