Passed
Push — master ( f20cbe...ecaad3 )
by Christopher
03:19
created

TSimpleIdentifierTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A IsTSimpleIdentifierValid() 0 17 4
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV4\edm\IsOKTraits;
4
5
6
trait TSimpleIdentifierTrait
7
{
8
    use xsdRestrictions;
9
10
    protected function IsTSimpleIdentifierValid($TSimpleIdentifier)
11
    {
12
        if (!$this->isNCName($TSimpleIdentifier)) {
13
            $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...
14
            return false;
15
        }
16
        if (strlen($TSimpleIdentifier > 128)) {
17
            $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...
18
            return false;
19
        }
20
        //      <!-- ECMAScript identifiers not starting with a '$' -->
21
        if (!$this->MatchesRegexPattern("[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}", $TSimpleIdentifier)) {
22
            $msg = "the qualifier dose 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...
23
            return false;
24
        }
25
        return true;
26
    }
27
}