Completed
Pull Request — master (#80)
by
unknown
03:13
created

AddressClassification::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2.0185

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 5
cts 6
cp 0.8333
rs 9.4285
cc 2
eloc 5
nc 2
nop 1
crap 2.0185
1
<?php namespace Ups\Entity\AddressValidation;
2
3
class AddressClassification
4
{
5
    public $code;
6
    public $description;
7
8 2
    public function __construct(\SimpleXMLElement $object)
9
    {
10 2
        if ($object->count() == 0) {
11
            throw new \InvalidArgumentException(__METHOD__ . ': The passed object does not have any child nodes.');
12
        }
13 2
        $this->code = $object->Code;
0 ignored issues
show
Bug introduced by
The property Code does not seem to exist in SimpleXMLElement.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
14 2
        $this->description = $object->Description;
0 ignored issues
show
Bug introduced by
The property Description does not seem to exist in SimpleXMLElement.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
15 2
    }
16
}
17