Passed
Pull Request — master (#22)
by Christopher
02:16
created

xsDayTimeDuration   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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