Total Complexity | 6 |
Total Lines | 62 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | class Pages |
||
19 | { |
||
20 | /** |
||
21 | * Pages. |
||
22 | * |
||
23 | * @var Page[] |
||
24 | */ |
||
25 | private $pages = []; |
||
26 | |||
27 | /** |
||
28 | * @var WrapperInterface |
||
29 | */ |
||
30 | private $wrapper; |
||
31 | |||
32 | /** |
||
33 | * Constructor. |
||
34 | */ |
||
35 | 28 | public function __construct(WrapperInterface $wrapper = null) |
|
36 | { |
||
37 | 28 | $this->wrapper = $wrapper ?: new PdftkWrapper(); |
|
38 | 28 | } |
|
39 | |||
40 | /** |
||
41 | * Add page to the pages array. |
||
42 | */ |
||
43 | 20 | public function add(Page $page): self |
|
44 | { |
||
45 | 20 | $this->pages[] = $page; |
|
46 | |||
47 | 20 | return $this; |
|
48 | } |
||
49 | |||
50 | /** |
||
51 | * Returns all pages. |
||
52 | * |
||
53 | * @return Page[] |
||
54 | */ |
||
55 | 21 | public function all(): array |
|
58 | } |
||
59 | |||
60 | /** |
||
61 | * Remove all pages. |
||
62 | */ |
||
63 | 2 | public function clear(): self |
|
68 | } |
||
69 | |||
70 | /** |
||
71 | * Imports pages from a PDF file. |
||
72 | * |
||
73 | * @throws PdfException |
||
74 | */ |
||
75 | 10 | public function import(string $infile): self |
|
82 |