Passed
Push — master ( 26efa5...f69765 )
by Alex
03:20
created

TSimpleIdentifierTrait::isTSimpleIdentifierValid()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 20
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 20
rs 9.2
cc 4
eloc 13
nc 4
nop 1
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV4\edm\IsOKTraits;
4
5
trait TSimpleIdentifierTrait
6
{
7
    use AlgoWeb\ODataMetadata\xsdRestrictions;
8
9
    protected function isTSimpleIdentifierValid($TSimpleIdentifier)
10
    {
11
        if (!$this->isNCName($TSimpleIdentifier)) {
12
            $msg = "Qualifier must be a valid NCName";
0 ignored issues
show
Unused Code introduced by
$msg is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
13
            return false;
14
        }
15
        if (strlen($TSimpleIdentifier > 128)) {
16
            $msg = "The maximum length permitted for qualifier is 128";
0 ignored issues
show
Unused Code introduced by
$msg is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
17
            return false;
18
        }
19
        //      <!-- ECMAScript identifiers not starting with a '$' -->
20
        if (!$this->matchesRegexPattern(
21
            "[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}",
22
            $TSimpleIdentifier
23
        )) {
24
            $msg = "The qualifier does not match the regex in the xsd.";
0 ignored issues
show
Unused Code introduced by
$msg is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
25
            return false;
26
        }
27
        return true;
28
    }
29
}
30