Passed
Push — master ( db02fd...873e90 )
by Christopher
02:22 queued 48s
created

xsAnySimpleType::checkMaxLength()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 7

Duplication

Lines 10
Ratio 83.33 %

Importance

Changes 0
Metric Value
dl 10
loc 12
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 7
nc 3
nop 1
1
<?php
2
namespace AlgoWeb\xsdTypes;
3
4
use AlgoWeb\xsdTypes\Facets\EnumerationTrait;
5
use AlgoWeb\xsdTypes\Facets\LengthTrait;
6
use AlgoWeb\xsdTypes\Facets\PatternTrait;
7
use AlgoWeb\xsdTypes\Facets\WhiteSpaceTrait;
8
9
/**
10
 * The type xsd:anySimpleType is the base type from which all other built-in types are derived. Any value (including an empty value) is allowed for xsd:anySimpleType.
11
 * handles facets enumeration, length, maxLength, minLength, pattern
12
 *
13
 * @package AlgoWeb\xsdTypes
14
 */
15
abstract class xsAnySimpleType
16
{
17
    use WhiteSpaceTrait, PatternTrait, EnumerationTrait, LengthTrait;
18
19
20
    /**
21
     * @property mixed $__value
22
     */
23
    private $__value = null;
24
25
    /**
26
     * Construct
27
     *
28
     * @param mixed $value
29
     */
30
    public function __construct($value)
31
    {
32
        $this->__value = $this->fixValueInteral($value);
33
    }
34
35
    private function fixValueInteral($value)
36
    {
37
        return $this->fixValue($this->fixWhitespace($value));
38
    }
39
40
    abstract protected function fixValue($value);
41
42
    protected function isOKInternal($value)
43
    {
44
        $this->checkEnumeration($value);
45
        $this->checkMaxLength($value);
46
        $this->checkMinLength($value);
47
        $this->checkPattern($value);
48
        return $this->isOK($value);
49
    }
50
51
52
    abstract protected function isOK($value);
53
}
54