Passed
Push — master ( 28effa...a0de38 )
by Giancarlos
04:32
created

ExtService   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 60%

Importance

Changes 0
Metric Value
dl 0
loc 32
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2
ccs 9
cts 15
cp 0.6
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B getStatus() 0 25 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Administrador
5
 * Date: 02/10/2017
6
 * Time: 10:10 AM
7
 */
8
9
namespace Greenter\Ws\Services;
10
11
use Greenter\Model\Response\StatusResult;
12
13
/**
14
 * Class ExtService
15
 * @package Greenter\Ws\Services
16
 */
17
class ExtService extends BaseSunat
18
{
19
    /**
20
     * @param string $ticket
21
     * @return StatusResult
22
     */
23 6
    public function getStatus($ticket)
24
    {
25 6
        $client = $this->getClient();
26 6
        $result = new StatusResult();
27
28
        try {
29
            $params = [
30 6
                'ticket' => $ticket,
31 6
            ];
32 6
            $response = $client->__soapCall('getStatus', [ 'parameters' => $params ]);
33
            $status = $response->status;
34
            $cdrZip = $status->content;
35
36
            $result
37
                ->setCode($status->statusCode)
38
                ->setCdrResponse($this->extractResponse($cdrZip))
39
                ->setCdrZip($cdrZip)
40
                ->setSuccess(true);
41
        }
42 6
        catch (\SoapFault $e) {
43 6
            $result->setError($this->getErrorFromFault($e));
44
        }
45
46 6
        return $result;
47
    }
48
}