1 | <?php |
||
2 | |||
3 | namespace CfdiUtils\Retenciones; |
||
4 | |||
5 | use CfdiUtils\Internals\XmlReaderTrait; |
||
6 | use DOMDocument; |
||
7 | |||
8 | /** |
||
9 | * This class contains minimum helpers to read CFDI Retenciones based on DOMDocument |
||
10 | * |
||
11 | * When the object is instantiated it checks that: |
||
12 | * implements the namespace static::RET_NAMESPACE using a prefix "retenciones" |
||
13 | * the root node is retenciones:Retenciones |
||
14 | * |
||
15 | * This class also provides conversion to Node for easy access and manipulation, |
||
16 | * changes made in Node structure are not reflected into the DOMDocument, |
||
17 | * changes made in DOMDocument three are not reflected into the Node, |
||
18 | * |
||
19 | * Use this class as your starting point to read documents |
||
20 | */ |
||
21 | class Retenciones |
||
22 | { |
||
23 | use XmlReaderTrait; |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
24 | |||
25 | const RET_NAMESPACE = 'http://www.sat.gob.mx/esquemas/retencionpago/1'; |
||
26 | |||
27 | 13 | public function __construct(DOMDocument $document) |
|
28 | { |
||
29 | 13 | $rootElement = self::checkRootElement($document, self::RET_NAMESPACE, 'retenciones', 'Retenciones'); |
|
30 | 8 | $this->document = clone $document; |
|
31 | 8 | $version = $rootElement->getAttribute('Version'); |
|
32 | 8 | $this->version = ('1.0' === $version) ? $version : ''; |
|
33 | 8 | } |
|
34 | } |
||
35 |