@@ -34,41 +34,41 @@ discard block |
||
34 | 34 | return new XMLHelper($dom); |
35 | 35 | } |
36 | 36 | |
37 | - /** |
|
38 | - * Creates a converter instance from an XML file. |
|
39 | - * @param string $xmlFile |
|
40 | - * @return \AppUtils\XMLHelper_Converter |
|
41 | - */ |
|
37 | + /** |
|
38 | + * Creates a converter instance from an XML file. |
|
39 | + * @param string $xmlFile |
|
40 | + * @return \AppUtils\XMLHelper_Converter |
|
41 | + */ |
|
42 | 42 | public static function convertFile(string $xmlFile) |
43 | 43 | { |
44 | 44 | return XMLHelper_Converter::fromFile($xmlFile); |
45 | 45 | } |
46 | 46 | |
47 | - /** |
|
48 | - * Creates a converter from an XML string. |
|
49 | - * @param string $xmlString |
|
50 | - * @return \AppUtils\XMLHelper_Converter |
|
51 | - */ |
|
47 | + /** |
|
48 | + * Creates a converter from an XML string. |
|
49 | + * @param string $xmlString |
|
50 | + * @return \AppUtils\XMLHelper_Converter |
|
51 | + */ |
|
52 | 52 | public static function convertString(string $xmlString) |
53 | 53 | { |
54 | 54 | return XMLHelper_Converter::fromString($xmlString); |
55 | 55 | } |
56 | 56 | |
57 | - /** |
|
58 | - * Creates a converter from a SimpleXMLElement instance. |
|
59 | - * @param \SimpleXMLElement $element |
|
60 | - * @return \AppUtils\XMLHelper_Converter |
|
61 | - */ |
|
57 | + /** |
|
58 | + * Creates a converter from a SimpleXMLElement instance. |
|
59 | + * @param \SimpleXMLElement $element |
|
60 | + * @return \AppUtils\XMLHelper_Converter |
|
61 | + */ |
|
62 | 62 | public static function convertElement(\SimpleXMLElement $element) |
63 | 63 | { |
64 | 64 | return XMLHelper_Converter::fromElement($element); |
65 | 65 | } |
66 | 66 | |
67 | - /** |
|
68 | - * Creates a converter from a DOMElement instance. |
|
69 | - * @param \DOMElement $element |
|
70 | - * @return \AppUtils\XMLHelper_Converter |
|
71 | - */ |
|
67 | + /** |
|
68 | + * Creates a converter from a DOMElement instance. |
|
69 | + * @param \DOMElement $element |
|
70 | + * @return \AppUtils\XMLHelper_Converter |
|
71 | + */ |
|
72 | 72 | public static function convertDOMElement(\DOMElement $element) |
73 | 73 | { |
74 | 74 | return XMLHelper_Converter::fromDOMElement($element); |
@@ -436,31 +436,31 @@ discard block |
||
436 | 436 | return $this->dom->saveXML(); |
437 | 437 | } |
438 | 438 | |
439 | - /** |
|
440 | - * Creates a new SimpleXML helper instance: this |
|
441 | - * object is useful to work with loading XML strings |
|
442 | - * and files with easy access to any errors that |
|
443 | - * may occurr, since the simplexml functions can be |
|
444 | - * somewhat cryptic. |
|
445 | - * |
|
446 | - * @return XMLHelper_SimpleXML |
|
447 | - */ |
|
439 | + /** |
|
440 | + * Creates a new SimpleXML helper instance: this |
|
441 | + * object is useful to work with loading XML strings |
|
442 | + * and files with easy access to any errors that |
|
443 | + * may occurr, since the simplexml functions can be |
|
444 | + * somewhat cryptic. |
|
445 | + * |
|
446 | + * @return XMLHelper_SimpleXML |
|
447 | + */ |
|
448 | 448 | public static function createSimplexml() |
449 | 449 | { |
450 | 450 | return new XMLHelper_SimpleXML(); |
451 | 451 | } |
452 | 452 | |
453 | - /** |
|
454 | - * Converts a string to valid XML: can be a text only string |
|
455 | - * or an HTML string. Returns valid XML code. |
|
456 | - * |
|
457 | - * NOTE: The string may contain custom tags, which are |
|
458 | - * preserved. |
|
459 | - * |
|
460 | - * @param string $string |
|
461 | - * @throws XMLHelper_Exception |
|
462 | - * @return string |
|
463 | - */ |
|
453 | + /** |
|
454 | + * Converts a string to valid XML: can be a text only string |
|
455 | + * or an HTML string. Returns valid XML code. |
|
456 | + * |
|
457 | + * NOTE: The string may contain custom tags, which are |
|
458 | + * preserved. |
|
459 | + * |
|
460 | + * @param string $string |
|
461 | + * @throws XMLHelper_Exception |
|
462 | + * @return string |
|
463 | + */ |
|
464 | 464 | public static function string2xml(string $string) : string |
465 | 465 | { |
466 | 466 | if(stristr($string, '<body')) |
@@ -60,23 +60,23 @@ discard block |
||
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | - /** |
|
64 | - * The end of line character used in the INI source string. |
|
65 | - * @return string |
|
66 | - */ |
|
63 | + /** |
|
64 | + * The end of line character used in the INI source string. |
|
65 | + * @return string |
|
66 | + */ |
|
67 | 67 | public function getEOLChar() : string |
68 | 68 | { |
69 | 69 | return $this->eol; |
70 | 70 | } |
71 | 71 | |
72 | - /** |
|
73 | - * Factory method: creates a new helper instance loading the |
|
74 | - * ini content from the specified file. |
|
75 | - * |
|
76 | - * @param string $iniPath |
|
77 | - * @throws IniHelper_Exception |
|
78 | - * @return \AppUtils\IniHelper |
|
79 | - */ |
|
72 | + /** |
|
73 | + * Factory method: creates a new helper instance loading the |
|
74 | + * ini content from the specified file. |
|
75 | + * |
|
76 | + * @param string $iniPath |
|
77 | + * @throws IniHelper_Exception |
|
78 | + * @return \AppUtils\IniHelper |
|
79 | + */ |
|
80 | 80 | public static function createFromFile(string $iniPath) |
81 | 81 | { |
82 | 82 | $iniPath = FileHelper::requireFileExists($iniPath); |
@@ -96,35 +96,35 @@ discard block |
||
96 | 96 | ); |
97 | 97 | } |
98 | 98 | |
99 | - /** |
|
100 | - * Factory method: Creates a new ini helper instance from an ini string. |
|
101 | - * |
|
102 | - * @param string $iniContent |
|
103 | - * @return \AppUtils\IniHelper |
|
104 | - */ |
|
99 | + /** |
|
100 | + * Factory method: Creates a new ini helper instance from an ini string. |
|
101 | + * |
|
102 | + * @param string $iniContent |
|
103 | + * @return \AppUtils\IniHelper |
|
104 | + */ |
|
105 | 105 | public static function createFromString(string $iniContent) |
106 | 106 | { |
107 | 107 | return new IniHelper($iniContent); |
108 | 108 | } |
109 | 109 | |
110 | - /** |
|
111 | - * Factory method: Creates a new empty ini helper. |
|
112 | - * |
|
113 | - * @return \AppUtils\IniHelper |
|
114 | - */ |
|
110 | + /** |
|
111 | + * Factory method: Creates a new empty ini helper. |
|
112 | + * |
|
113 | + * @return \AppUtils\IniHelper |
|
114 | + */ |
|
115 | 115 | public static function createNew() |
116 | 116 | { |
117 | 117 | return self::createFromString(''); |
118 | 118 | } |
119 | 119 | |
120 | - /** |
|
121 | - * Adds a new data section, and returns the section instance. |
|
122 | - * If a section with the name already exists, returns that |
|
123 | - * section instead of creating a new one. |
|
124 | - * |
|
125 | - * @param string $name |
|
126 | - * @return IniHelper_Section |
|
127 | - */ |
|
120 | + /** |
|
121 | + * Adds a new data section, and returns the section instance. |
|
122 | + * If a section with the name already exists, returns that |
|
123 | + * section instead of creating a new one. |
|
124 | + * |
|
125 | + * @param string $name |
|
126 | + * @return IniHelper_Section |
|
127 | + */ |
|
128 | 128 | public function addSection(string $name) : IniHelper_Section |
129 | 129 | { |
130 | 130 | if(!isset($this->sections[$name])) { |
@@ -134,12 +134,12 @@ discard block |
||
134 | 134 | return $this->sections[$name]; |
135 | 135 | } |
136 | 136 | |
137 | - /** |
|
138 | - * Retrieves a section by its name, if it exists. |
|
139 | - * |
|
140 | - * @param string $name |
|
141 | - * @return IniHelper_Section|NULL |
|
142 | - */ |
|
137 | + /** |
|
138 | + * Retrieves a section by its name, if it exists. |
|
139 | + * |
|
140 | + * @param string $name |
|
141 | + * @return IniHelper_Section|NULL |
|
142 | + */ |
|
143 | 143 | public function getSection(string $name) : ?IniHelper_Section |
144 | 144 | { |
145 | 145 | if(isset($this->sections[$name])) { |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | return null; |
150 | 150 | } |
151 | 151 | |
152 | - /** |
|
153 | - * Gets the data from the INI file as an associative array. |
|
154 | - * |
|
155 | - * @return array |
|
156 | - */ |
|
152 | + /** |
|
153 | + * Gets the data from the INI file as an associative array. |
|
154 | + * |
|
155 | + * @return array |
|
156 | + */ |
|
157 | 157 | public function toArray() : array |
158 | 158 | { |
159 | 159 | $result = array(); |
@@ -173,17 +173,17 @@ discard block |
||
173 | 173 | return $result; |
174 | 174 | } |
175 | 175 | |
176 | - /** |
|
177 | - * Saves the INI content to the target file. |
|
178 | - * |
|
179 | - * @param string $filePath |
|
180 | - * @return IniHelper |
|
181 | - * @throws FileHelper_Exception |
|
182 | - * |
|
183 | - * @see FileHelper::ERROR_SAVE_FOLDER_NOT_WRITABLE |
|
184 | - * @see FileHelper::ERROR_SAVE_FILE_NOT_WRITABLE |
|
185 | - * @see FileHelper::ERROR_SAVE_FILE_WRITE_FAILED |
|
186 | - */ |
|
176 | + /** |
|
177 | + * Saves the INI content to the target file. |
|
178 | + * |
|
179 | + * @param string $filePath |
|
180 | + * @return IniHelper |
|
181 | + * @throws FileHelper_Exception |
|
182 | + * |
|
183 | + * @see FileHelper::ERROR_SAVE_FOLDER_NOT_WRITABLE |
|
184 | + * @see FileHelper::ERROR_SAVE_FILE_NOT_WRITABLE |
|
185 | + * @see FileHelper::ERROR_SAVE_FILE_WRITE_FAILED |
|
186 | + */ |
|
187 | 187 | public function saveToFile(string $filePath) : IniHelper |
188 | 188 | { |
189 | 189 | FileHelper::saveFile($filePath, self::saveToString()); |
@@ -191,11 +191,11 @@ discard block |
||
191 | 191 | return $this; |
192 | 192 | } |
193 | 193 | |
194 | - /** |
|
195 | - * Returns the INI content as string. |
|
196 | - * |
|
197 | - * @return string |
|
198 | - */ |
|
194 | + /** |
|
195 | + * Returns the INI content as string. |
|
196 | + * |
|
197 | + * @return string |
|
198 | + */ |
|
199 | 199 | public function saveToString() : string |
200 | 200 | { |
201 | 201 | $parts = array(); |
@@ -208,15 +208,15 @@ discard block |
||
208 | 208 | return implode($this->eol, $parts); |
209 | 209 | } |
210 | 210 | |
211 | - /** |
|
212 | - * Sets or adds the value of a setting in the INI content. |
|
213 | - * If the setting does not exist, it is added. Otherwise, |
|
214 | - * the existing value is overwritten. |
|
215 | - * |
|
216 | - * @param string $path A variable path, either <code>varname</code> or <code>section.varname</code>. |
|
217 | - * @param mixed $value |
|
218 | - * @return IniHelper |
|
219 | - */ |
|
211 | + /** |
|
212 | + * Sets or adds the value of a setting in the INI content. |
|
213 | + * If the setting does not exist, it is added. Otherwise, |
|
214 | + * the existing value is overwritten. |
|
215 | + * |
|
216 | + * @param string $path A variable path, either <code>varname</code> or <code>section.varname</code>. |
|
217 | + * @param mixed $value |
|
218 | + * @return IniHelper |
|
219 | + */ |
|
220 | 220 | public function setValue(string $path, $value) : IniHelper |
221 | 221 | { |
222 | 222 | $path = $this->parsePath($path); |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | return $this->addSection(self::SECTION_DEFAULT); |
252 | 252 | } |
253 | 253 | |
254 | - /** |
|
255 | - * Retrieves all variable lines for the specified path. |
|
256 | - * |
|
257 | - * @param string $path A variable path. Either <code>varname</code> or <code>section.varname</code>. |
|
258 | - * @return array|\AppUtils\IniHelper_Line[] |
|
259 | - */ |
|
254 | + /** |
|
255 | + * Retrieves all variable lines for the specified path. |
|
256 | + * |
|
257 | + * @param string $path A variable path. Either <code>varname</code> or <code>section.varname</code>. |
|
258 | + * @return array|\AppUtils\IniHelper_Line[] |
|
259 | + */ |
|
260 | 260 | public function getLinesByVariable(string $path) |
261 | 261 | { |
262 | 262 | $path = $this->parsePath($path); |
@@ -26,48 +26,48 @@ discard block |
||
26 | 26 | */ |
27 | 27 | class JSHelper |
28 | 28 | { |
29 | - /** |
|
30 | - * Quote style using single quotes. |
|
31 | - * @var integer |
|
32 | - */ |
|
29 | + /** |
|
30 | + * Quote style using single quotes. |
|
31 | + * @var integer |
|
32 | + */ |
|
33 | 33 | const QUOTE_STYLE_SINGLE = 1; |
34 | 34 | |
35 | - /** |
|
36 | - * Quote style using double quotes. |
|
37 | - * @var integer |
|
38 | - */ |
|
35 | + /** |
|
36 | + * Quote style using double quotes. |
|
37 | + * @var integer |
|
38 | + */ |
|
39 | 39 | const QUOTE_STYLE_DOUBLE = 2; |
40 | 40 | |
41 | - /** |
|
42 | - * @var array |
|
43 | - */ |
|
41 | + /** |
|
42 | + * @var array |
|
43 | + */ |
|
44 | 44 | protected static $variableCache = array(); |
45 | 45 | |
46 | - /** |
|
47 | - * @var integer |
|
48 | - */ |
|
46 | + /** |
|
47 | + * @var integer |
|
48 | + */ |
|
49 | 49 | protected static $elementCounter = 0; |
50 | 50 | |
51 | - /** |
|
52 | - * @var string |
|
53 | - */ |
|
51 | + /** |
|
52 | + * @var string |
|
53 | + */ |
|
54 | 54 | protected static $idPrefix = 'E'; |
55 | 55 | |
56 | - /** |
|
57 | - * Builds a javascript statement. The first parameter is the |
|
58 | - * javascript function to call, any additional parameters are |
|
59 | - * used as arguments for the javascript function call. Variable |
|
60 | - * types are automagically converted to the javascript equivalents. |
|
61 | - * |
|
62 | - * Examples: |
|
63 | - * |
|
64 | - * // add an alert(); statement: |
|
65 | - * JSHelper::buildStatement('alert'); |
|
66 | - * |
|
67 | - * // add an alert('Alert text'); statement |
|
68 | - * JSHelper::buildStatement('alert', 'Alert text'); |
|
69 | - * |
|
70 | - */ |
|
56 | + /** |
|
57 | + * Builds a javascript statement. The first parameter is the |
|
58 | + * javascript function to call, any additional parameters are |
|
59 | + * used as arguments for the javascript function call. Variable |
|
60 | + * types are automagically converted to the javascript equivalents. |
|
61 | + * |
|
62 | + * Examples: |
|
63 | + * |
|
64 | + * // add an alert(); statement: |
|
65 | + * JSHelper::buildStatement('alert'); |
|
66 | + * |
|
67 | + * // add an alert('Alert text'); statement |
|
68 | + * JSHelper::buildStatement('alert', 'Alert text'); |
|
69 | + * |
|
70 | + */ |
|
71 | 71 | public static function buildStatement() : string |
72 | 72 | { |
73 | 73 | $args = func_get_args(); |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | return call_user_func_array(array(self::class, 'buildStatementQuoteStyle'), $args); |
76 | 76 | } |
77 | 77 | |
78 | - /** |
|
79 | - * Like {@link JSHelper::buildStatement()}, but using single quotes |
|
80 | - * to make it possible to use the statement in an HTML tag attribute. |
|
81 | - * |
|
82 | - * @return string |
|
83 | - * @see JSHelper::buildStatement() |
|
84 | - */ |
|
78 | + /** |
|
79 | + * Like {@link JSHelper::buildStatement()}, but using single quotes |
|
80 | + * to make it possible to use the statement in an HTML tag attribute. |
|
81 | + * |
|
82 | + * @return string |
|
83 | + * @see JSHelper::buildStatement() |
|
84 | + */ |
|
85 | 85 | public static function buildStatementAttribute() : string |
86 | 86 | { |
87 | 87 | $args = func_get_args(); |
@@ -111,39 +111,39 @@ discard block |
||
111 | 111 | return $call . ');'; |
112 | 112 | } |
113 | 113 | |
114 | - /** |
|
115 | - * Builds a set variable statement. The variable value is |
|
116 | - * automatically converted to the javascript equivalent. |
|
117 | - * |
|
118 | - * Examples: |
|
119 | - * |
|
120 | - * // foo = 'bar'; |
|
121 | - * JSHelper::buildVariable('foo', 'bar'); |
|
122 | - * |
|
123 | - * // foo = 42; |
|
124 | - * JSHelper::buildVariable('foo', 42); |
|
125 | - * |
|
126 | - * // foo = true; |
|
127 | - * JSHelper::buildVariable('foo', true); |
|
128 | - * |
|
129 | - * @param string $varName |
|
130 | - * @param mixed $varValue |
|
131 | - * @return string |
|
132 | - */ |
|
114 | + /** |
|
115 | + * Builds a set variable statement. The variable value is |
|
116 | + * automatically converted to the javascript equivalent. |
|
117 | + * |
|
118 | + * Examples: |
|
119 | + * |
|
120 | + * // foo = 'bar'; |
|
121 | + * JSHelper::buildVariable('foo', 'bar'); |
|
122 | + * |
|
123 | + * // foo = 42; |
|
124 | + * JSHelper::buildVariable('foo', 42); |
|
125 | + * |
|
126 | + * // foo = true; |
|
127 | + * JSHelper::buildVariable('foo', true); |
|
128 | + * |
|
129 | + * @param string $varName |
|
130 | + * @param mixed $varValue |
|
131 | + * @return string |
|
132 | + */ |
|
133 | 133 | public static function buildVariable(string $varName, $varValue) : string |
134 | 134 | { |
135 | 135 | return $varName . "=" . self::phpVariable2JS($varValue) . ';'; |
136 | 136 | } |
137 | 137 | |
138 | - /** |
|
139 | - * Converts a PHP variable to its javascript equivalent. Note that |
|
140 | - * if a variable cannot be converted (like a PHP resource), this will |
|
141 | - * return a javascript "null". |
|
142 | - * |
|
143 | - * @param mixed $variable |
|
144 | - * @param int $quoteStyle The quote style to use for strings |
|
145 | - * @return string |
|
146 | - */ |
|
138 | + /** |
|
139 | + * Converts a PHP variable to its javascript equivalent. Note that |
|
140 | + * if a variable cannot be converted (like a PHP resource), this will |
|
141 | + * return a javascript "null". |
|
142 | + * |
|
143 | + * @param mixed $variable |
|
144 | + * @param int $quoteStyle The quote style to use for strings |
|
145 | + * @return string |
|
146 | + */ |
|
147 | 147 | public static function phpVariable2JS($variable, int $quoteStyle=self::QUOTE_STYLE_DOUBLE) : string |
148 | 148 | { |
149 | 149 | // after much profiling, this variant of the method offers |
@@ -221,26 +221,26 @@ discard block |
||
221 | 221 | return $result; |
222 | 222 | } |
223 | 223 | |
224 | - /** |
|
225 | - * Converts a variable to a JS string that can be |
|
226 | - * used in an HTML attribute: it uses single quotes |
|
227 | - * instead of the default double quotes. |
|
228 | - * |
|
229 | - * @param mixed $variable |
|
230 | - * @return string |
|
231 | - */ |
|
224 | + /** |
|
225 | + * Converts a variable to a JS string that can be |
|
226 | + * used in an HTML attribute: it uses single quotes |
|
227 | + * instead of the default double quotes. |
|
228 | + * |
|
229 | + * @param mixed $variable |
|
230 | + * @return string |
|
231 | + */ |
|
232 | 232 | public static function phpVariable2AttributeJS($variable) : string |
233 | 233 | { |
234 | 234 | return self::phpVariable2JS($variable, self::QUOTE_STYLE_SINGLE); |
235 | 235 | } |
236 | 236 | |
237 | - /** |
|
238 | - * Generates a dynamic element ID to be used with dynamically generated |
|
239 | - * HTML code to tie in with clientside javascript when compact but unique |
|
240 | - * IDs are needed in a request. |
|
241 | - * |
|
242 | - * @return string |
|
243 | - */ |
|
237 | + /** |
|
238 | + * Generates a dynamic element ID to be used with dynamically generated |
|
239 | + * HTML code to tie in with clientside javascript when compact but unique |
|
240 | + * IDs are needed in a request. |
|
241 | + * |
|
242 | + * @return string |
|
243 | + */ |
|
244 | 244 | public static function nextElementID() : string |
245 | 245 | { |
246 | 246 | self::$elementCounter++; |
@@ -248,33 +248,33 @@ discard block |
||
248 | 248 | return self::$idPrefix . self::$elementCounter; |
249 | 249 | } |
250 | 250 | |
251 | - /** |
|
252 | - * Retrieves the ID prefix currently used. |
|
253 | - * |
|
254 | - * @return string |
|
255 | - */ |
|
251 | + /** |
|
252 | + * Retrieves the ID prefix currently used. |
|
253 | + * |
|
254 | + * @return string |
|
255 | + */ |
|
256 | 256 | public static function getIDPrefix() : string |
257 | 257 | { |
258 | 258 | return self::$idPrefix; |
259 | 259 | } |
260 | 260 | |
261 | - /** |
|
262 | - * Retrieves the value of the internal elements counter. |
|
263 | - * |
|
264 | - * @return integer |
|
265 | - */ |
|
261 | + /** |
|
262 | + * Retrieves the value of the internal elements counter. |
|
263 | + * |
|
264 | + * @return integer |
|
265 | + */ |
|
266 | 266 | public static function getElementCounter() : int |
267 | 267 | { |
268 | 268 | return self::$elementCounter; |
269 | 269 | } |
270 | 270 | |
271 | - /** |
|
272 | - * Sets the prefix that is added in front of all IDs |
|
273 | - * retrieved using the {@link nextElementID()} method. |
|
274 | - * |
|
275 | - * @param string $prefix |
|
276 | - * @see JSHelper::nextElementID() |
|
277 | - */ |
|
271 | + /** |
|
272 | + * Sets the prefix that is added in front of all IDs |
|
273 | + * retrieved using the {@link nextElementID()} method. |
|
274 | + * |
|
275 | + * @param string $prefix |
|
276 | + * @see JSHelper::nextElementID() |
|
277 | + */ |
|
278 | 278 | public static function setIDPrefix(string $prefix) |
279 | 279 | { |
280 | 280 | self::$idPrefix = $prefix; |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | return $default; |
39 | 39 | } |
40 | 40 | |
41 | - /** |
|
42 | - * Enforces that the option value is a string. Scalar |
|
43 | - * values are converted to string, and non-scalar values |
|
44 | - * are converted to an empty string. |
|
45 | - * |
|
46 | - * @param string $name |
|
47 | - * @return string |
|
48 | - */ |
|
41 | + /** |
|
42 | + * Enforces that the option value is a string. Scalar |
|
43 | + * values are converted to string, and non-scalar values |
|
44 | + * are converted to an empty string. |
|
45 | + * |
|
46 | + * @param string $name |
|
47 | + * @return string |
|
48 | + */ |
|
49 | 49 | public function getStringOption(string $name) : string |
50 | 50 | { |
51 | 51 | $value = $this->getOption($name, false); |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | return ''; |
58 | 58 | } |
59 | 59 | |
60 | - /** |
|
61 | - * Treats the option value as a boolean value: will return |
|
62 | - * true if the value actually is a boolean true. |
|
63 | - * |
|
64 | - * NOTE: boolean string representations are not accepted. |
|
65 | - * |
|
66 | - * @param string $name |
|
67 | - * @return bool |
|
68 | - */ |
|
60 | + /** |
|
61 | + * Treats the option value as a boolean value: will return |
|
62 | + * true if the value actually is a boolean true. |
|
63 | + * |
|
64 | + * NOTE: boolean string representations are not accepted. |
|
65 | + * |
|
66 | + * @param string $name |
|
67 | + * @return bool |
|
68 | + */ |
|
69 | 69 | public function getBoolOption(string $name) : bool |
70 | 70 | { |
71 | 71 | if($this->getOption($name) === true) { |
@@ -24,56 +24,56 @@ discard block |
||
24 | 24 | */ |
25 | 25 | class PaginationHelper |
26 | 26 | { |
27 | - /** |
|
28 | - * @var int |
|
29 | - */ |
|
27 | + /** |
|
28 | + * @var int |
|
29 | + */ |
|
30 | 30 | protected $total; |
31 | 31 | |
32 | - /** |
|
33 | - * @var int |
|
34 | - */ |
|
32 | + /** |
|
33 | + * @var int |
|
34 | + */ |
|
35 | 35 | protected $perPage; |
36 | 36 | |
37 | - /** |
|
38 | - * @var int |
|
39 | - */ |
|
37 | + /** |
|
38 | + * @var int |
|
39 | + */ |
|
40 | 40 | protected $current; |
41 | 41 | |
42 | - /** |
|
43 | - * @var int |
|
44 | - */ |
|
42 | + /** |
|
43 | + * @var int |
|
44 | + */ |
|
45 | 45 | protected $next = 0; |
46 | 46 | |
47 | - /** |
|
48 | - * @var int |
|
49 | - */ |
|
47 | + /** |
|
48 | + * @var int |
|
49 | + */ |
|
50 | 50 | protected $prev = 0; |
51 | 51 | |
52 | - /** |
|
53 | - * @var int |
|
54 | - */ |
|
52 | + /** |
|
53 | + * @var int |
|
54 | + */ |
|
55 | 55 | protected $last = 0; |
56 | 56 | |
57 | - /** |
|
58 | - * @var int |
|
59 | - */ |
|
57 | + /** |
|
58 | + * @var int |
|
59 | + */ |
|
60 | 60 | protected $adjacentPages = 3; |
61 | 61 | |
62 | - /** |
|
63 | - * @var int |
|
64 | - */ |
|
62 | + /** |
|
63 | + * @var int |
|
64 | + */ |
|
65 | 65 | protected $offsetEnd = 0; |
66 | 66 | |
67 | - /** |
|
68 | - * @var int |
|
69 | - */ |
|
67 | + /** |
|
68 | + * @var int |
|
69 | + */ |
|
70 | 70 | protected $offsetStart = 0; |
71 | 71 | |
72 | - /** |
|
73 | - * @param int $totalItems The total amount of items available. |
|
74 | - * @param int $itemsPerPage How many items to display per page. |
|
75 | - * @param int $currentPage The current page number (1-based) |
|
76 | - */ |
|
72 | + /** |
|
73 | + * @param int $totalItems The total amount of items available. |
|
74 | + * @param int $itemsPerPage How many items to display per page. |
|
75 | + * @param int $currentPage The current page number (1-based) |
|
76 | + */ |
|
77 | 77 | public function __construct(int $totalItems, int $itemsPerPage, int $currentPage) |
78 | 78 | { |
79 | 79 | $this->total = $totalItems; |
@@ -83,34 +83,34 @@ discard block |
||
83 | 83 | $this->calculate(); |
84 | 84 | } |
85 | 85 | |
86 | - /** |
|
87 | - * Sets the amount of adjacent pages to display next to the |
|
88 | - * current one when using the pages list. |
|
89 | - * |
|
90 | - * @param int $amount |
|
91 | - * @return PaginationHelper |
|
92 | - */ |
|
86 | + /** |
|
87 | + * Sets the amount of adjacent pages to display next to the |
|
88 | + * current one when using the pages list. |
|
89 | + * |
|
90 | + * @param int $amount |
|
91 | + * @return PaginationHelper |
|
92 | + */ |
|
93 | 93 | public function setAdjacentPages(int $amount) : PaginationHelper |
94 | 94 | { |
95 | 95 | $this->adjacentPages = $amount; |
96 | 96 | return $this; |
97 | 97 | } |
98 | 98 | |
99 | - /** |
|
100 | - * Whether there is a next page after the current page. |
|
101 | - * @return bool |
|
102 | - */ |
|
99 | + /** |
|
100 | + * Whether there is a next page after the current page. |
|
101 | + * @return bool |
|
102 | + */ |
|
103 | 103 | public function hasNextPage() : bool |
104 | 104 | { |
105 | 105 | return $this->next > 0; |
106 | 106 | } |
107 | 107 | |
108 | - /** |
|
109 | - * The next page number. Returns the last page |
|
110 | - * number if there is no next page. |
|
111 | - * |
|
112 | - * @return int |
|
113 | - */ |
|
108 | + /** |
|
109 | + * The next page number. Returns the last page |
|
110 | + * number if there is no next page. |
|
111 | + * |
|
112 | + * @return int |
|
113 | + */ |
|
114 | 114 | public function getNextPage() : int |
115 | 115 | { |
116 | 116 | if($this->next === 0) { |
@@ -120,21 +120,21 @@ discard block |
||
120 | 120 | return $this->next; |
121 | 121 | } |
122 | 122 | |
123 | - /** |
|
124 | - * Whether there is a previous page before the current page. |
|
125 | - * @return bool |
|
126 | - */ |
|
123 | + /** |
|
124 | + * Whether there is a previous page before the current page. |
|
125 | + * @return bool |
|
126 | + */ |
|
127 | 127 | public function hasPreviousPage() : bool |
128 | 128 | { |
129 | 129 | return $this->prev > 0; |
130 | 130 | } |
131 | 131 | |
132 | - /** |
|
133 | - * The previous page number. Returns the first page |
|
134 | - * number if there is no previous page. |
|
135 | - * |
|
136 | - * @return int |
|
137 | - */ |
|
132 | + /** |
|
133 | + * The previous page number. Returns the first page |
|
134 | + * number if there is no previous page. |
|
135 | + * |
|
136 | + * @return int |
|
137 | + */ |
|
138 | 138 | public function getPreviousPage() : int |
139 | 139 | { |
140 | 140 | if($this->prev === 0) { |
@@ -144,21 +144,21 @@ discard block |
||
144 | 144 | return $this->prev; |
145 | 145 | } |
146 | 146 | |
147 | - /** |
|
148 | - * Retrieves the last page number. |
|
149 | - * @return int |
|
150 | - */ |
|
147 | + /** |
|
148 | + * Retrieves the last page number. |
|
149 | + * @return int |
|
150 | + */ |
|
151 | 151 | public function getLastPage() : int |
152 | 152 | { |
153 | 153 | return $this->last; |
154 | 154 | } |
155 | 155 | |
156 | - /** |
|
157 | - * Whether there is more than one page, i.e. whether |
|
158 | - * pagination is required at all. |
|
159 | - * |
|
160 | - * @return bool |
|
161 | - */ |
|
156 | + /** |
|
157 | + * Whether there is more than one page, i.e. whether |
|
158 | + * pagination is required at all. |
|
159 | + * |
|
160 | + * @return bool |
|
161 | + */ |
|
162 | 162 | public function hasPages() : bool |
163 | 163 | { |
164 | 164 | return $this->last > 1; |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | return $this->current; |
170 | 170 | } |
171 | 171 | |
172 | - /** |
|
173 | - * Retrieves a list of page numbers for a page |
|
174 | - * navigator, to quickly jump between pages. |
|
175 | - * |
|
176 | - * @return int[] |
|
177 | - */ |
|
172 | + /** |
|
173 | + * Retrieves a list of page numbers for a page |
|
174 | + * navigator, to quickly jump between pages. |
|
175 | + * |
|
176 | + * @return int[] |
|
177 | + */ |
|
178 | 178 | public function getPageNumbers() : array |
179 | 179 | { |
180 | 180 | $adjacent = $this->adjacentPages; |
@@ -250,66 +250,66 @@ discard block |
||
250 | 250 | return $numbers; |
251 | 251 | } |
252 | 252 | |
253 | - /** |
|
254 | - * Whether the specified page number is the current page. |
|
255 | - * |
|
256 | - * @param int $pageNumber |
|
257 | - * @return bool |
|
258 | - */ |
|
253 | + /** |
|
254 | + * Whether the specified page number is the current page. |
|
255 | + * |
|
256 | + * @param int $pageNumber |
|
257 | + * @return bool |
|
258 | + */ |
|
259 | 259 | public function isCurrentPage(int $pageNumber) : bool |
260 | 260 | { |
261 | 261 | return $pageNumber === $this->current; |
262 | 262 | } |
263 | 263 | |
264 | - /** |
|
265 | - * Retrieves the 1-based starting offset of |
|
266 | - * items currently displayed in the page. |
|
267 | - * |
|
268 | - * Note: Use this to create a text like |
|
269 | - * "showing entries x to y". |
|
270 | - * |
|
271 | - * @return int |
|
272 | - * @see PaginationHelper::getOffsetEnd() |
|
273 | - */ |
|
264 | + /** |
|
265 | + * Retrieves the 1-based starting offset of |
|
266 | + * items currently displayed in the page. |
|
267 | + * |
|
268 | + * Note: Use this to create a text like |
|
269 | + * "showing entries x to y". |
|
270 | + * |
|
271 | + * @return int |
|
272 | + * @see PaginationHelper::getOffsetEnd() |
|
273 | + */ |
|
274 | 274 | public function getItemsStart() : int |
275 | 275 | { |
276 | 276 | return $this->getOffsetStart() + 1; |
277 | 277 | } |
278 | 278 | |
279 | - /** |
|
280 | - * Retrieves the 1-based ending offset of |
|
281 | - * items currently displayed in the page. |
|
282 | - * |
|
283 | - * Note: Use this to create a text like |
|
284 | - * "showing entries x to y". |
|
285 | - * |
|
286 | - * @return int |
|
287 | - * @see PaginationHelper::getOffsetStart() |
|
288 | - */ |
|
279 | + /** |
|
280 | + * Retrieves the 1-based ending offset of |
|
281 | + * items currently displayed in the page. |
|
282 | + * |
|
283 | + * Note: Use this to create a text like |
|
284 | + * "showing entries x to y". |
|
285 | + * |
|
286 | + * @return int |
|
287 | + * @see PaginationHelper::getOffsetStart() |
|
288 | + */ |
|
289 | 289 | public function getItemsEnd() : int |
290 | 290 | { |
291 | 291 | return $this->getOffsetEnd() + 1; |
292 | 292 | } |
293 | 293 | |
294 | - /** |
|
295 | - * Retrieves the 0-based starting offset of |
|
296 | - * items currently displayed in the page. |
|
297 | - * |
|
298 | - * @return int |
|
299 | - * @see PaginationHelper::getItemsStart() |
|
300 | - */ |
|
294 | + /** |
|
295 | + * Retrieves the 0-based starting offset of |
|
296 | + * items currently displayed in the page. |
|
297 | + * |
|
298 | + * @return int |
|
299 | + * @see PaginationHelper::getItemsStart() |
|
300 | + */ |
|
301 | 301 | public function getOffsetStart() : int |
302 | 302 | { |
303 | 303 | return $this->offsetStart; |
304 | 304 | } |
305 | 305 | |
306 | - /** |
|
307 | - * Retrieves the 0-based ending offset of |
|
308 | - * items currently displayed in the page. |
|
309 | - * |
|
310 | - * @return int |
|
311 | - * @see PaginationHelper::getItemsEnd() |
|
312 | - */ |
|
306 | + /** |
|
307 | + * Retrieves the 0-based ending offset of |
|
308 | + * items currently displayed in the page. |
|
309 | + * |
|
310 | + * @return int |
|
311 | + * @see PaginationHelper::getItemsEnd() |
|
312 | + */ |
|
313 | 313 | public function getOffsetEnd() : int |
314 | 314 | { |
315 | 315 | return $this->offsetEnd; |
@@ -68,54 +68,54 @@ discard block |
||
68 | 68 | |
69 | 69 | const ERROR_GD_LIBRARY_NOT_INSTALLED = 513024; |
70 | 70 | |
71 | - /** |
|
72 | - * @var string |
|
73 | - */ |
|
71 | + /** |
|
72 | + * @var string |
|
73 | + */ |
|
74 | 74 | protected $file; |
75 | 75 | |
76 | - /** |
|
77 | - * @var ImageHelper_Size |
|
78 | - */ |
|
76 | + /** |
|
77 | + * @var ImageHelper_Size |
|
78 | + */ |
|
79 | 79 | protected $info; |
80 | 80 | |
81 | - /** |
|
82 | - * @var string |
|
83 | - */ |
|
81 | + /** |
|
82 | + * @var string |
|
83 | + */ |
|
84 | 84 | protected $type; |
85 | 85 | |
86 | - /** |
|
87 | - * @var resource|NULL |
|
88 | - */ |
|
86 | + /** |
|
87 | + * @var resource|NULL |
|
88 | + */ |
|
89 | 89 | protected $newImage; |
90 | 90 | |
91 | - /** |
|
92 | - * @var resource |
|
93 | - */ |
|
91 | + /** |
|
92 | + * @var resource |
|
93 | + */ |
|
94 | 94 | protected $sourceImage; |
95 | 95 | |
96 | - /** |
|
97 | - * @var int |
|
98 | - */ |
|
96 | + /** |
|
97 | + * @var int |
|
98 | + */ |
|
99 | 99 | protected $width; |
100 | 100 | |
101 | - /** |
|
102 | - * @var int |
|
103 | - */ |
|
101 | + /** |
|
102 | + * @var int |
|
103 | + */ |
|
104 | 104 | protected $height; |
105 | 105 | |
106 | - /** |
|
107 | - * @var int |
|
108 | - */ |
|
106 | + /** |
|
107 | + * @var int |
|
108 | + */ |
|
109 | 109 | protected $newWidth; |
110 | 110 | |
111 | - /** |
|
112 | - * @var int |
|
113 | - */ |
|
111 | + /** |
|
112 | + * @var int |
|
113 | + */ |
|
114 | 114 | protected $newHeight; |
115 | 115 | |
116 | - /** |
|
117 | - * @var int |
|
118 | - */ |
|
116 | + /** |
|
117 | + * @var int |
|
118 | + */ |
|
119 | 119 | protected $quality = 85; |
120 | 120 | |
121 | 121 | protected static $imageTypes = array( |
@@ -203,31 +203,31 @@ discard block |
||
203 | 203 | } |
204 | 204 | } |
205 | 205 | |
206 | - /** |
|
207 | - * Factory method: creates a new helper with a blank image. |
|
208 | - * |
|
209 | - * @param integer $width |
|
210 | - * @param integer $height |
|
211 | - * @param string $type The target file type when saving |
|
212 | - * @return ImageHelper |
|
213 | - */ |
|
206 | + /** |
|
207 | + * Factory method: creates a new helper with a blank image. |
|
208 | + * |
|
209 | + * @param integer $width |
|
210 | + * @param integer $height |
|
211 | + * @param string $type The target file type when saving |
|
212 | + * @return ImageHelper |
|
213 | + */ |
|
214 | 214 | public static function createNew($width, $height, $type='png') |
215 | 215 | { |
216 | 216 | return self::createFromResource(imagecreatetruecolor($width, $height), 'png'); |
217 | 217 | } |
218 | 218 | |
219 | - /** |
|
220 | - * Factory method: creates an image helper from an |
|
221 | - * existing image resource. |
|
222 | - * |
|
223 | - * Note: while the resource is type independent, the |
|
224 | - * type parameter is required for some methods, as well |
|
225 | - * as to be able to save the image. |
|
226 | - * |
|
227 | - * @param resource $resource |
|
228 | - * @param string $type The target image type, e.g. "jpeg", "png", etc. |
|
229 | - * @return ImageHelper |
|
230 | - */ |
|
219 | + /** |
|
220 | + * Factory method: creates an image helper from an |
|
221 | + * existing image resource. |
|
222 | + * |
|
223 | + * Note: while the resource is type independent, the |
|
224 | + * type parameter is required for some methods, as well |
|
225 | + * as to be able to save the image. |
|
226 | + * |
|
227 | + * @param resource $resource |
|
228 | + * @param string $type The target image type, e.g. "jpeg", "png", etc. |
|
229 | + * @return ImageHelper |
|
230 | + */ |
|
231 | 231 | public static function createFromResource($resource, string $type) |
232 | 232 | { |
233 | 233 | self::requireResource($resource); |
@@ -235,29 +235,29 @@ discard block |
||
235 | 235 | return new ImageHelper(null, $resource, $type); |
236 | 236 | } |
237 | 237 | |
238 | - /** |
|
239 | - * Factory method: creates an image helper from an |
|
240 | - * image file on disk. |
|
241 | - * |
|
242 | - * @param string $path |
|
243 | - * @return ImageHelper |
|
244 | - */ |
|
238 | + /** |
|
239 | + * Factory method: creates an image helper from an |
|
240 | + * image file on disk. |
|
241 | + * |
|
242 | + * @param string $path |
|
243 | + * @return ImageHelper |
|
244 | + */ |
|
245 | 245 | public static function createFromFile($file) |
246 | 246 | { |
247 | 247 | return new ImageHelper($file); |
248 | 248 | } |
249 | 249 | |
250 | - /** |
|
251 | - * Sets a global image helper configuration value. Available |
|
252 | - * configuration settings are: |
|
253 | - * |
|
254 | - * <ul> |
|
255 | - * <li><code>auto-memory-adjustment</code> <i>boolean</i> Whether totry and adjust the memory limit automatically so there will be enough to load/process the target image.</li> |
|
256 | - * </ul> |
|
257 | - * |
|
258 | - * @param string $name |
|
259 | - * @param mixed $value |
|
260 | - */ |
|
250 | + /** |
|
251 | + * Sets a global image helper configuration value. Available |
|
252 | + * configuration settings are: |
|
253 | + * |
|
254 | + * <ul> |
|
255 | + * <li><code>auto-memory-adjustment</code> <i>boolean</i> Whether totry and adjust the memory limit automatically so there will be enough to load/process the target image.</li> |
|
256 | + * </ul> |
|
257 | + * |
|
258 | + * @param string $name |
|
259 | + * @param mixed $value |
|
260 | + */ |
|
261 | 261 | public static function setConfig($name, $value) |
262 | 262 | { |
263 | 263 | if(isset(self::$config[$name])) { |
@@ -265,22 +265,22 @@ discard block |
||
265 | 265 | } |
266 | 266 | } |
267 | 267 | |
268 | - /** |
|
269 | - * Shorthand for setting the automatic memory adjustment |
|
270 | - * global configuration setting. |
|
271 | - * |
|
272 | - * @param bool $enabled |
|
273 | - */ |
|
268 | + /** |
|
269 | + * Shorthand for setting the automatic memory adjustment |
|
270 | + * global configuration setting. |
|
271 | + * |
|
272 | + * @param bool $enabled |
|
273 | + */ |
|
274 | 274 | public static function setAutoMemoryAdjustment($enabled=true) |
275 | 275 | { |
276 | 276 | self::setConfig('auto-memory-adjustment', $enabled); |
277 | 277 | } |
278 | 278 | |
279 | - /** |
|
280 | - * Duplicates an image resource. |
|
281 | - * @param resource $img |
|
282 | - * @return resource |
|
283 | - */ |
|
279 | + /** |
|
280 | + * Duplicates an image resource. |
|
281 | + * @param resource $img |
|
282 | + * @return resource |
|
283 | + */ |
|
284 | 284 | protected function duplicateImage($img) |
285 | 285 | { |
286 | 286 | self::requireResource($img); |
@@ -292,12 +292,12 @@ discard block |
||
292 | 292 | return $duplicate; |
293 | 293 | } |
294 | 294 | |
295 | - /** |
|
296 | - * Duplicates the current state of the image into a new |
|
297 | - * image helper instance. |
|
298 | - * |
|
299 | - * @return ImageHelper |
|
300 | - */ |
|
295 | + /** |
|
296 | + * Duplicates the current state of the image into a new |
|
297 | + * image helper instance. |
|
298 | + * |
|
299 | + * @return ImageHelper |
|
300 | + */ |
|
301 | 301 | public function duplicate() |
302 | 302 | { |
303 | 303 | return ImageHelper::createFromResource($this->duplicateImage($this->newImage)); |
@@ -485,13 +485,13 @@ discard block |
||
485 | 485 | )); |
486 | 486 | } |
487 | 487 | |
488 | - /** |
|
489 | - * Resamples the image to a new width, maintaining |
|
490 | - * aspect ratio. |
|
491 | - * |
|
492 | - * @param int $width |
|
493 | - * @return ImageHelper |
|
494 | - */ |
|
488 | + /** |
|
489 | + * Resamples the image to a new width, maintaining |
|
490 | + * aspect ratio. |
|
491 | + * |
|
492 | + * @param int $width |
|
493 | + * @return ImageHelper |
|
494 | + */ |
|
495 | 495 | public function resampleByWidth($width) |
496 | 496 | { |
497 | 497 | $size = $this->getSizeByWidth($width); |
@@ -501,12 +501,12 @@ discard block |
||
501 | 501 | return $this; |
502 | 502 | } |
503 | 503 | |
504 | - /** |
|
505 | - * Resamples the image by height, and creates a new image file on disk. |
|
506 | - * |
|
507 | - * @param int $height |
|
508 | - * @return ImageHelper |
|
509 | - */ |
|
504 | + /** |
|
505 | + * Resamples the image by height, and creates a new image file on disk. |
|
506 | + * |
|
507 | + * @param int $height |
|
508 | + * @return ImageHelper |
|
509 | + */ |
|
510 | 510 | public function resampleByHeight($height) : ImageHelper |
511 | 511 | { |
512 | 512 | $size = $this->getSizeByHeight($height); |
@@ -514,13 +514,13 @@ discard block |
||
514 | 514 | return $this->resampleImage($size[0], $size[1]); |
515 | 515 | } |
516 | 516 | |
517 | - /** |
|
518 | - * Resamples the image without keeping the aspect ratio. |
|
519 | - * |
|
520 | - * @param int $width |
|
521 | - * @param int $height |
|
522 | - * @return ImageHelper |
|
523 | - */ |
|
517 | + /** |
|
518 | + * Resamples the image without keeping the aspect ratio. |
|
519 | + * |
|
520 | + * @param int $width |
|
521 | + * @param int $height |
|
522 | + * @return ImageHelper |
|
523 | + */ |
|
524 | 524 | public function resample($width = null, $height = null) : ImageHelper |
525 | 525 | { |
526 | 526 | if($this->isVector()) { |
@@ -585,12 +585,12 @@ discard block |
||
585 | 585 | |
586 | 586 | protected $alpha = false; |
587 | 587 | |
588 | - /** |
|
589 | - * Configures the specified image resource to make it alpha compatible. |
|
590 | - * |
|
591 | - * @param resource $canvas |
|
592 | - * @param bool $fill Whether to fill the whole canvas with the transparency |
|
593 | - */ |
|
588 | + /** |
|
589 | + * Configures the specified image resource to make it alpha compatible. |
|
590 | + * |
|
591 | + * @param resource $canvas |
|
592 | + * @param bool $fill Whether to fill the whole canvas with the transparency |
|
593 | + */ |
|
594 | 594 | public static function addAlphaSupport($canvas, $fill=true) |
595 | 595 | { |
596 | 596 | self::requireResource($canvas); |
@@ -713,12 +713,12 @@ discard block |
||
713 | 713 | $this->quality = $quality * 1; |
714 | 714 | } |
715 | 715 | |
716 | - /** |
|
717 | - * Attempts to adjust the memory to the required size |
|
718 | - * to work with the current image. |
|
719 | - * |
|
720 | - * @return boolean |
|
721 | - */ |
|
716 | + /** |
|
717 | + * Attempts to adjust the memory to the required size |
|
718 | + * to work with the current image. |
|
719 | + * |
|
720 | + * @return boolean |
|
721 | + */ |
|
722 | 722 | protected function adjustMemory() : bool |
723 | 723 | { |
724 | 724 | if(!self::$config['auto-memory-adjustment']) { |
@@ -758,27 +758,27 @@ discard block |
||
758 | 758 | return false; |
759 | 759 | } |
760 | 760 | |
761 | - /** |
|
762 | - * Stretches the image to the specified dimensions. |
|
763 | - * |
|
764 | - * @param int $width |
|
765 | - * @param int $height |
|
766 | - * @return ImageHelper |
|
767 | - */ |
|
761 | + /** |
|
762 | + * Stretches the image to the specified dimensions. |
|
763 | + * |
|
764 | + * @param int $width |
|
765 | + * @param int $height |
|
766 | + * @return ImageHelper |
|
767 | + */ |
|
768 | 768 | public function stretch(int $width, int $height) : ImageHelper |
769 | 769 | { |
770 | 770 | return $this->resampleImage($width, $height); |
771 | 771 | } |
772 | 772 | |
773 | - /** |
|
774 | - * Creates a new image from the current image, |
|
775 | - * resampling it to the new size. |
|
776 | - * |
|
777 | - * @param int $newWidth |
|
778 | - * @param int $newHeight |
|
779 | - * @throws ImageHelper_Exception |
|
780 | - * @return ImageHelper |
|
781 | - */ |
|
773 | + /** |
|
774 | + * Creates a new image from the current image, |
|
775 | + * resampling it to the new size. |
|
776 | + * |
|
777 | + * @param int $newWidth |
|
778 | + * @param int $newHeight |
|
779 | + * @throws ImageHelper_Exception |
|
780 | + * @return ImageHelper |
|
781 | + */ |
|
782 | 782 | protected function resampleImage(int $newWidth, int $newHeight) : ImageHelper |
783 | 783 | { |
784 | 784 | if($this->isVector()) { |
@@ -924,32 +924,32 @@ discard block |
||
924 | 924 | exit; |
925 | 925 | } |
926 | 926 | |
927 | - /** |
|
928 | - * Displays the current image. |
|
929 | - */ |
|
927 | + /** |
|
928 | + * Displays the current image. |
|
929 | + */ |
|
930 | 930 | public function display() |
931 | 931 | { |
932 | 932 | $this->displayImageStream($this->newImage, $this->getType(), $this->resolveQuality()); |
933 | 933 | } |
934 | 934 | |
935 | - /** |
|
936 | - * Trims the current loaded image. |
|
937 | - * |
|
938 | - * @param array $color A color definition, as an associative array with red, green, and blue keys. If not specified, the color at pixel position 0,0 will be used. |
|
939 | - */ |
|
935 | + /** |
|
936 | + * Trims the current loaded image. |
|
937 | + * |
|
938 | + * @param array $color A color definition, as an associative array with red, green, and blue keys. If not specified, the color at pixel position 0,0 will be used. |
|
939 | + */ |
|
940 | 940 | public function trim($color=null) |
941 | 941 | { |
942 | 942 | return $this->trimImage($this->newImage, $color); |
943 | 943 | } |
944 | 944 | |
945 | - /** |
|
946 | - * Trims the specified image resource by removing the specified color. |
|
947 | - * Also works with transparency. |
|
948 | - * |
|
949 | - * @param resource $img |
|
950 | - * @param array $color A color definition, as an associative array with red, green, blue and alpha keys. If not specified, the color at pixel position 0,0 will be used. |
|
951 | - * @return ImageHelper |
|
952 | - */ |
|
945 | + /** |
|
946 | + * Trims the specified image resource by removing the specified color. |
|
947 | + * Also works with transparency. |
|
948 | + * |
|
949 | + * @param resource $img |
|
950 | + * @param array $color A color definition, as an associative array with red, green, blue and alpha keys. If not specified, the color at pixel position 0,0 will be used. |
|
951 | + * @return ImageHelper |
|
952 | + */ |
|
953 | 953 | protected function trimImage($img, $color=null) : ImageHelper |
954 | 954 | { |
955 | 955 | if($this->isVector()) { |
@@ -1036,12 +1036,12 @@ discard block |
||
1036 | 1036 | return $this; |
1037 | 1037 | } |
1038 | 1038 | |
1039 | - /** |
|
1040 | - * Sets the new image after a transformation operation: |
|
1041 | - * automatically adjusts the new size information. |
|
1042 | - * |
|
1043 | - * @param resource $image |
|
1044 | - */ |
|
1039 | + /** |
|
1040 | + * Sets the new image after a transformation operation: |
|
1041 | + * automatically adjusts the new size information. |
|
1042 | + * |
|
1043 | + * @param resource $image |
|
1044 | + */ |
|
1045 | 1045 | protected function setNewImage($image) |
1046 | 1046 | { |
1047 | 1047 | self::requireResource($image); |
@@ -1051,12 +1051,12 @@ discard block |
||
1051 | 1051 | $this->newHeight= imagesy($image); |
1052 | 1052 | } |
1053 | 1053 | |
1054 | - /** |
|
1055 | - * Requires the subject to be a resource. |
|
1056 | - * |
|
1057 | - * @param resource $subject |
|
1058 | - * @throws ImageHelper_Exception |
|
1059 | - */ |
|
1054 | + /** |
|
1055 | + * Requires the subject to be a resource. |
|
1056 | + * |
|
1057 | + * @param resource $subject |
|
1058 | + * @throws ImageHelper_Exception |
|
1059 | + */ |
|
1060 | 1060 | protected static function requireResource($subject) |
1061 | 1061 | { |
1062 | 1062 | if(is_resource($subject)) { |
@@ -1073,14 +1073,14 @@ discard block |
||
1073 | 1073 | ); |
1074 | 1074 | } |
1075 | 1075 | |
1076 | - /** |
|
1077 | - * Creates a new image resource, with transparent background. |
|
1078 | - * |
|
1079 | - * @param int $width |
|
1080 | - * @param int $height |
|
1081 | - * @throws ImageHelper_Exception |
|
1082 | - * @return resource |
|
1083 | - */ |
|
1076 | + /** |
|
1077 | + * Creates a new image resource, with transparent background. |
|
1078 | + * |
|
1079 | + * @param int $width |
|
1080 | + * @param int $height |
|
1081 | + * @throws ImageHelper_Exception |
|
1082 | + * @return resource |
|
1083 | + */ |
|
1084 | 1084 | protected function createNewImage(int $width, int $height) |
1085 | 1085 | { |
1086 | 1086 | $img = imagecreatetruecolor($width, $height); |
@@ -1097,54 +1097,54 @@ discard block |
||
1097 | 1097 | return $img; |
1098 | 1098 | } |
1099 | 1099 | |
1100 | - /** |
|
1101 | - * Whether the two specified colors are the same. |
|
1102 | - * |
|
1103 | - * @param array $a |
|
1104 | - * @param array $b |
|
1105 | - * @return boolean |
|
1106 | - */ |
|
1107 | - protected function colorsMatch($a, $b) : bool |
|
1108 | - { |
|
1109 | - $parts = array('red', 'green', 'blue'); |
|
1110 | - foreach($parts as $part) { |
|
1111 | - if($a[$part] != $b[$part]) { |
|
1112 | - return false; |
|
1113 | - } |
|
1114 | - } |
|
1100 | + /** |
|
1101 | + * Whether the two specified colors are the same. |
|
1102 | + * |
|
1103 | + * @param array $a |
|
1104 | + * @param array $b |
|
1105 | + * @return boolean |
|
1106 | + */ |
|
1107 | + protected function colorsMatch($a, $b) : bool |
|
1108 | + { |
|
1109 | + $parts = array('red', 'green', 'blue'); |
|
1110 | + foreach($parts as $part) { |
|
1111 | + if($a[$part] != $b[$part]) { |
|
1112 | + return false; |
|
1113 | + } |
|
1114 | + } |
|
1115 | 1115 | |
1116 | - return true; |
|
1117 | - } |
|
1116 | + return true; |
|
1117 | + } |
|
1118 | 1118 | |
1119 | - public function fillWhite($x=0, $y=0) |
|
1120 | - { |
|
1121 | - $this->addRGBColor('white', 255, 255, 255); |
|
1119 | + public function fillWhite($x=0, $y=0) |
|
1120 | + { |
|
1121 | + $this->addRGBColor('white', 255, 255, 255); |
|
1122 | 1122 | return $this->fill('white', $x, $y); |
1123 | - } |
|
1123 | + } |
|
1124 | 1124 | |
1125 | - public function fillTransparent() : ImageHelper |
|
1126 | - { |
|
1125 | + public function fillTransparent() : ImageHelper |
|
1126 | + { |
|
1127 | 1127 | $this->enableAlpha(); |
1128 | 1128 | |
1129 | - self::fillImageTransparent($this->newImage); |
|
1129 | + self::fillImageTransparent($this->newImage); |
|
1130 | 1130 | |
1131 | - return $this; |
|
1132 | - } |
|
1131 | + return $this; |
|
1132 | + } |
|
1133 | 1133 | |
1134 | - public static function fillImageTransparent($resource) |
|
1135 | - { |
|
1136 | - self::requireResource($resource); |
|
1134 | + public static function fillImageTransparent($resource) |
|
1135 | + { |
|
1136 | + self::requireResource($resource); |
|
1137 | 1137 | |
1138 | - $transparent = imagecolorallocatealpha($resource, 89, 14, 207, 127); |
|
1139 | - imagecolortransparent ($resource, $transparent); |
|
1140 | - imagefill($resource, 0, 0, $transparent); |
|
1141 | - } |
|
1138 | + $transparent = imagecolorallocatealpha($resource, 89, 14, 207, 127); |
|
1139 | + imagecolortransparent ($resource, $transparent); |
|
1140 | + imagefill($resource, 0, 0, $transparent); |
|
1141 | + } |
|
1142 | 1142 | |
1143 | - public function fill($colorName, $x=0, $y=0) |
|
1144 | - { |
|
1145 | - imagefill($this->newImage, $x, $y, $this->colors[$colorName]); |
|
1146 | - return $this; |
|
1147 | - } |
|
1143 | + public function fill($colorName, $x=0, $y=0) |
|
1144 | + { |
|
1145 | + imagefill($this->newImage, $x, $y, $this->colors[$colorName]); |
|
1146 | + return $this; |
|
1147 | + } |
|
1148 | 1148 | |
1149 | 1149 | protected $colors = array(); |
1150 | 1150 | |
@@ -1165,9 +1165,9 @@ discard block |
||
1165 | 1165 | return $this; |
1166 | 1166 | } |
1167 | 1167 | |
1168 | - /** |
|
1169 | - * @return resource |
|
1170 | - */ |
|
1168 | + /** |
|
1169 | + * @return resource |
|
1170 | + */ |
|
1171 | 1171 | public function getImage() |
1172 | 1172 | { |
1173 | 1173 | return $this->newImage; |
@@ -1185,27 +1185,27 @@ discard block |
||
1185 | 1185 | return $this; |
1186 | 1186 | } |
1187 | 1187 | |
1188 | - /** |
|
1189 | - * Retrieves the size of the image. |
|
1190 | - * |
|
1191 | - * @param bool $exception Whether to trigger an exception when the image does not exist |
|
1192 | - * @return ImageHelper_Size |
|
1193 | - * @throws ImageHelper_Exception |
|
1194 | - * @see ImageHelper::ERROR_CANNOT_GET_IMAGE_SIZE |
|
1195 | - */ |
|
1196 | - public function getSize($exception=true) : ImageHelper_Size |
|
1188 | + /** |
|
1189 | + * Retrieves the size of the image. |
|
1190 | + * |
|
1191 | + * @param bool $exception Whether to trigger an exception when the image does not exist |
|
1192 | + * @return ImageHelper_Size |
|
1193 | + * @throws ImageHelper_Exception |
|
1194 | + * @see ImageHelper::ERROR_CANNOT_GET_IMAGE_SIZE |
|
1195 | + */ |
|
1196 | + public function getSize($exception=true) : ImageHelper_Size |
|
1197 | 1197 | { |
1198 | - return self::getImageSize($this->newImage, $exception); |
|
1198 | + return self::getImageSize($this->newImage, $exception); |
|
1199 | 1199 | } |
1200 | 1200 | |
1201 | 1201 | protected $TTFFile; |
1202 | 1202 | |
1203 | - /** |
|
1204 | - * Sets the TTF font file to use for text operations. |
|
1205 | - * |
|
1206 | - * @param string $filePath |
|
1207 | - * @return ImageHelper |
|
1208 | - */ |
|
1203 | + /** |
|
1204 | + * Sets the TTF font file to use for text operations. |
|
1205 | + * |
|
1206 | + * @param string $filePath |
|
1207 | + * @return ImageHelper |
|
1208 | + */ |
|
1209 | 1209 | public function setFontTTF($filePath) |
1210 | 1210 | { |
1211 | 1211 | $this->TTFFile = $filePath; |
@@ -1277,160 +1277,160 @@ discard block |
||
1277 | 1277 | return; |
1278 | 1278 | } |
1279 | 1279 | |
1280 | - throw new ImageHelper_Exception( |
|
1280 | + throw new ImageHelper_Exception( |
|
1281 | 1281 | 'No true type font specified', |
1282 | 1282 | 'This functionality requires a TTF font file to be specified with the [setFontTTF] method.', |
1283 | 1283 | self::ERROR_NO_TRUE_TYPE_FONT_SET |
1284 | 1284 | ); |
1285 | 1285 | } |
1286 | 1286 | |
1287 | - /** |
|
1288 | - * Retrieves the size of an image file on disk, or |
|
1289 | - * an existing image resource. |
|
1290 | - * |
|
1291 | - * <pre> |
|
1292 | - * array( |
|
1293 | - * 0: (width), |
|
1294 | - * 1: (height), |
|
1295 | - * "channels": the amount of channels |
|
1296 | - * "bits": bits per channel |
|
1287 | + /** |
|
1288 | + * Retrieves the size of an image file on disk, or |
|
1289 | + * an existing image resource. |
|
1290 | + * |
|
1291 | + * <pre> |
|
1292 | + * array( |
|
1293 | + * 0: (width), |
|
1294 | + * 1: (height), |
|
1295 | + * "channels": the amount of channels |
|
1296 | + * "bits": bits per channel |
|
1297 | 1297 | * ) |
1298 | - * </pre> |
|
1299 | - * |
|
1300 | - * @param string|resource $pathOrResource |
|
1301 | - * @param bool $exception Whether to trigger an exception when the image does not exist |
|
1302 | - * @return ImageHelper_Size Size object, can also be accessed like the traditional array from getimagesize |
|
1303 | - * @see ImageHelper_Size |
|
1304 | - * @throws ImageHelper_Exception |
|
1305 | - * @see ImageHelper::ERROR_CANNOT_GET_IMAGE_SIZE |
|
1306 | - * @see ImageHelper::ERROR_CANNOT_READ_SVG_IMAGE |
|
1307 | - * @see ImageHelper::ERROR_SVG_SOURCE_VIEWBOX_MISSING |
|
1308 | - * @see ImageHelper::ERROR_SVG_VIEWBOX_INVALID |
|
1309 | - */ |
|
1310 | - public static function getImageSize($pathOrResource, $exception=true) : ImageHelper_Size |
|
1311 | - { |
|
1312 | - if(is_resource($pathOrResource)) |
|
1313 | - { |
|
1314 | - return new ImageHelper_Size(array( |
|
1315 | - 'width' => imagesx($pathOrResource), |
|
1316 | - 'height' => imagesy($pathOrResource), |
|
1317 | - 'channels' => 1, |
|
1318 | - 'bits' => 8 |
|
1319 | - )); |
|
1320 | - } |
|
1298 | + * </pre> |
|
1299 | + * |
|
1300 | + * @param string|resource $pathOrResource |
|
1301 | + * @param bool $exception Whether to trigger an exception when the image does not exist |
|
1302 | + * @return ImageHelper_Size Size object, can also be accessed like the traditional array from getimagesize |
|
1303 | + * @see ImageHelper_Size |
|
1304 | + * @throws ImageHelper_Exception |
|
1305 | + * @see ImageHelper::ERROR_CANNOT_GET_IMAGE_SIZE |
|
1306 | + * @see ImageHelper::ERROR_CANNOT_READ_SVG_IMAGE |
|
1307 | + * @see ImageHelper::ERROR_SVG_SOURCE_VIEWBOX_MISSING |
|
1308 | + * @see ImageHelper::ERROR_SVG_VIEWBOX_INVALID |
|
1309 | + */ |
|
1310 | + public static function getImageSize($pathOrResource, $exception=true) : ImageHelper_Size |
|
1311 | + { |
|
1312 | + if(is_resource($pathOrResource)) |
|
1313 | + { |
|
1314 | + return new ImageHelper_Size(array( |
|
1315 | + 'width' => imagesx($pathOrResource), |
|
1316 | + 'height' => imagesy($pathOrResource), |
|
1317 | + 'channels' => 1, |
|
1318 | + 'bits' => 8 |
|
1319 | + )); |
|
1320 | + } |
|
1321 | 1321 | |
1322 | - $type = self::getFileImageType($pathOrResource); |
|
1322 | + $type = self::getFileImageType($pathOrResource); |
|
1323 | 1323 | |
1324 | - $info = false; |
|
1325 | - $method = 'getImageSize_'.$type; |
|
1326 | - if(method_exists(__CLASS__, $method)) |
|
1327 | - { |
|
1328 | - $info = call_user_func(array(__CLASS__, $method), $pathOrResource); |
|
1329 | - } |
|
1330 | - else |
|
1331 | - { |
|
1332 | - $info = getimagesize($pathOrResource); |
|
1333 | - } |
|
1324 | + $info = false; |
|
1325 | + $method = 'getImageSize_'.$type; |
|
1326 | + if(method_exists(__CLASS__, $method)) |
|
1327 | + { |
|
1328 | + $info = call_user_func(array(__CLASS__, $method), $pathOrResource); |
|
1329 | + } |
|
1330 | + else |
|
1331 | + { |
|
1332 | + $info = getimagesize($pathOrResource); |
|
1333 | + } |
|
1334 | 1334 | |
1335 | - if($info === false) { |
|
1336 | - if($exception) { |
|
1337 | - throw new ImageHelper_Exception( |
|
1338 | - 'Error opening image file', |
|
1339 | - sprintf( |
|
1340 | - 'Could not get image size for image [%s]', |
|
1341 | - $pathOrResource |
|
1342 | - ), |
|
1343 | - self::ERROR_CANNOT_GET_IMAGE_SIZE |
|
1344 | - ); |
|
1345 | - } |
|
1335 | + if($info === false) { |
|
1336 | + if($exception) { |
|
1337 | + throw new ImageHelper_Exception( |
|
1338 | + 'Error opening image file', |
|
1339 | + sprintf( |
|
1340 | + 'Could not get image size for image [%s]', |
|
1341 | + $pathOrResource |
|
1342 | + ), |
|
1343 | + self::ERROR_CANNOT_GET_IMAGE_SIZE |
|
1344 | + ); |
|
1345 | + } |
|
1346 | 1346 | |
1347 | - return false; |
|
1348 | - } |
|
1347 | + return false; |
|
1348 | + } |
|
1349 | 1349 | |
1350 | - return new ImageHelper_Size($info); |
|
1351 | - } |
|
1350 | + return new ImageHelper_Size($info); |
|
1351 | + } |
|
1352 | 1352 | |
1353 | - protected static function getImageSize_svg($imagePath) |
|
1354 | - { |
|
1355 | - $xml = XMLHelper::createSimplexml(); |
|
1356 | - $xml->loadFile($imagePath); |
|
1353 | + protected static function getImageSize_svg($imagePath) |
|
1354 | + { |
|
1355 | + $xml = XMLHelper::createSimplexml(); |
|
1356 | + $xml->loadFile($imagePath); |
|
1357 | 1357 | |
1358 | - if($xml->hasErrors()) { |
|
1359 | - throw new ImageHelper_Exception( |
|
1360 | - 'Error opening SVG image', |
|
1361 | - sprintf( |
|
1362 | - 'The XML content of the image [%s] could not be parsed.', |
|
1363 | - $imagePath |
|
1358 | + if($xml->hasErrors()) { |
|
1359 | + throw new ImageHelper_Exception( |
|
1360 | + 'Error opening SVG image', |
|
1361 | + sprintf( |
|
1362 | + 'The XML content of the image [%s] could not be parsed.', |
|
1363 | + $imagePath |
|
1364 | 1364 | ), |
1365 | - self::ERROR_CANNOT_READ_SVG_IMAGE |
|
1365 | + self::ERROR_CANNOT_READ_SVG_IMAGE |
|
1366 | 1366 | ); |
1367 | - } |
|
1367 | + } |
|
1368 | 1368 | |
1369 | - $data = $xml->toArray(); |
|
1370 | - $xml->dispose(); |
|
1371 | - unset($xml); |
|
1369 | + $data = $xml->toArray(); |
|
1370 | + $xml->dispose(); |
|
1371 | + unset($xml); |
|
1372 | 1372 | |
1373 | - if(!isset($data['@attributes']) || !isset($data['@attributes']['viewBox'])) { |
|
1374 | - throw new ImageHelper_Exception( |
|
1375 | - 'SVG Image is corrupted', |
|
1376 | - sprintf( |
|
1377 | - 'The [viewBox] attribute is missing in the XML of the image at path [%s].', |
|
1378 | - $imagePath |
|
1373 | + if(!isset($data['@attributes']) || !isset($data['@attributes']['viewBox'])) { |
|
1374 | + throw new ImageHelper_Exception( |
|
1375 | + 'SVG Image is corrupted', |
|
1376 | + sprintf( |
|
1377 | + 'The [viewBox] attribute is missing in the XML of the image at path [%s].', |
|
1378 | + $imagePath |
|
1379 | 1379 | ), |
1380 | - self::ERROR_SVG_SOURCE_VIEWBOX_MISSING |
|
1380 | + self::ERROR_SVG_SOURCE_VIEWBOX_MISSING |
|
1381 | 1381 | ); |
1382 | - } |
|
1382 | + } |
|
1383 | 1383 | |
1384 | - $svgWidth = parseNumber($data['@attributes']['width'])->getNumber(); |
|
1385 | - $svgHeight = parseNumber($data['@attributes']['height'])->getNumber(); |
|
1384 | + $svgWidth = parseNumber($data['@attributes']['width'])->getNumber(); |
|
1385 | + $svgHeight = parseNumber($data['@attributes']['height'])->getNumber(); |
|
1386 | 1386 | |
1387 | - $viewBox = str_replace(' ', ',', $data['@attributes']['viewBox']); |
|
1388 | - $viewBox = explode(',', $viewBox); |
|
1389 | - if(count($viewBox) != 4) { |
|
1390 | - throw new ImageHelper_Exception( |
|
1391 | - 'SVG image has an invalid viewBox attribute', |
|
1392 | - sprintf( |
|
1393 | - 'The [viewBox] attribute does not have an expected value: [%s] in path [%s].', |
|
1394 | - $viewBox, |
|
1395 | - $imagePath |
|
1387 | + $viewBox = str_replace(' ', ',', $data['@attributes']['viewBox']); |
|
1388 | + $viewBox = explode(',', $viewBox); |
|
1389 | + if(count($viewBox) != 4) { |
|
1390 | + throw new ImageHelper_Exception( |
|
1391 | + 'SVG image has an invalid viewBox attribute', |
|
1392 | + sprintf( |
|
1393 | + 'The [viewBox] attribute does not have an expected value: [%s] in path [%s].', |
|
1394 | + $viewBox, |
|
1395 | + $imagePath |
|
1396 | 1396 | ), |
1397 | - self::ERROR_SVG_VIEWBOX_INVALID |
|
1397 | + self::ERROR_SVG_VIEWBOX_INVALID |
|
1398 | 1398 | ); |
1399 | - } |
|
1399 | + } |
|
1400 | 1400 | |
1401 | - $boxWidth = $viewBox[2]; |
|
1402 | - $boxHeight = $viewBox[3]; |
|
1401 | + $boxWidth = $viewBox[2]; |
|
1402 | + $boxHeight = $viewBox[3]; |
|
1403 | 1403 | |
1404 | - // calculate the x and y units of the document: |
|
1405 | - // @see http://tutorials.jenkov.com/svg/svg-viewport-view-box.html#viewbox |
|
1406 | - // |
|
1407 | - // The viewbox combined with the width and heigt of the svg |
|
1408 | - // allow calculating how many pixels are in one unit of the |
|
1409 | - // width and height of the document. |
|
1404 | + // calculate the x and y units of the document: |
|
1405 | + // @see http://tutorials.jenkov.com/svg/svg-viewport-view-box.html#viewbox |
|
1406 | + // |
|
1407 | + // The viewbox combined with the width and heigt of the svg |
|
1408 | + // allow calculating how many pixels are in one unit of the |
|
1409 | + // width and height of the document. |
|
1410 | 1410 | // |
1411 | - $xUnits = $svgWidth / $boxWidth; |
|
1412 | - $yUnits = $svgHeight / $boxHeight; |
|
1411 | + $xUnits = $svgWidth / $boxWidth; |
|
1412 | + $yUnits = $svgHeight / $boxHeight; |
|
1413 | 1413 | |
1414 | - $pxWidth = $xUnits * $svgWidth; |
|
1415 | - $pxHeight = $yUnits * $svgHeight; |
|
1414 | + $pxWidth = $xUnits * $svgWidth; |
|
1415 | + $pxHeight = $yUnits * $svgHeight; |
|
1416 | 1416 | |
1417 | - return array( |
|
1418 | - $pxWidth, |
|
1419 | - $pxHeight, |
|
1420 | - 'bits' => 8 |
|
1421 | - ); |
|
1422 | - } |
|
1417 | + return array( |
|
1418 | + $pxWidth, |
|
1419 | + $pxHeight, |
|
1420 | + 'bits' => 8 |
|
1421 | + ); |
|
1422 | + } |
|
1423 | 1423 | |
1424 | - /** |
|
1425 | - * Crops the image to the specified width and height, optionally |
|
1426 | - * specifying the origin position to crop from. |
|
1427 | - * |
|
1428 | - * @param integer $width |
|
1429 | - * @param integer $height |
|
1430 | - * @param integer $x |
|
1431 | - * @param integer $y |
|
1432 | - * @return ImageHelper |
|
1433 | - */ |
|
1424 | + /** |
|
1425 | + * Crops the image to the specified width and height, optionally |
|
1426 | + * specifying the origin position to crop from. |
|
1427 | + * |
|
1428 | + * @param integer $width |
|
1429 | + * @param integer $height |
|
1430 | + * @param integer $x |
|
1431 | + * @param integer $y |
|
1432 | + * @return ImageHelper |
|
1433 | + */ |
|
1434 | 1434 | public function crop($width, $height, $x=0, $y=0) |
1435 | 1435 | { |
1436 | 1436 | $new = $this->createNewImage($width, $height); |
@@ -1452,13 +1452,13 @@ discard block |
||
1452 | 1452 | return $this->newHeight; |
1453 | 1453 | } |
1454 | 1454 | |
1455 | - /** |
|
1456 | - * Calculates the average color value used in |
|
1457 | - * the image. Returns an associative array |
|
1458 | - * with the red, green, blue and alpha components. |
|
1459 | - * |
|
1460 | - * @return array |
|
1461 | - */ |
|
1455 | + /** |
|
1456 | + * Calculates the average color value used in |
|
1457 | + * the image. Returns an associative array |
|
1458 | + * with the red, green, blue and alpha components. |
|
1459 | + * |
|
1460 | + * @return array |
|
1461 | + */ |
|
1462 | 1462 | public function calcAverageColor($format=self::COLORFORMAT_RGB) |
1463 | 1463 | { |
1464 | 1464 | $image = $this->duplicate(); |
@@ -1480,14 +1480,14 @@ discard block |
||
1480 | 1480 | |
1481 | 1481 | const COLORFORMAT_HEX = 2; |
1482 | 1482 | |
1483 | - /** |
|
1484 | - * Retrieves the color value at the specified pixel |
|
1485 | - * coordinates in the image. |
|
1486 | - * |
|
1487 | - * @param int $x |
|
1488 | - * @param int $y |
|
1489 | - * @return array |
|
1490 | - */ |
|
1483 | + /** |
|
1484 | + * Retrieves the color value at the specified pixel |
|
1485 | + * coordinates in the image. |
|
1486 | + * |
|
1487 | + * @param int $x |
|
1488 | + * @param int $y |
|
1489 | + * @return array |
|
1490 | + */ |
|
1491 | 1491 | public function getColorAt($x, $y, $format=self::COLORFORMAT_RGB) |
1492 | 1492 | { |
1493 | 1493 | if($x > $this->getWidth() || $y > $this->getHeight()) { |
@@ -1514,21 +1514,21 @@ discard block |
||
1514 | 1514 | return $rgb; |
1515 | 1515 | } |
1516 | 1516 | |
1517 | - /** |
|
1518 | - * Converts an RGB value to its luminance equivalent. |
|
1519 | - * |
|
1520 | - * @param array $rgb |
|
1521 | - * @return integer Integer, from 0 to 255 (0=black, 255=white) |
|
1522 | - */ |
|
1517 | + /** |
|
1518 | + * Converts an RGB value to its luminance equivalent. |
|
1519 | + * |
|
1520 | + * @param array $rgb |
|
1521 | + * @return integer Integer, from 0 to 255 (0=black, 255=white) |
|
1522 | + */ |
|
1523 | 1523 | public static function rgb2luma($rgb) |
1524 | 1524 | { |
1525 | 1525 | return (($rgb['red']*2)+$rgb['blue']+($rgb['green']*3))/6; |
1526 | 1526 | } |
1527 | 1527 | |
1528 | - /** |
|
1529 | - * Retrieves the brightness of the image, in percent. |
|
1530 | - * @return number |
|
1531 | - */ |
|
1528 | + /** |
|
1529 | + * Retrieves the brightness of the image, in percent. |
|
1530 | + * @return number |
|
1531 | + */ |
|
1532 | 1532 | public function getBrightness() |
1533 | 1533 | { |
1534 | 1534 | $luma = self::rgb2luma($this->calcAverageColor()); |
@@ -1536,15 +1536,15 @@ discard block |
||
1536 | 1536 | return $percent; |
1537 | 1537 | } |
1538 | 1538 | |
1539 | - /** |
|
1540 | - * Retrieves an md5 hash of the source image file. |
|
1541 | - * |
|
1542 | - * NOTE: Only works when the helper has been created |
|
1543 | - * from a file. Otherwise an exception is thrown. |
|
1544 | - * |
|
1545 | - * @return string |
|
1546 | - * @throws ImageHelper_Exception |
|
1547 | - */ |
|
1539 | + /** |
|
1540 | + * Retrieves an md5 hash of the source image file. |
|
1541 | + * |
|
1542 | + * NOTE: Only works when the helper has been created |
|
1543 | + * from a file. Otherwise an exception is thrown. |
|
1544 | + * |
|
1545 | + * @return string |
|
1546 | + * @throws ImageHelper_Exception |
|
1547 | + */ |
|
1548 | 1548 | public function getHash() |
1549 | 1549 | { |
1550 | 1550 | ob_start(); |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | |
38 | 38 | const ERROR_INVALID_TARGET_TYPE = 22407; |
39 | 39 | |
40 | - /** |
|
41 | - * @var SVNHelper_Target_Folder |
|
42 | - */ |
|
40 | + /** |
|
41 | + * @var SVNHelper_Target_Folder |
|
42 | + */ |
|
43 | 43 | protected $target; |
44 | 44 | |
45 | 45 | protected $path; |
@@ -121,16 +121,16 @@ discard block |
||
121 | 121 | return $this->pass; |
122 | 122 | } |
123 | 123 | |
124 | - /** |
|
125 | - * Normalizes slashes in the path according to the |
|
126 | - * operating system, i.e. forward slashes for NIX-systems |
|
127 | - * and backward slashes for Windows. |
|
128 | - * |
|
129 | - * @param string $path An absolute path to normalize |
|
130 | - * @param bool $relativize Whether to return a path relative to the repository |
|
131 | - * @throws SVNHelper_Exception |
|
132 | - * @return string |
|
133 | - */ |
|
124 | + /** |
|
125 | + * Normalizes slashes in the path according to the |
|
126 | + * operating system, i.e. forward slashes for NIX-systems |
|
127 | + * and backward slashes for Windows. |
|
128 | + * |
|
129 | + * @param string $path An absolute path to normalize |
|
130 | + * @param bool $relativize Whether to return a path relative to the repository |
|
131 | + * @throws SVNHelper_Exception |
|
132 | + * @return string |
|
133 | + */ |
|
134 | 134 | public function normalizePath($path, $relativize=false) |
135 | 135 | { |
136 | 136 | if(empty($path)) { |
@@ -165,32 +165,32 @@ discard block |
||
165 | 165 | ); |
166 | 166 | } |
167 | 167 | |
168 | - /** |
|
169 | - * Retrieves the path slash style according to the |
|
170 | - * current operating system. |
|
171 | - * |
|
172 | - * @return string |
|
173 | - */ |
|
168 | + /** |
|
169 | + * Retrieves the path slash style according to the |
|
170 | + * current operating system. |
|
171 | + * |
|
172 | + * @return string |
|
173 | + */ |
|
174 | 174 | public function getSlash() |
175 | 175 | { |
176 | 176 | return $this->normalize['to']; |
177 | 177 | } |
178 | 178 | |
179 | - /** |
|
180 | - * Keeps instances of files. |
|
181 | - * @var SVNHelper_Target[] |
|
182 | - */ |
|
179 | + /** |
|
180 | + * Keeps instances of files. |
|
181 | + * @var SVNHelper_Target[] |
|
182 | + */ |
|
183 | 183 | protected $targets = array(); |
184 | 184 | |
185 | - /** |
|
186 | - * Retrieves a file instance from the SVN repository: |
|
187 | - * this allows all possible operations on the file as |
|
188 | - * well as accessing more information on it. |
|
189 | - * |
|
190 | - * @param string $path A path to the file, relative to the repository path or absolute. |
|
191 | - * @return SVNHelper_Target_File |
|
192 | - * @throws SVNHelper_Exception |
|
193 | - */ |
|
185 | + /** |
|
186 | + * Retrieves a file instance from the SVN repository: |
|
187 | + * this allows all possible operations on the file as |
|
188 | + * well as accessing more information on it. |
|
189 | + * |
|
190 | + * @param string $path A path to the file, relative to the repository path or absolute. |
|
191 | + * @return SVNHelper_Target_File |
|
192 | + * @throws SVNHelper_Exception |
|
193 | + */ |
|
194 | 194 | public function getFile($path) |
195 | 195 | { |
196 | 196 | $path = $this->filterPath($path); |
@@ -198,15 +198,15 @@ discard block |
||
198 | 198 | return $this->getTarget('File', $this->relativizePath($path)); |
199 | 199 | } |
200 | 200 | |
201 | - /** |
|
202 | - * Retrieves a folder instance from the SVN repository: |
|
203 | - * This allows all possible operations on the folder as |
|
204 | - * well as accessing more information on it. |
|
205 | - * |
|
206 | - * @param string $path |
|
207 | - * @return SVNHelper_Target_Folder |
|
208 | - * @throws SVNHelper_Exception |
|
209 | - */ |
|
201 | + /** |
|
202 | + * Retrieves a folder instance from the SVN repository: |
|
203 | + * This allows all possible operations on the folder as |
|
204 | + * well as accessing more information on it. |
|
205 | + * |
|
206 | + * @param string $path |
|
207 | + * @return SVNHelper_Target_Folder |
|
208 | + * @throws SVNHelper_Exception |
|
209 | + */ |
|
210 | 210 | public function getFolder($path) |
211 | 211 | { |
212 | 212 | $path = $this->filterPath($path); |
@@ -214,13 +214,13 @@ discard block |
||
214 | 214 | return $this->getTarget('Folder', $this->relativizePath($path)); |
215 | 215 | } |
216 | 216 | |
217 | - /** |
|
218 | - * Passes the path through realpath and ensures it exists. |
|
219 | - * |
|
220 | - * @param string $path |
|
221 | - * @throws SVNHelper_Exception |
|
222 | - * @return string |
|
223 | - */ |
|
217 | + /** |
|
218 | + * Passes the path through realpath and ensures it exists. |
|
219 | + * |
|
220 | + * @param string $path |
|
221 | + * @throws SVNHelper_Exception |
|
222 | + * @return string |
|
223 | + */ |
|
224 | 224 | protected function filterPath($path) |
225 | 225 | { |
226 | 226 | if(empty($path)) { |
@@ -245,13 +245,13 @@ discard block |
||
245 | 245 | ); |
246 | 246 | } |
247 | 247 | |
248 | - /** |
|
249 | - * Retrieves a target file or folder within the repository. |
|
250 | - * |
|
251 | - * @param string $type The target type, "File" or "Folder". |
|
252 | - * @param string $relativePath A path relative to the root folder. |
|
253 | - * @return SVNHelper_Target |
|
254 | - */ |
|
248 | + /** |
|
249 | + * Retrieves a target file or folder within the repository. |
|
250 | + * |
|
251 | + * @param string $type The target type, "File" or "Folder". |
|
252 | + * @param string $relativePath A path relative to the root folder. |
|
253 | + * @return SVNHelper_Target |
|
254 | + */ |
|
255 | 255 | protected function getTarget($type, $relativePath) |
256 | 256 | { |
257 | 257 | $key = $type.':'.$relativePath; |
@@ -299,33 +299,33 @@ discard block |
||
299 | 299 | return $this->url; |
300 | 300 | } |
301 | 301 | |
302 | - /** |
|
303 | - * Updates the whole SVN repository from the root folder. |
|
304 | - * @return SVNHelper_CommandResult |
|
305 | - */ |
|
302 | + /** |
|
303 | + * Updates the whole SVN repository from the root folder. |
|
304 | + * @return SVNHelper_CommandResult |
|
305 | + */ |
|
306 | 306 | public function runUpdate() |
307 | 307 | { |
308 | 308 | return $this->createUpdate($this->target)->execute(); |
309 | 309 | } |
310 | 310 | |
311 | - /** |
|
312 | - * Creates an update command for the target file or folder. |
|
313 | - * This can be configured further before it is executed. |
|
314 | - * |
|
315 | - * @param SVNHelper_Target $target |
|
316 | - * @return SVNHelper_Command_Update |
|
317 | - */ |
|
311 | + /** |
|
312 | + * Creates an update command for the target file or folder. |
|
313 | + * This can be configured further before it is executed. |
|
314 | + * |
|
315 | + * @param SVNHelper_Target $target |
|
316 | + * @return SVNHelper_Command_Update |
|
317 | + */ |
|
318 | 318 | public function createUpdate(SVNHelper_Target $target) |
319 | 319 | { |
320 | 320 | return $this->createCommand('Update', $target); |
321 | 321 | } |
322 | 322 | |
323 | - /** |
|
324 | - * Creates an add command for the targt file or folder. |
|
325 | - * |
|
326 | - * @param SVNHelper_Target $target |
|
327 | - * @return SVNHelper_Command_Add |
|
328 | - */ |
|
323 | + /** |
|
324 | + * Creates an add command for the targt file or folder. |
|
325 | + * |
|
326 | + * @param SVNHelper_Target $target |
|
327 | + * @return SVNHelper_Command_Add |
|
328 | + */ |
|
329 | 329 | public function createAdd(SVNHelper_Target $target) |
330 | 330 | { |
331 | 331 | return $this->createCommand('Add', $target); |
@@ -342,12 +342,12 @@ discard block |
||
342 | 342 | return $this->createCommand('Info', $target); |
343 | 343 | } |
344 | 344 | |
345 | - /** |
|
346 | - * Creates a status command for the target file or folder. |
|
347 | - * |
|
348 | - * @param SVNHelper_Target $target |
|
349 | - * @return SVNHelper_Command_Status |
|
350 | - */ |
|
345 | + /** |
|
346 | + * Creates a status command for the target file or folder. |
|
347 | + * |
|
348 | + * @param SVNHelper_Target $target |
|
349 | + * @return SVNHelper_Command_Status |
|
350 | + */ |
|
351 | 351 | public function createStatus(SVNHelper_Target $target) |
352 | 352 | { |
353 | 353 | return $this->createCommand('Status', $target); |
@@ -372,28 +372,28 @@ discard block |
||
372 | 372 | return $cmd; |
373 | 373 | } |
374 | 374 | |
375 | - /** |
|
376 | - * Creates a path relative to the repository for the target |
|
377 | - * file or folder, from an absolute path. |
|
378 | - * |
|
379 | - * @param string $path An absolute path. |
|
380 | - * @return string |
|
381 | - */ |
|
375 | + /** |
|
376 | + * Creates a path relative to the repository for the target |
|
377 | + * file or folder, from an absolute path. |
|
378 | + * |
|
379 | + * @param string $path An absolute path. |
|
380 | + * @return string |
|
381 | + */ |
|
382 | 382 | public function relativizePath($path) |
383 | 383 | { |
384 | 384 | return $this->normalizePath($path, true); |
385 | 385 | } |
386 | 386 | |
387 | - /** |
|
388 | - * Adds a folder: creates it as necessary (recursive), |
|
389 | - * and adds it to be committed if it is not versioned yet. |
|
390 | - * Use this instead of {@link getFolder()} when you are |
|
391 | - * not sure that it exists yet, and will need it. |
|
392 | - * |
|
393 | - * @param string $path Absolute or relative path to the folder |
|
394 | - * @throws SVNHelper_Exception |
|
395 | - * @return SVNHelper_Target_Folder |
|
396 | - */ |
|
387 | + /** |
|
388 | + * Adds a folder: creates it as necessary (recursive), |
|
389 | + * and adds it to be committed if it is not versioned yet. |
|
390 | + * Use this instead of {@link getFolder()} when you are |
|
391 | + * not sure that it exists yet, and will need it. |
|
392 | + * |
|
393 | + * @param string $path Absolute or relative path to the folder |
|
394 | + * @throws SVNHelper_Exception |
|
395 | + * @return SVNHelper_Target_Folder |
|
396 | + */ |
|
397 | 397 | public function addFolder($path) |
398 | 398 | { |
399 | 399 | if(is_dir($path)) { |
@@ -443,14 +443,14 @@ discard block |
||
443 | 443 | |
444 | 444 | protected static $logCallback; |
445 | 445 | |
446 | - /** |
|
447 | - * Sets the callback function/method to use for |
|
448 | - * SVH helper log messages. This gets the message |
|
449 | - * and the SVNHelper instance as parameters. |
|
450 | - * |
|
451 | - * @param callable $callback |
|
452 | - * @throws SVNHelper_Exception |
|
453 | - */ |
|
446 | + /** |
|
447 | + * Sets the callback function/method to use for |
|
448 | + * SVH helper log messages. This gets the message |
|
449 | + * and the SVNHelper instance as parameters. |
|
450 | + * |
|
451 | + * @param callable $callback |
|
452 | + * @throws SVNHelper_Exception |
|
453 | + */ |
|
454 | 454 | public static function setLogCallback($callback) |
455 | 455 | { |
456 | 456 | if(!is_callable($callback)) { |
@@ -471,22 +471,22 @@ discard block |
||
471 | 471 | } |
472 | 472 | } |
473 | 473 | |
474 | - /** |
|
475 | - * Retrieves information about the file, and adds it |
|
476 | - * to be committed later if it not versioned yet. |
|
477 | - * |
|
478 | - * @param string $path |
|
479 | - * @return SVNHelper_Target_File |
|
480 | - */ |
|
474 | + /** |
|
475 | + * Retrieves information about the file, and adds it |
|
476 | + * to be committed later if it not versioned yet. |
|
477 | + * |
|
478 | + * @param string $path |
|
479 | + * @return SVNHelper_Target_File |
|
480 | + */ |
|
481 | 481 | public function addFile($path) |
482 | 482 | { |
483 | 483 | return $this->getFile($path)->runAdd(); |
484 | 484 | } |
485 | 485 | |
486 | - /** |
|
487 | - * Commits all changes in the repository. |
|
488 | - * @param string $message The commit message to log. |
|
489 | - */ |
|
486 | + /** |
|
487 | + * Commits all changes in the repository. |
|
488 | + * @param string $message The commit message to log. |
|
489 | + */ |
|
490 | 490 | public function runCommit($message) |
491 | 491 | { |
492 | 492 | $this->createCommit($this->getFolder($this->path), $message)->execute(); |
@@ -83,12 +83,12 @@ discard block |
||
83 | 83 | return $this; |
84 | 84 | } |
85 | 85 | |
86 | - /** |
|
87 | - * Retrieves the raw, internal information array resulting |
|
88 | - * from the parsing of the number. |
|
89 | - * |
|
90 | - * @return array |
|
91 | - */ |
|
86 | + /** |
|
87 | + * Retrieves the raw, internal information array resulting |
|
88 | + * from the parsing of the number. |
|
89 | + * |
|
90 | + * @return array |
|
91 | + */ |
|
92 | 92 | public function getRawInfo() |
93 | 93 | { |
94 | 94 | return $this->info; |
@@ -576,39 +576,39 @@ discard block |
||
576 | 576 | |
577 | 577 | protected $postProcess = false; |
578 | 578 | |
579 | - /** |
|
580 | - * Called if explicitly enabled: allows filtering the |
|
581 | - * number after the detection process has completed. |
|
582 | - * |
|
583 | - * @param mixed $number The adjusted number |
|
584 | - * @param string $originalString The original value before it was parsed |
|
585 | - * @return mixed |
|
586 | - */ |
|
579 | + /** |
|
580 | + * Called if explicitly enabled: allows filtering the |
|
581 | + * number after the detection process has completed. |
|
582 | + * |
|
583 | + * @param mixed $number The adjusted number |
|
584 | + * @param string $originalString The original value before it was parsed |
|
585 | + * @return mixed |
|
586 | + */ |
|
587 | 587 | protected function postProcess($number, $originalString) |
588 | 588 | { |
589 | 589 | return $number; |
590 | 590 | } |
591 | 591 | |
592 | - /** |
|
593 | - * Filters the value before it is parsed, but only if it is a string. |
|
594 | - * |
|
595 | - * @param string $string |
|
596 | - * @param array $cache |
|
597 | - * @return mixed |
|
598 | - */ |
|
592 | + /** |
|
593 | + * Filters the value before it is parsed, but only if it is a string. |
|
594 | + * |
|
595 | + * @param string $string |
|
596 | + * @param array $cache |
|
597 | + * @return mixed |
|
598 | + */ |
|
599 | 599 | protected function preProcess(string $string, &$cache, $value) |
600 | 600 | { |
601 | 601 | return str_replace(',', '.', $string); |
602 | 602 | } |
603 | 603 | |
604 | - /** |
|
605 | - * Enables the post processing so the postProcess method gets called. |
|
606 | - * This should be called in the {@link NumberInfo::preProcess()} |
|
607 | - * method as needed. |
|
608 | - * |
|
609 | - * @return NumberInfo |
|
610 | - * @see NumberInfo::postProcess() |
|
611 | - */ |
|
604 | + /** |
|
605 | + * Enables the post processing so the postProcess method gets called. |
|
606 | + * This should be called in the {@link NumberInfo::preProcess()} |
|
607 | + * method as needed. |
|
608 | + * |
|
609 | + * @return NumberInfo |
|
610 | + * @see NumberInfo::postProcess() |
|
611 | + */ |
|
612 | 612 | protected function enablePostProcess() : NumberInfo |
613 | 613 | { |
614 | 614 | $this->postProcess = true; |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | return $this instanceof SVNHelper_Target_Folder; |
77 | 77 | } |
78 | 78 | |
79 | - /** |
|
80 | - * Runs an update of the file or folder. |
|
81 | - * @return SVNHelper_Command_Update |
|
82 | - */ |
|
79 | + /** |
|
80 | + * Runs an update of the file or folder. |
|
81 | + * @return SVNHelper_Command_Update |
|
82 | + */ |
|
83 | 83 | public function runUpdate() |
84 | 84 | { |
85 | 85 | $cmd = $this->createUpdate(); |
@@ -88,55 +88,55 @@ discard block |
||
88 | 88 | return $cmd; |
89 | 89 | } |
90 | 90 | |
91 | - /** |
|
92 | - * Creates an update command instance for the target file or folder. |
|
93 | - * @return SVNHelper_Command_Update |
|
94 | - */ |
|
91 | + /** |
|
92 | + * Creates an update command instance for the target file or folder. |
|
93 | + * @return SVNHelper_Command_Update |
|
94 | + */ |
|
95 | 95 | public function createUpdate() |
96 | 96 | { |
97 | 97 | return $this->helper->createUpdate($this); |
98 | 98 | } |
99 | 99 | |
100 | - /** |
|
101 | - * Creates a status command instance for the target file or folder. |
|
102 | - * @return SVNHelper_Command_Status |
|
103 | - */ |
|
100 | + /** |
|
101 | + * Creates a status command instance for the target file or folder. |
|
102 | + * @return SVNHelper_Command_Status |
|
103 | + */ |
|
104 | 104 | public function createStatus() |
105 | 105 | { |
106 | 106 | return $this->helper->createStatus($this); |
107 | 107 | } |
108 | 108 | |
109 | - /** |
|
110 | - * Creates an info command instance for the target file or folder. |
|
111 | - * @return SVNHelper_Command_Info |
|
112 | - */ |
|
109 | + /** |
|
110 | + * Creates an info command instance for the target file or folder. |
|
111 | + * @return SVNHelper_Command_Info |
|
112 | + */ |
|
113 | 113 | public function createInfo() |
114 | 114 | { |
115 | 115 | return $this->helper->createInfo($this); |
116 | 116 | } |
117 | 117 | |
118 | - /** |
|
119 | - * Creates a commit command instance for the target file or folder. |
|
120 | - * @param string $message |
|
121 | - * @return SVNHelper_Command_Commit |
|
122 | - */ |
|
118 | + /** |
|
119 | + * Creates a commit command instance for the target file or folder. |
|
120 | + * @param string $message |
|
121 | + * @return SVNHelper_Command_Commit |
|
122 | + */ |
|
123 | 123 | public function createCommit($message) |
124 | 124 | { |
125 | 125 | return $this->helper->createCommit($this, $message); |
126 | 126 | } |
127 | 127 | |
128 | - /** |
|
129 | - * Creates an add command instance for the target file or folder. |
|
130 | - * @return SVNHelper_Command_Add |
|
131 | - */ |
|
128 | + /** |
|
129 | + * Creates an add command instance for the target file or folder. |
|
130 | + * @return SVNHelper_Command_Add |
|
131 | + */ |
|
132 | 132 | public function createAdd() |
133 | 133 | { |
134 | 134 | return $this->helper->createAdd($this); |
135 | 135 | } |
136 | 136 | |
137 | - /** |
|
138 | - * @return SVNHelper_Command_Status |
|
139 | - */ |
|
137 | + /** |
|
138 | + * @return SVNHelper_Command_Status |
|
139 | + */ |
|
140 | 140 | public function getStatus() |
141 | 141 | { |
142 | 142 | $cmd = $this->createStatus(); |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | return $this; |
155 | 155 | } |
156 | 156 | |
157 | - /** |
|
158 | - * Whether the target is versioned or needs to be added. |
|
159 | - * @return boolean |
|
160 | - */ |
|
157 | + /** |
|
158 | + * Whether the target is versioned or needs to be added. |
|
159 | + * @return boolean |
|
160 | + */ |
|
161 | 161 | public function isVersioned() |
162 | 162 | { |
163 | 163 | return $this->getInfo()->isVersioned(); |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | $this->cache = array(); |
171 | 171 | } |
172 | 172 | |
173 | - /** |
|
174 | - * Retrieves information on the target. |
|
175 | - * @return SVNHelper_Command_Info |
|
176 | - */ |
|
173 | + /** |
|
174 | + * Retrieves information on the target. |
|
175 | + * @return SVNHelper_Command_Info |
|
176 | + */ |
|
177 | 177 | public function getInfo() |
178 | 178 | { |
179 | 179 | if(!isset($this->cache['info'])) { |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | return $this->cache['info']; |
184 | 184 | } |
185 | 185 | |
186 | - /** |
|
187 | - * Commits the target file or folder. If it has |
|
188 | - * not been added to the repository yet, it is |
|
189 | - * added automatically beforehand. If it does |
|
190 | - * not need to be committed, no changes are made. |
|
191 | - * |
|
192 | - * @param string $message |
|
193 | - * @return SVNHelper_Target |
|
194 | - */ |
|
186 | + /** |
|
187 | + * Commits the target file or folder. If it has |
|
188 | + * not been added to the repository yet, it is |
|
189 | + * added automatically beforehand. If it does |
|
190 | + * not need to be committed, no changes are made. |
|
191 | + * |
|
192 | + * @param string $message |
|
193 | + * @return SVNHelper_Target |
|
194 | + */ |
|
195 | 195 | public function runCommit($message) |
196 | 196 | { |
197 | 197 | if(!$this->isVersioned()) { |