Cancelled
Push — master ( 9204b0...a0a16f )
by Christopher
01:41
created

xsENTITIES   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 32
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 32
loc 32
c 0
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 5 5 1
A fixValue() 6 6 2
A isOK() 11 11 3

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\xsdTypes;
4
5
/**
6
 * The type xsd:ENTITIES represents a list of ENTITY values separated by whitespace. There must be at least one ENTITY in the list. Each of the ENTITY values must match the name of an unparsed entity that has been declared in a document type definition (DTD) for the instance.
7
 *
8
 * @package AlgoWeb\xsdTypes
9
 */
10 View Code Duplication
class xsENTITIES extends xsAnySimpleType
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
    /**
13
     * Construct
14
     *
15
     * @param mixed $value
16
     */
17
    public function __construct($value)
18
    {
19
        parent::__construct($value);
20
        $this->setMinLengthFacet(1);
21
    }
22
23
    protected function fixValue($value)
24
    {
25
        foreach ($value as $v) {
26
            $v->fixValue($v);
27
        }
28
    }
29
30
    protected function isOK($value)
31
    {
32
        if (!is_array($value)) {
33
            throw new \InvalidArgumentException(
34
                "the provided value for " . __CLASS__ . " Must be an array of type xsIDREF "
35
            );
36
        }
37
        foreach ($value as $v) {
38
            $v->isOKInternal();
39
        }
40
    }
41
}
42