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::generateSaltForName()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 7
Code Lines 4

Duplication

Lines 3
Ratio 42.86 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 4
nc 3
nop 1
dl 3
loc 7
ccs 5
cts 5
cp 1
crap 3
rs 9.4285
c 0
b 0
f 0
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