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.
Passed
Pull Request — master (#43)
by Simone
12:59 queued 03:09
created

Salt   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 25
Duplicated Lines 20 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 5
loc 25
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getSalt() 0 3 1
A generateSaltForName() 3 7 3
A __construct() 0 3 1

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 Mado\QueryBundle\Objects;
4
5
use Doctrine\ORM\QueryBuilder;
6
7
final class Salt
8
{
9
    private $qBuilder;
10
11
    private $salt;
12
13 1
    public function __construct(QueryBuilder $qBuilder)
14
    {
15 1
        $this->qBuilder = $qBuilder;
16 1
    }
17
18 1
    public function generateSaltForName(string $fieldName) : void
19
    {
20 1
        $this->salt = '';
21
22 1 View Code Duplication
        foreach ($this->qBuilder->getParameters() as $parameter) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
23 1
            if ($parameter->getName() == 'field_' . $fieldName) {
24 1
                $this->salt = '_' . rand(111, 999);
25
            }
26
        }
27 1
    }
28
29 1
    public function getSalt() : string
30
    {
31 1
        return $this->salt;
32
    }
33
}
34