Skip to content

Commit 6118b75

Browse files
committed
Issue #159 Fixed type and reformatted comments
1 parent ace8311 commit 6118b75

File tree

4 files changed

+155
-93
lines changed

4 files changed

+155
-93
lines changed

src/Command.php

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
/**
77
* Command
88
*
9-
* This class represents an pdftk shell command. It extends a standard shellcommand
10-
* and adds pdftk specific features to add options and operations.
9+
* This class represents an pdftk shell command. It extends a standard
10+
* shellcommand and adds pdftk specific features to add options and operations.
1111
*
1212
* @author Michael Härtl <haertl.mike@gmail.com>
1313
* @license http://www.opensource.org/licenses/MIT
@@ -20,12 +20,14 @@ class Command extends BaseCommand
2020
protected $_command = 'pdftk';
2121

2222
/**
23-
* @var array list of input files to process as array('name' => $filename, 'password' => $pw) indexed by handle
23+
* @var array list of input files to process as array('name' => $filename,
24+
* 'password' => $pw) indexed by handle
2425
*/
2526
protected $_files = array();
2627

2728
/**
28-
* @var array list of command options, either strings or array with arguments to addArg()
29+
* @var array list of command options, either strings or array with
30+
* arguments to addArg()
2931
*/
3032
protected $_options = array();
3133

@@ -35,21 +37,24 @@ class Command extends BaseCommand
3537
protected $_operation;
3638

3739
/**
38-
* @var string|array operation arguments, e.g. a list of page ranges or a filename or tmp file instance
40+
* @var string|array operation arguments, e.g. a list of page ranges or a
41+
* filename or tmp file instance
3942
*/
4043
protected $_operationArgument = array();
4144

4245
/**
43-
* @var bool whether to force escaping of the operation argument e.g. for filenames
46+
* @var bool whether to force escaping of the operation argument e.g. for
47+
* filenames
4448
*/
4549
protected $_escapeOperationArgument = false;
4650

4751
/**
4852
* @param string $name the PDF file to add for processing
49-
* @param string $handle one or more uppercase letters A..Z to reference this file later.
53+
* @param string $handle one or more uppercase letters A..Z to reference
54+
* this file later.
5055
* @param string|null $password the owner (or user) password if any
51-
* @throws \Exception
5256
* @return Command the command instance for method chaining
57+
* @throws \Exception
5358
*/
5459
public function addFile($name, $handle, $password = null)
5560
{
@@ -64,8 +69,10 @@ public function addFile($name, $handle, $password = null)
6469

6570
/**
6671
* @param string $option the pdftk option to add
67-
* @param string|File|null $argument the argument to add, either string, File instance or null if none
68-
* @param null|bool whether to escape the option. Default is null meaning use Command default setting.
72+
* @param string|File|null $argument the argument to add, either string,
73+
* File instance or null if none
74+
* @param null|bool whether to escape the option. Default is null meaning
75+
* use Command default setting.
6976
* @return Command the command instance for method chaining
7077
*/
7178
public function addOption($option, $argument = null, $escape = null)
@@ -107,7 +114,8 @@ public function setOperationArgument($value, $escape = false)
107114
}
108115

109116
/**
110-
* @return string|array|null the current operation argument as string or array or null if none set
117+
* @return string|array|null the current operation argument as string or
118+
* array or null if none set
111119
*/
112120
public function getOperationArgument()
113121
{
@@ -126,11 +134,15 @@ public function getFileCount()
126134
/**
127135
* Add a page range as used by some operations
128136
*
129-
* @param int|string|array $start the start page number or an array of page numbers. If an array, the other
130-
* arguments will be ignored. $start can also be bigger than $end for pages in reverse order.
131-
* @param int|string|null $end the end page number or null for single page (or list if $start is an array)
132-
* @param string|null $handle the handle of the file to use. Can be null if only a single file was added.
133-
* @param string|null $qualifier the page number qualifier, either 'even' or 'odd' or null for none
137+
* @param int|string|array $start the start page number or an array of page
138+
* numbers. If an array, the other arguments will be ignored. $start can
139+
* also be bigger than $end for pages in reverse order.
140+
* @param int|string|null $end the end page number or null for single page
141+
* (or list if $start is an array)
142+
* @param string|null $handle the handle of the file to use. Can be null if
143+
* only a single file was added.
144+
* @param string|null $qualifier the page number qualifier, either 'even'
145+
* or 'odd' or null for none
134146
* @param string $rotation the rotation to apply to the pages.
135147
* @return Command the command instance for method chaining
136148
*/
@@ -154,7 +166,8 @@ public function addPageRange($start, $end = null, $handle = null, $qualifier = n
154166
}
155167

156168
/**
157-
* @param string|null $filename the filename to add as 'output' option or null if none
169+
* @param string|null $filename the filename to add as 'output' option or
170+
* null if none
158171
* @return bool whether the command was executed successfully
159172
*/
160173
public function execute($filename = null)
@@ -188,7 +201,8 @@ protected function processInputFiles()
188201

189202
/**
190203
* Process options and create respective command arguments
191-
* @param string|null $filename if provided an 'output' option will be added
204+
* @param string|null $filename if provided an 'output' option will be
205+
* added
192206
*/
193207
protected function processOptions($filename = null)
194208
{
@@ -220,7 +234,9 @@ protected function processOperation()
220234
}
221235

222236
/**
223-
* Ensure that the command was not exectued yet. Throws exception otherwise.
237+
* Ensure that the command was not exectued yet. Throws exception
238+
* otherwise.
239+
* @throws \Exception
224240
*/
225241
protected function checkExecutionStatus()
226242
{

src/FdfFile.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
/**
77
* FdfFile
88
*
9-
* This class represents a temporary FDF (1.2) file that can be used to fill a PDF form
10-
* with valid unicode characters.
9+
* This class represents a temporary FDF (1.2) file that can be used to fill a
10+
* PDF form with valid unicode characters.
1111
*
1212
* @author Michael Härtl <haertl.mike@gmail.com>
1313
* @license http://www.opensource.org/licenses/MIT
@@ -34,8 +34,10 @@ class FdfFile extends File
3434
*
3535
* @param array $data the form data as name => value
3636
* @param string|null $suffix the optional suffix for the tmp file
37-
* @param string|null $suffix the optional prefix for the tmp file. If null 'php_tmpfile_' is used.
38-
* @param string|null $directory directory where the file should be created. Autodetected if not provided.
37+
* @param string|null $suffix the optional prefix for the tmp file. If null
38+
* 'php_tmpfile_' is used.
39+
* @param string|null $directory directory where the file should be
40+
* created. Autodetected if not provided.
3941
* @param string|null $encoding of the data. Default is 'UTF-8'.
4042
*/
4143
public function __construct($data, $suffix = null, $prefix = null, $directory = null, $encoding = 'UTF-8')

0 commit comments

Comments
 (0)