for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Equip\Auth\Jwt;
use DateTime;
use Firebase\JWT\JWT;
use Psr\Http\Message\RequestInterface;
/**
* Generator for JWT authentication token strings that uses the
* firebase/php-jwt library.
*/
class FirebaseGenerator implements GeneratorInterface
{
* @var RequestInterface
protected $request;
* @var Configuration
protected $config;
* @param RequestInterface $request
* @param Configuration $config
public function __construct(
RequestInterface $request,
Configuration $config
) {
$this->request = $request;
$this->config = $config;
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
$a = "a"; $ab = "ab"; $abc = "abc";
will produce issues in the first and second line, while this second example
will produce no issues.
}
* @param array $claims
* @return string
public function getToken(array $claims = [])
$issuer = (string) $this->request->getUri();
$issued_at = $this->config->getTimestamp();
$expiration = $issued_at + $this->config->getTtl();
$key = $this->config->getPublicKey();
$algorithm = $this->config->getAlgorithm();
$claims += [
'iss' => $issuer,
'iat' => $issued_at,
'exp' => $expiration,
];
return JWT::encode($claims, $key, $algorithm);
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.