Completed
Push — master ( 83ff7f...5810d6 )
by Nicholas
01:05
created

Price::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Nickcheek\USPSLookup\Service;
4
5
use Nickcheek\USPSLookup\USPSLookup;
6
7
class Price extends USPSLookup
8
{
9
    public function __construct(){}
10
11
    public static function getRate($to,$from,$pounds,$ounces,$service)
12
    {
13
        $rate = new \SimpleXMLElement("<RateV4Request></RateV4Request>");
14
        $rate->addAttribute('USERID', self::$user);
15
        $revision = $rate->addChild("Revision",'2');
0 ignored issues
show
Unused Code introduced by
$revision is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
16
        $pack = $rate->addChild('Package');
17
        $pack->addAttribute('ID','0');
18
        $pack->addChild('Service',$service);
19
        $pack->addChild('ZipOrigination',$from);
20
        $pack->addChild('ZipDestination',$to);
21
        $pack->addChild('Pounds',$pounds);
22
        $pack->addChild('Ounces',$ounces);
23
        $pack->addChild('Container','VARIABLE');
24
        $pack->addChild('Size','Regular');
25
        $url = self::$service . '&XML='.$rate->asXML();
26
        return simplexml_load_file($url);
27
    }
28
}
29