Completed
Push — master ( ad55a4...c98fe8 )
by Joachim
01:57
created

CreditCardExpiry   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 22
ccs 3
cts 6
cp 0.5
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A hydrateXml() 0 9 2
1
<?php
2
namespace Loevgaard\AltaPay\Entity;
3
4
use Loevgaard\AltaPay\Hydrator\HydratableInterface;
5
6
class CreditCardExpiry implements HydratableInterface
7
{
8
    /**
9
     * @var int
10
     */
11
    private $year;
12
13
    /**
14
     * @var int
15
     */
16
    private $month;
17
18 9
    public function hydrateXml(\SimpleXMLElement $xml)
19
    {
20 9
        if(!isset($xml->CreditCardExpiry)) {
21 9
            return;
22
        }
23
24
        $this->year = (string)$xml->CreditCardExpiry->Year;
0 ignored issues
show
Documentation Bug introduced by
The property $year was declared of type integer, but (string) $xml->CreditCardExpiry->Year is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
25
        $this->month = (string)$xml->CreditCardExpiry->Month;
0 ignored issues
show
Documentation Bug introduced by
The property $month was declared of type integer, but (string) $xml->CreditCardExpiry->Month is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
26
    }
27
}
28