1 | <?php |
||
20 | class BaseSunat |
||
21 | { |
||
22 | /** |
||
23 | * @var WsClientInterface |
||
24 | */ |
||
25 | private $client; |
||
26 | |||
27 | /** |
||
28 | * @return WsClientInterface |
||
29 | */ |
||
30 | 44 | public function getClient() |
|
34 | |||
35 | /** |
||
36 | * @param WsClientInterface $client |
||
37 | * @return BaseSunat |
||
38 | */ |
||
39 | 74 | public function setClient($client) |
|
44 | |||
45 | /** |
||
46 | * Get error from Fault Exception. |
||
47 | * |
||
48 | * @param \SoapFault $fault |
||
49 | * @return Error |
||
50 | */ |
||
51 | 20 | protected function getErrorFromFault(\SoapFault $fault) |
|
52 | { |
||
53 | 20 | $err = new Error(); |
|
54 | 20 | $err->setCode($fault->faultcode); |
|
|
|||
55 | 20 | $code = preg_replace('/[^0-9]+/', '', $err->getCode()); |
|
56 | 20 | $msg = ''; |
|
57 | |||
58 | 20 | if (empty($code)) { |
|
59 | 6 | $code = preg_replace('/[^0-9]+/', '', $fault->faultstring); |
|
60 | 6 | } |
|
61 | |||
62 | 20 | if ($code) { |
|
63 | 18 | $msg = $this->getMessageError($code); |
|
64 | 18 | $err->setCode($code); |
|
65 | 18 | } |
|
66 | |||
67 | 20 | if (empty($msg)) { |
|
68 | 4 | $msg = isset($fault->detail) ? $fault->detail->message : $fault->faultstring; |
|
69 | 4 | } |
|
70 | |||
71 | 20 | return $err->setMessage($msg); |
|
72 | } |
||
73 | |||
74 | /** |
||
75 | * @param $zipContent |
||
76 | * @return \Greenter\Model\Response\CdrResponse |
||
77 | */ |
||
78 | 18 | protected function extractResponse($zipContent) |
|
79 | { |
||
80 | 18 | $zip = new ZipFactory(); |
|
81 | 18 | $xml = $zip->decompressLastFile($zipContent); |
|
82 | 18 | $reader = new DomCdrReader(); |
|
83 | |||
84 | 18 | return $reader->getCdrResponse($xml); |
|
85 | } |
||
86 | |||
87 | /** |
||
88 | * @param $code |
||
89 | * @return string |
||
90 | */ |
||
91 | 18 | protected function getMessageError($code) |
|
98 | } |
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.
If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.