1 | <?php |
||
12 | class Merger |
||
13 | { |
||
14 | /** |
||
15 | * List of pdf sources to merge |
||
16 | * |
||
17 | * @var SourceInterface[] |
||
18 | */ |
||
19 | private $sources = []; |
||
20 | |||
21 | /** |
||
22 | * @var Fpdi Fpdi object |
||
23 | */ |
||
24 | private $fpdi; |
||
25 | |||
26 | /** |
||
27 | * @var string Directory path used for temporary files |
||
28 | */ |
||
29 | private $tempDir; |
||
30 | |||
31 | /** |
||
32 | * Constructor |
||
33 | * |
||
34 | * @param Fpdi $fpdi |
||
35 | */ |
||
36 | public function __construct(Fpdi $fpdi = null) |
||
40 | |||
41 | /** |
||
42 | * Add raw PDF from string |
||
43 | * |
||
44 | * Note that your PDFs are merged in the order that you add them |
||
45 | * |
||
46 | * @param string $content Raw pdf content |
||
47 | * @param Pages $pages Specification of the pages to add |
||
48 | * @return void |
||
49 | */ |
||
50 | public function addRaw($content, Pages $pages = null) |
||
57 | |||
58 | /** |
||
59 | * Add PDF from filesystem path |
||
60 | * |
||
61 | * Note that your PDFs are merged in the order that you add them |
||
62 | * |
||
63 | * @param string $fname Name of file to add |
||
64 | * @param Pages $pages Pages to add from file |
||
65 | * @return void |
||
66 | * @throws Exception If $fname is not a valid file |
||
67 | */ |
||
68 | public function addFromFile($fname, Pages $pages = null, $cleanup = null) |
||
83 | |||
84 | /** |
||
85 | * Add files using iterator |
||
86 | * |
||
87 | * @param iterable $iterator Iterator or array with names of files to merge |
||
88 | * @param Pages $pages Optional pages constraint used for every added pdf |
||
89 | * @return void |
||
90 | * @throws Exception If $iterator is not valid |
||
91 | */ |
||
92 | public function addIterator($iterator, Pages $pages = null) |
||
102 | |||
103 | /** |
||
104 | * Add files using a symfony finder |
||
105 | * |
||
106 | * @param Finder $finder |
||
107 | * @param Pages $pages Optional pages constraint used for every added pdf |
||
108 | * @return void |
||
109 | */ |
||
110 | public function addFinder(Finder $finder, Pages $pages = null) |
||
116 | |||
117 | /** |
||
118 | * Merges your provided PDFs and get raw string |
||
119 | * |
||
120 | * @return string |
||
121 | * @throws Exception If no PDFs were added |
||
122 | * @throws Exception If a specified page does not exist |
||
123 | * |
||
124 | * @TODO Should $sources be emptied after a merge? Why not implement a clear() method instead? |
||
125 | */ |
||
126 | public function merge() |
||
167 | |||
168 | /** |
||
169 | * Create temporary file and return name |
||
170 | * |
||
171 | * @deprecated Since version 3.1 |
||
172 | */ |
||
173 | public function getTempFname() |
||
182 | |||
183 | /** |
||
184 | * Get directory path for temporary files |
||
185 | * |
||
186 | * @deprecated Since version 3.1 |
||
187 | */ |
||
188 | public function getTempDir() |
||
197 | |||
198 | /** |
||
199 | * Set directory path for temporary files |
||
200 | * |
||
201 | * @deprecated Since version 3.1 |
||
202 | */ |
||
203 | public function setTempDir($dirname) |
||
212 | } |
||
213 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: