Passed
Push — master ( 0aa694...6e6d35 )
by Alex
03:56
created

TMultiplicityModeTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 10
Duplicated Lines 70 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A TMultiplicityTrait::isTMultiplicityValid() 0 7 4

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace AlgoWeb\ODataMetadata\MetadataV3\edm\IsOKTraits;
4
5
trait TMultiplicityTrait
6
{
7
    public function isTMultiplicityValid($string)
8
    {
9
        if (!is_string($string)) {
10
            throw new \InvalidArgumentException("Input must be a string");
11
        }
12
        return '0..1' == $string || '1' == $string || '*' == $string;
13
    }
14
}
15