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

Tracking::track()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
dl 9
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Nickcheek\USPSLookup\Service;
4
5
use Nickcheek\USPSLookup\USPSLookup;
6
7
class Tracking extends USPSLookup
8
{
9
    public function __construct(){}
10
11 View Code Duplication
    public static function track($trackingnumber)
0 ignored issues
show
Duplication introduced by
This method 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...
12
    {
13
        $track = new \SimpleXMLElement("<TrackRequest></TrackRequest>");
14
        $track->addAttribute('USERID', self::$user);
15
        $pack = $track->addChild('TrackID');
16
        $pack->addAttribute('ID', $trackingnumber);
17
        $url = self::$service . 'TrackV2&XML='.$track->asXML();
18
        return simplexml_load_file($url);
19
    }
20
21 View Code Duplication
    public static function trackMultiple($trackingarray)
0 ignored issues
show
Duplication introduced by
This method 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...
22
    {
23
        $track = new \SimpleXMLElement("<TrackRequest></TrackRequest>");
24
        $track->addAttribute('USERID', self::$user);
25
        foreach($trackingarray as $trackingnumber){
26
            $pack = $track->addChild('TrackID');
27
            $pack->addAttribute('ID', $trackingnumber);
28
        }
29
        $url = self::$service . 'TrackV2&XML='.$track->asXML();
30
        return simplexml_load_file($url);
31
    }
32
}
33