1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the Ghostscript package |
4
|
|
|
* |
5
|
|
|
* @author Simon Schrape <[email protected]> |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace GravityMedia\Ghostscript\Device\CommandLineParameters; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* The page parameters trait. |
12
|
|
|
* |
13
|
|
|
* @package GravityMedia\Ghostscript\Device\CommandLineParameters |
14
|
|
|
* |
15
|
|
|
* @link http://ghostscript.com/doc/current/Use.htm#Page_parameters |
16
|
|
|
*/ |
17
|
|
|
trait PageTrait |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* Get argument value. |
21
|
|
|
* |
22
|
|
|
* @param string $name |
23
|
|
|
* |
24
|
|
|
* @return null|string |
25
|
|
|
*/ |
26
|
|
|
abstract protected function getArgumentValue($name); |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Set argument. |
30
|
|
|
* |
31
|
|
|
* @param string $argument |
32
|
|
|
* |
33
|
|
|
* @return $this |
34
|
|
|
*/ |
35
|
|
|
abstract protected function setArgument($argument); |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Get FirstPage parameter value |
39
|
|
|
* |
40
|
|
|
* @return string|null |
41
|
|
|
*/ |
42
|
|
|
public function getFirstPage() |
43
|
|
|
{ |
44
|
|
|
return $this->getArgumentValue('-dFirstPage'); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Set FirstPage parameter |
49
|
|
|
* Begins processing on the designated page of the document. |
50
|
|
|
* |
51
|
|
|
* @param int $firstPage. |
|
|
|
|
52
|
|
|
* |
53
|
|
|
* @return $this |
54
|
|
|
*/ |
55
|
|
|
public function setFirstPage($firstPage) |
56
|
|
|
{ |
57
|
|
|
$this->setArgument(sprintf('-dFirstPage=%d', $firstPage)); |
58
|
|
|
|
59
|
|
|
return $this; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Get LastPage parameter value |
64
|
|
|
* |
65
|
|
|
* @return string|null |
66
|
|
|
*/ |
67
|
|
|
public function getLastPage() |
68
|
|
|
{ |
69
|
|
|
return $this->getArgumentValue('-dLastPage'); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Set LastPage parameter |
74
|
|
|
* Stops processing after the designated page of the document. |
75
|
|
|
* |
76
|
|
|
* @param int $lastPage. |
|
|
|
|
77
|
|
|
* |
78
|
|
|
* @return $this |
79
|
|
|
*/ |
80
|
|
|
public function setLastPage($lastPage) |
81
|
|
|
{ |
82
|
|
|
$this->setArgument(sprintf('-dLastPage=%d', $lastPage)); |
83
|
|
|
|
84
|
|
|
return $this; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* TODO |
89
|
|
|
* |
90
|
|
|
* -dFIXEDMEDIA |
91
|
|
|
* Causes the media size to be fixed after initialization, forcing pages of other sizes or orientations to be |
92
|
|
|
* clipped. This may be useful when printing documents on a printer that can handle their requested paper size |
93
|
|
|
* but whose default is some other size. Note that -g automatically sets -dFIXEDMEDIA, but -sPAPERSIZE= does |
94
|
|
|
* not. |
95
|
|
|
* |
96
|
|
|
* -dFIXEDRESOLUTION |
97
|
|
|
* Causes the media resolution to be fixed similarly. -r automatically sets -dFIXEDRESOLUTION. |
98
|
|
|
* |
99
|
|
|
* -dPSFitPage |
100
|
|
|
* The page size from the PostScript file setpagedevice operator, or one of the older statusdict page size |
101
|
|
|
* operators (such as letter or a4) will be rotated, scaled and centered on the "best fit" page size from those |
102
|
|
|
* availiable in the InputAttributes list. The -dPSFitPage is most easily used to fit pages when used with the |
103
|
|
|
* -dFIXEDMEDIA option. |
104
|
|
|
* |
105
|
|
|
* This option is also set by the -dFitPage option. |
106
|
|
|
* |
107
|
|
|
* -dORIENT1=true |
108
|
|
|
* -dORIENT1=false |
109
|
|
|
* Defines the meaning of the 0 and 1 orientation values for the setpage[params] compatibility operators. The |
110
|
|
|
* default value of ORIENT1 is true (set in gs_init.ps), which is the correct value for most files that use |
111
|
|
|
* setpage[params] at all, namely, files produced by badly designed applications that "know" that the output |
112
|
|
|
* will be printed on certain roll-media printers: these applications use 0 to mean landscape and 1 to mean |
113
|
|
|
* portrait. -dORIENT1=false declares that 0 means portrait and 1 means landscape, which is the convention used |
114
|
|
|
* by a smaller number of files produced by properly written applications. |
115
|
|
|
* |
116
|
|
|
* -dDEVICEWIDTHPOINTS=w |
117
|
|
|
* -dDEVICEHEIGHTPOINTS=h |
118
|
|
|
* Sets the initial page width to w or initial page height to h respectively, specified in 1/72" units. |
119
|
|
|
* |
120
|
|
|
* -sDEFAULTPAPERSIZE=a4 |
121
|
|
|
* This value will be used to replace the device default papersize ONLY if the default papersize for the device |
122
|
|
|
* is 'letter' or 'a4' serving to insulate users of A4 or 8.5x11 from particular device defaults (the |
123
|
|
|
* collection of contributed drivers in Ghostscript vary as to the default size). |
124
|
|
|
* |
125
|
|
|
* -dFitPage |
126
|
|
|
* This is a "convenience" operator that sets the various options to perform page fitting for specific file |
127
|
|
|
* types. |
128
|
|
|
* |
129
|
|
|
* This option sets the -dEPSFitPage, -dPDFFitPage, and the -dFitPage options. |
130
|
|
|
*/ |
131
|
|
|
} |
132
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.
Consider the following example. The parameter
$ireland
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was changed, but the annotation was not.