Test Failed
Pull Request — master (#27)
by Christopher
02:15
created

XMLDateInterval   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 13 3
1
<?php
2
3
namespace AlgoWeb\xsdTypes\AxillaryClasses;
4
5
class XMLDateInterval
6
{
7
    /**
8
     * formating string like ISO 8601 (PnYnMnDTnHnMnS)
9
     */
10
    const INTERVAL_ISO8601 = 'P%yY%mM%dDT%hH%iM%sS';
11
    public $pattern = 'PnYnMnDTnHnMnS';
12
13
    /**
14
     * formating the interval like ISO 8601 (PnYnMnDTnHnMnS)
15
     *
16
     * @return string
17
     */
18
    function __toString()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
19
    {
20
        $sReturn = '';
21
        for ($i = 0; $i < strlen($this->pattern); $i++) {
22
            if ($this->pattern[$i] == 'n') {
23
                $v = strtolower($this->pattern[$i + 1]);
24
                $sReturn .= $this->$v;
25
                continue;
26
            }
27
            $sReturn .= $this->pattern[$i];
28
        }
29
        return $sReturn;
30
    }
31
}