Completed
Push — master ( f338a0...491cb3 )
by Giancarlos
02:24
created

FeSunat::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Giansalex
5
 * Date: 15/07/2017
6
 * Time: 22:56
7
 */
8
9
namespace Greenter\Ws\Services;
10
11
/**
12
 * Class FeSunat
13
 * @package Greenter\Ws\Services
14
 */
15
class FeSunat extends BaseSunat
16
{
17
    const BETA = 'https://e-beta.sunat.gob.pe/ol-ti-itcpfegem-beta/billService';
18
    const HOMOLOGACION  = 'https://www.sunat.gob.pe/ol-ti-itcpgem-sqa/billService';
19
    const PRODUCCION = 'https://e-factura.sunat.gob.pe/ol-ti-itcpfegem/billService';
20
    const WSDL_ENDPOINT = 'https://e-beta.sunat.gob.pe/ol-ti-itcpfegem-beta/billService?wsdl';
21
22 2
    public function __construct($user, $password)
23
    {
24 2
        parent::__construct($user, $password);
25 2
        parent::setUrlWsdl(FeSunat::WSDL_ENDPOINT);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (setUrlWsdl() instead of __construct()). Are you sure this is correct? If so, you might want to change this to $this->setUrlWsdl().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
26 2
    }
27
28
    public function send($filename, $content)
29
    {
30
        $client = parent::getClient();
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (getClient() instead of send()). Are you sure this is correct? If so, you might want to change this to $this->getClient().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
31
32
        try {
33
            $response = $client->__soapCall('sendBill', [
34
                'fileName' => $filename,
35
                'contentFile' => $content,
36
            ]);
37
            return $response->applicationResponse;
38
//            $entry = readXml( $response->applicationResponse, 'R-20600055519-01-F001-00000001.xml');
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
39
//            if (!empty($entry)) {
40
//                header('Content-Type: text/xml');
41
//                echo $entry;
42
//            }
43
44
        }
45
        catch (\Exception $e) {
46
            return $client->__getLastResponse();
47
//    echo "<h2>Exception Error!</h2>";
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
48
//    echo $e->getMessage();
49
        }
50
    }
51
}