PublicKey   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 18
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 18
loc 18
wmc 5
lcom 0
cbo 1
ccs 9
cts 9
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 12 12 5

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Zenstruck\JWT\Signer\OpenSSL;
4
5
/**
6
 * @author Kevin Bond <[email protected]>
7
 */
8 View Code Duplication
final class PublicKey extends Key
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...
9
{
10
    /**
11
     * @param mixed $value
12
     */
13 15
    public function __construct($value)
14
    {
15 15
        if (is_string($value) && is_file($value) && is_readable($value)) {
16 15
            $value = file_get_contents($value);
17 15
        }
18
19 15
        if (!is_resource($value)) {
20 15
            $value = openssl_pkey_get_public($value);
21 15
        }
22
23 15
        parent::__construct($value);
24 15
    }
25
}
26