-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathJSignPDF.php
More file actions
49 lines (40 loc) · 1.09 KB
/
JSignPDF.php
File metadata and controls
49 lines (40 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace Jeidison\JSignPDF;
use Exception;
use Jeidison\JSignPDF\Sign\JSignParam;
use Jeidison\JSignPDF\Sign\JSignService;
/**
* @author Jeidison Farias <jeidison.farias@gmail.com>
*/
class JSignPDF
{
private JSignService $service;
private ?JSignParam $param = null;
public function __construct(?JSignParam $param = null)
{
$this->service = new JSignService();
$this->param = $param;
}
public static function instance(?JSignParam $param = null): self
{
return new self($param);
}
public function sign(): string
{
if (!$this->param instanceof JSignParam) {
throw new Exception('Invalid JSignParam instance');
}
return $this->service->sign($this->param);
}
public function getVersion(): string
{
if (!$this->param instanceof JSignParam) {
throw new Exception('Invalid JSignParam instance');
}
return $this->service->getVersion($this->param);
}
public function setParam(JSignParam $param): void
{
$this->param = $param;
}
}