xsDayTimeDuration   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 1
cbo 2
dl 9
loc 9
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A fixValue() 6 6 1

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
use AlgoWeb\xsdTypes\AxillaryClasses\XMLDateInterval;
6
7
/**
8
 * The type xsd:dayTimeDuration represents a duration of time expressed as a number of days, hours, minutes, and
9
 * seconds. The format of xsd:dayTimeDuration is PnDTnHnMnS, where P is a literal value that starts the expression,
10
 * nD is the number of days followed by a literal D, T is a literal value that separates the date and time, nH is
11
 * the number of hours followed by a literal H, nM is the number of minutes followed by a literal M, and nS is the
12
 * number of seconds followed by a literal S. The following rules apply to xsd:dayTimeDuration values:
13
 * - Any of these numbers and corresponding designators may be absent if they are equal to 0, but at least one
14
 *   number and designator must appear.
15
 * - The numbers may be any unsigned integer, with the exception of the number of seconds, which may be an
16
 *   unsigned decimal number.
17
 * - I f a decimal point appears in the number of seconds, there must be at least one digit after the decimal point.
18
 * - A minus sign may appear before the P to specify a negative duration.
19
 * - If no time items (hour, minute, second) are present, the letter T must not appear.
20
 * @package AlgoWeb\xsdTypes
21
 */
22 View Code Duplication
class xsDayTimeDuration extends xsDuration
23
{
24
    public function fixValue()
25
    {
26
        parent::fixValue();
27
        $objectValue = new XMLDateInterval($this->value, 'PnDTnHnMnS');
28
        $this->value = $objectValue->__toString();
29
    }
30
}
31