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

TNamespaceNameTrait::IsTNamespaceNameValid()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 3
eloc 8
nc 3
nop 1
1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV4\edm\IsOKTraits;
4
5
use AlgoWeb\ODataMetadata\xsdRestrictions;
6
7
8
trait TNamespaceNameTrait
9
{
10
    use xsdRestrictions;
11
12
    protected function IsTNamespaceNameValid($TNamespaceName)
13
    {
14
        if (!$this->isNCName($TNamespaceName)) {
15
            $msg = "Term Namespace 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...
16
            return false;
17
        }
18
        //<!-- one or more SimpleIdentifiers separated by dots -->
19
        if (!$this->MatchesRegexPattern("[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}(\.[\p{L}\p{Nl}_][\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,}){0,}", $TNamespaceName)) {
20
            $msg = "the term namespace 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...
21
            return false;
22
        }
23
        return true;
24
    }
25
}