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

TSimpleIdentifierTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 4
c 2
b 1
f 0
lcom 0
cbo 0
dl 0
loc 25
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A isTSimpleIdentifierValid() 0 20 4
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