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

BillSender   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 33
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2
ccs 14
cts 14
cp 1
rs 10

1 Method

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