Test Failed
Push — master ( 11d608...27c98c )
by Giancarlos
02:46
created

BillSender   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 71.43%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A send() 0 23 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 2
    public function send($filename, $content)
26
    {
27 2
        $client = $this->getClient();
28 2
        $result = new BillResult();
29
30
        try {
31
            $params = [
32 2
                'fileName' => $filename,
33 2
                'contentFile' => $content,
34 2
            ];
35 2
            $response = $client->call('sendBill', [ 'parameters' => $params ]);
36
            $cdrZip = $response->applicationResponse;
37
            $result
38
                ->setCdrResponse($this->extractResponse($cdrZip))
39
                ->setCdrZip($cdrZip)
40
                ->setSuccess(true);
41
        }
42 2
        catch (\SoapFault $e) {
43 2
            $result->setError($this->getErrorFromFault($e));
44
        }
45
46 2
        return $result;
47
    }
48
}