GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Rs512Test::testCompute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 8
loc 8
c 1
b 0
f 0
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Emarref\Jwt\Algorithm;
4
5 View Code Duplication
class Rs512Test extends \PHPUnit_Framework_TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
6
{
7
    private static $name          = 'RS512';
8
    private static $algorithmName = 'sha512';
9
10
    /**
11
     * @var string
12
     */
13
    private $key;
14
15
    /**
16
     * @var Rs512
17
     */
18
    private $algorithm;
19
20
    public function setUp()
21
    {
22
        $this->key = openssl_pkey_new();
0 ignored issues
show
Documentation Bug introduced by
It seems like openssl_pkey_new() of type resource is incompatible with the declared type string of property $key.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
23
        $this->algorithm = new Rs512();
24
    }
25
26
    public function testGetName()
27
    {
28
        $this->assertSame(self::$name, $this->algorithm->getName());
29
    }
30
31
    public function testGetAlgorithm()
32
    {
33
        $this->assertSame(self::$algorithmName, $this->algorithm->getAlgorithm());
34
    }
35
36
    public function testCompute()
37
    {
38
        $unencryptedValue = 'foobar';
39
        openssl_sign($unencryptedValue, $encryptedValue, $this->key, OPENSSL_ALGO_SHA512);
40
        $signature = $this->algorithm->sign($unencryptedValue, $this->key);
41
42
        $this->assertSame($encryptedValue, $signature);
43
    }
44
}
45