XmlDSig   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 7
dl 0
loc 16
rs 10
c 2
b 1
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A sign() 0 10 1
1
<?php
2
3
/**
4
 * MÓDULO DE EMISIÓN ELECTRÓNICA F72X
5
 * UBL 2.1
6
 * Version 1.0
7
 * 
8
 * Copyright 2019, Jaime Cruz
9
 */
10
11
namespace F72X\Tools;
12
13
use F72X\Company;
14
use F72X\Repository;
15
use Greenter\XMLSecLibs\Sunat\SignedXml;
16
17
class XmlDSig {
18
19
    /**
20
     * 
21
     * @param string $documentName
22
     */
23
    public static function sign($documentName) {
24
        $cert = Company::getCertPath();
25
        // Load the XML to be signed
26
        $xmlPath = Repository::getXmlPath($documentName);
27
28
        $signer = new SignedXml();
29
        $signer->setCertificateFromFile($cert);
30
31
        $signedXml = $signer->signFromFile($xmlPath);
32
        Repository::saveSignedXml($documentName, $signedXml);
33
    }
34
35
}
36