@@ -42,8 +42,8 @@ |
||
42 | 42 | $package = $map[$class]; |
43 | 43 | throw new RestException( |
44 | 44 | 500, |
45 | - get_called_class() . ' has external dependency. Please run `composer require ' . |
|
46 | - $package . '` from the project root. Read https://getcomposer.org for more info' |
|
45 | + get_called_class().' has external dependency. Please run `composer require '. |
|
46 | + $package.'` from the project root. Read https://getcomposer.org for more info' |
|
47 | 47 | ); |
48 | 48 | } |
49 | 49 | } |
@@ -37,8 +37,8 @@ |
||
37 | 37 | static::$callbackMethodName |
38 | 38 | = (string) $_GET[static::$callbackOverrideQueryString]; |
39 | 39 | } |
40 | - return static::$callbackMethodName . '(' |
|
41 | - . parent::encode($r, $human_readable) . ');'; |
|
40 | + return static::$callbackMethodName.'(' |
|
41 | + . parent::encode($r, $human_readable).');'; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | public function isReadable() |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | if (self::$unEscapedUnicode) { |
109 | 109 | $result = preg_replace_callback( |
110 | 110 | '/\\\u(\w\w\w\w)/', |
111 | - function ($matches) { |
|
111 | + function($matches) { |
|
112 | 112 | if (function_exists('mb_convert_encoding')) { |
113 | 113 | return mb_convert_encoding(pack('H*', $matches[1]), 'UTF-8', 'UTF-16BE'); |
114 | 114 | } else { |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | case '{' : |
182 | 182 | case '[' : |
183 | 183 | if (!$inString) { |
184 | - $newJson .= $char . "\n" . |
|
184 | + $newJson .= $char."\n". |
|
185 | 185 | str_repeat($tab, $indentLevel + 1); |
186 | 186 | $indentLevel++; |
187 | 187 | } else { |
@@ -192,15 +192,15 @@ discard block |
||
192 | 192 | case ']' : |
193 | 193 | if (!$inString) { |
194 | 194 | $indentLevel--; |
195 | - $newJson .= "\n" . |
|
196 | - str_repeat($tab, $indentLevel) . $char; |
|
195 | + $newJson .= "\n". |
|
196 | + str_repeat($tab, $indentLevel).$char; |
|
197 | 197 | } else { |
198 | 198 | $newJson .= $char; |
199 | 199 | } |
200 | 200 | break; |
201 | 201 | case ',' : |
202 | 202 | if (!$inString) { |
203 | - $newJson .= ",\n" . |
|
203 | + $newJson .= ",\n". |
|
204 | 204 | str_repeat($tab, $indentLevel); |
205 | 205 | } else { |
206 | 206 | $newJson .= $char; |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $message = 'malformed JSON'; |
263 | 263 | break; |
264 | 264 | case JSON_ERROR_UTF8: |
265 | - $message = 'malformed UTF-8 characters, possibly ' . |
|
265 | + $message = 'malformed UTF-8 characters, possibly '. |
|
266 | 266 | 'incorrectly encoded'; |
267 | 267 | break; |
268 | 268 | default: |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } |
273 | 273 | |
274 | 274 | if (isset($message)) { |
275 | - throw new \RuntimeException('Error encoding/decoding JSON: ' . $message); |
|
275 | + throw new \RuntimeException('Error encoding/decoding JSON: '.$message); |
|
276 | 276 | } |
277 | 277 | } |
278 | 278 | } |
@@ -58,8 +58,8 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @var CFPropertyList |
60 | 60 | */ |
61 | - $plist = new CFPropertyList (); |
|
62 | - $td = new CFTypeDetector (); |
|
61 | + $plist = new CFPropertyList(); |
|
62 | + $td = new CFTypeDetector(); |
|
63 | 63 | $guessedStructure = $td->toCFType( |
64 | 64 | Obj::toArray($data) |
65 | 65 | ); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function decode($data) |
83 | 83 | { |
84 | - $plist = new CFPropertyList (); |
|
84 | + $plist = new CFPropertyList(); |
|
85 | 85 | $plist->parse($data); |
86 | 86 | |
87 | 87 | return $plist->toArray(); |
@@ -31,20 +31,20 @@ |
||
31 | 31 | $url = ltrim($url, '/'); |
32 | 32 | /** @var $r Restler */ |
33 | 33 | $r = Scope::get('Restler'); |
34 | - $base = $r->getBaseUrl() . '/'; |
|
34 | + $base = $r->getBaseUrl().'/'; |
|
35 | 35 | if (0 !== strpos($url, 'http')) { |
36 | - $url = $base . $url; |
|
36 | + $url = $base.$url; |
|
37 | 37 | } |
38 | - if (!empty($flashData) || $base . $r->url !== $url || Util::getRequestMethod() != 'GET') { |
|
38 | + if (!empty($flashData) || $base.$r->url !== $url || Util::getRequestMethod() != 'GET') { |
|
39 | 39 | if ($r->responseFormat instanceof JsonFormat) { |
40 | 40 | return array('redirect' => $url); |
41 | 41 | } |
42 | 42 | if (!empty($params)) { |
43 | - $url .= '?' . http_build_query($params); |
|
43 | + $url .= '?'.http_build_query($params); |
|
44 | 44 | } |
45 | 45 | Flash::set($flashData); |
46 | 46 | header( |
47 | - "{$_SERVER['SERVER_PROTOCOL']} $status " . |
|
47 | + "{$_SERVER['SERVER_PROTOCOL']} $status ". |
|
48 | 48 | (isset(RestException::$codes[$status]) ? RestException::$codes[$status] : '') |
49 | 49 | ); |
50 | 50 | header("Location: $url"); |
@@ -38,30 +38,30 @@ discard block |
||
38 | 38 | public function set($name, $data) |
39 | 39 | { |
40 | 40 | if (is_array($data)) { |
41 | - $s = '$o = array();' . PHP_EOL . PHP_EOL; |
|
41 | + $s = '$o = array();'.PHP_EOL.PHP_EOL; |
|
42 | 42 | $s .= '// ** THIS IS AN AUTO GENERATED FILE.' |
43 | 43 | . ' DO NOT EDIT MANUALLY ** '; |
44 | 44 | foreach ($data as $key => $value) { |
45 | - $s .= PHP_EOL . PHP_EOL . |
|
45 | + $s .= PHP_EOL.PHP_EOL. |
|
46 | 46 | "//==================== $key ====================" |
47 | - . PHP_EOL . PHP_EOL; |
|
47 | + . PHP_EOL.PHP_EOL; |
|
48 | 48 | if (is_array($value)) { |
49 | - $s .= '$o[\'' . $key . '\'] = array();'; |
|
49 | + $s .= '$o[\''.$key.'\'] = array();'; |
|
50 | 50 | foreach ($value as $ke => $va) { |
51 | - $s .= PHP_EOL . PHP_EOL . "//==== $key $ke ====" |
|
52 | - . PHP_EOL . PHP_EOL; |
|
53 | - $s .= '$o[\'' . $key . '\'][\'' . $ke . '\'] = ' . |
|
51 | + $s .= PHP_EOL.PHP_EOL."//==== $key $ke ====" |
|
52 | + . PHP_EOL.PHP_EOL; |
|
53 | + $s .= '$o[\''.$key.'\'][\''.$ke.'\'] = '. |
|
54 | 54 | str_replace(' ', ' ', |
55 | - var_export($va, true)) . ';'; |
|
55 | + var_export($va, true)).';'; |
|
56 | 56 | } |
57 | 57 | } else { |
58 | - $s .= '$o[\'' . $key . '\'] = ' |
|
59 | - . var_export($value, true) . ';'; |
|
58 | + $s .= '$o[\''.$key.'\'] = ' |
|
59 | + . var_export($value, true).';'; |
|
60 | 60 | } |
61 | 61 | } |
62 | - $s .= PHP_EOL . 'return $o;'; |
|
62 | + $s .= PHP_EOL.'return $o;'; |
|
63 | 63 | } else { |
64 | - $s = 'return ' . var_export($data, true) . ';'; |
|
64 | + $s = 'return '.var_export($data, true).';'; |
|
65 | 65 | } |
66 | 66 | $file = $this->_file($name); |
67 | 67 | $r = @file_put_contents($file, "<?php $s"); |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | |
116 | 116 | private function _file($name) |
117 | 117 | { |
118 | - return self::$cacheDir . '/' . $name . '.php'; |
|
118 | + return self::$cacheDir.'/'.$name.'.php'; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | private function throwException() |
122 | 122 | { |
123 | 123 | throw new \Exception( |
124 | 124 | 'The cache directory `' |
125 | - . self::$cacheDir . '` should exist with write permission.' |
|
125 | + . self::$cacheDir.'` should exist with write permission.' |
|
126 | 126 | ); |
127 | 127 | } |
128 | 128 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | try { |
80 | 80 | $classMetadata = CommentParser::parse($class->getDocComment()); |
81 | 81 | } catch (Exception $e) { |
82 | - throw new RestException(500, "Error while parsing comments of `$className` class. " . $e->getMessage()); |
|
82 | + throw new RestException(500, "Error while parsing comments of `$className` class. ".$e->getMessage()); |
|
83 | 83 | } |
84 | 84 | $classMetadata['scope'] = $scope = static::scope($class); |
85 | 85 | $methods = $class->getMethods(ReflectionMethod::IS_PUBLIC + |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | try { |
96 | 96 | $metadata = CommentParser::parse($doc) + $classMetadata; |
97 | 97 | } catch (Exception $e) { |
98 | - throw new RestException(500, "Error while parsing comments of `{$className}::{$method->getName()}` method. " . $e->getMessage()); |
|
98 | + throw new RestException(500, "Error while parsing comments of `{$className}::{$method->getName()}` method. ".$e->getMessage()); |
|
99 | 99 | } |
100 | 100 | //@access should not be private |
101 | 101 | if (isset($metadata['access']) |
@@ -157,20 +157,20 @@ discard block |
||
157 | 157 | } |
158 | 158 | $m ['default'] = $defaults [$position]; |
159 | 159 | $m ['required'] = !$param->isOptional(); |
160 | - $contentType = Util::nestedValue($p,'type'); |
|
160 | + $contentType = Util::nestedValue($p, 'type'); |
|
161 | 161 | if ($type == 'array' && $contentType && $qualified = Scope::resolve($contentType, $scope)) { |
162 | 162 | list($p['type'], $children, $modelName) = static::getTypeAndModel( |
163 | 163 | new ReflectionClass($qualified), $scope, |
164 | - $className . Text::title($methodUrl), $p |
|
164 | + $className.Text::title($methodUrl), $p |
|
165 | 165 | ); |
166 | 166 | } |
167 | 167 | if ($type instanceof ReflectionClass) { |
168 | 168 | list($type, $children, $modelName) = static::getTypeAndModel($type, $scope, |
169 | - $className . Text::title($methodUrl), $p); |
|
169 | + $className.Text::title($methodUrl), $p); |
|
170 | 170 | } elseif ($type && is_string($type) && $qualified = Scope::resolve($type, $scope)) { |
171 | 171 | list($type, $children, $modelName) |
172 | 172 | = static::getTypeAndModel(new ReflectionClass($qualified), $scope, |
173 | - $className . Text::title($methodUrl), $p); |
|
173 | + $className.Text::title($methodUrl), $p); |
|
174 | 174 | } |
175 | 175 | if (isset($type)) { |
176 | 176 | $m['type'] = $type; |
@@ -248,13 +248,13 @@ discard block |
||
248 | 248 | ) { |
249 | 249 | foreach ($matches as $match) { |
250 | 250 | $httpMethod = $match[1]; |
251 | - $url = rtrim($resourcePath . $match[2], '/'); |
|
251 | + $url = rtrim($resourcePath.$match[2], '/'); |
|
252 | 252 | //deep copy the call, as it may change for each @url |
253 | 253 | $copy = unserialize(serialize($call)); |
254 | 254 | foreach ($copy['metadata']['param'] as $i => $p) { |
255 | 255 | $inPath = |
256 | - strpos($url, '{' . $p['name'] . '}') || |
|
257 | - strpos($url, ':' . $p['name']); |
|
256 | + strpos($url, '{'.$p['name'].'}') || |
|
257 | + strpos($url, ':'.$p['name']); |
|
258 | 258 | if ($inPath) { |
259 | 259 | $copy['metadata']['param'][$i][$dataName]['from'] = 'path'; |
260 | 260 | } elseif ($httpMethod == 'GET' || $httpMethod == 'DELETE') { |
@@ -264,15 +264,15 @@ discard block |
||
264 | 264 | } |
265 | 265 | } |
266 | 266 | $url = preg_replace_callback('/{[^}]+}|:[^\/]+/', |
267 | - function ($matches) use ($copy) { |
|
267 | + function($matches) use ($copy) { |
|
268 | 268 | $match = trim($matches[0], '{}:'); |
269 | 269 | $index = $copy['arguments'][$match]; |
270 | - return '{' . |
|
270 | + return '{'. |
|
271 | 271 | Routes::typeChar(isset( |
272 | 272 | $copy['metadata']['param'][$index]['type']) |
273 | 273 | ? $copy['metadata']['param'][$index]['type'] |
274 | 274 | : null) |
275 | - . $index . '}'; |
|
275 | + . $index.'}'; |
|
276 | 276 | }, $url); |
277 | 277 | static::addPath($url, $copy, $httpMethod, $version); |
278 | 278 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $methodUrl = ''; |
293 | 293 | } |
294 | 294 | $url = empty($methodUrl) ? rtrim($resourcePath, '/') |
295 | - : $resourcePath . $methodUrl; |
|
295 | + : $resourcePath.$methodUrl; |
|
296 | 296 | for ($position = 0; $position < count($params); $position++) { |
297 | 297 | $from = $metadata['param'][$position][$dataName]['from']; |
298 | 298 | if ($from == 'body' && ($httpMethod == 'GET' || |
@@ -309,11 +309,11 @@ discard block |
||
309 | 309 | foreach ($pathParams as $position) { |
310 | 310 | if (!empty($url)) |
311 | 311 | $url .= '/'; |
312 | - $url .= '{' . |
|
312 | + $url .= '{'. |
|
313 | 313 | static::typeChar(isset($call['metadata']['param'][$position]['type']) |
314 | 314 | ? $call['metadata']['param'][$position]['type'] |
315 | 315 | : null) |
316 | - . $position . '}'; |
|
316 | + . $position.'}'; |
|
317 | 317 | if ($allowAmbiguity || $position == $lastPathParam) { |
318 | 318 | static::addPath($url, $call, $httpMethod, $version); |
319 | 319 | } |
@@ -343,9 +343,9 @@ discard block |
||
343 | 343 | { |
344 | 344 | $call['url'] = preg_replace_callback( |
345 | 345 | "/\{\S(\d+)\}/", |
346 | - function ($matches) use ($call) { |
|
347 | - return '{' . |
|
348 | - $call['metadata']['param'][$matches[1]]['name'] . '}'; |
|
346 | + function($matches) use ($call) { |
|
347 | + return '{'. |
|
348 | + $call['metadata']['param'][$matches[1]]['name'].'}'; |
|
349 | 349 | }, |
350 | 350 | $path |
351 | 351 | ); |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | return static::populate($p[$path][$httpMethod], $data); |
391 | 391 | } elseif (isset($p['*'])) { |
392 | 392 | //================== wildcard routes ======================== |
393 | - uksort($p['*'], function ($a, $b) { |
|
393 | + uksort($p['*'], function($a, $b) { |
|
394 | 394 | return strlen($b) - strlen($a); |
395 | 395 | }); |
396 | 396 | foreach ($p['*'] as $key => $value) { |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | if (substr($path, -1) == '/') |
411 | 411 | $path .= PHP_EOL; |
412 | 412 | //if double slash is found fill in newline char; |
413 | - $path = str_replace('//', '/' . PHP_EOL . '/', $path); |
|
413 | + $path = str_replace('//', '/'.PHP_EOL.'/', $path); |
|
414 | 414 | ksort($p); |
415 | 415 | foreach ($p as $key => $value) { |
416 | 416 | if (!isset($value[$httpMethod])) { |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | } else { |
435 | 435 | $status = 400; |
436 | 436 | $message = 'invalid value specified for `' |
437 | - . $details['name'] . '`'; |
|
437 | + . $details['name'].'`'; |
|
438 | 438 | $found = false; |
439 | 439 | break; |
440 | 440 | } |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | } |
453 | 453 | } |
454 | 454 | if ($status == 405) { |
455 | - header('Allow: ' . implode(', ', $methods)); |
|
455 | + header('Allow: '.implode(', ', $methods)); |
|
456 | 456 | } |
457 | 457 | throw new RestException($status, $message); |
458 | 458 | } |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | $all = $all['*'] + $all; |
467 | 467 | unset($all['*']); |
468 | 468 | } |
469 | - if(is_array($all)){ |
|
469 | + if (is_array($all)) { |
|
470 | 470 | foreach ($all as $fullPath => $routes) { |
471 | 471 | foreach ($routes as $httpMethod => $route) { |
472 | 472 | if (in_array($httpMethod, $excludedHttpMethods)) { |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | continue 2; |
481 | 481 | } |
482 | 482 | } |
483 | - $hash = "$httpMethod " . $route['url']; |
|
483 | + $hash = "$httpMethod ".$route['url']; |
|
484 | 484 | if (!isset($filter[$hash])) { |
485 | 485 | $route['httpMethod'] = $httpMethod; |
486 | 486 | $map[$route['metadata']['resourcePath']][] |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | $stage = end(Scope::get('Restler')->getEvents()); |
571 | 571 | if (empty($stage)) |
572 | 572 | $stage = 'setup'; |
573 | - $r = Scope::get($r->className)->$modifier($r, $stage) ? : $r; |
|
573 | + $r = Scope::get($r->className)->$modifier($r, $stage) ?: $r; |
|
574 | 574 | } |
575 | 575 | return $r; |
576 | 576 | } |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | } |
616 | 616 | $p = 'property'; |
617 | 617 | $r = empty($c[$p]) ? array() : $c[$p]; |
618 | - $p .= '-' . ($forResponse ? 'read' : 'write'); |
|
618 | + $p .= '-'.($forResponse ? 'read' : 'write'); |
|
619 | 619 | if (!empty($c[$p])) { |
620 | 620 | $r = array_merge($r, $c[$p]); |
621 | 621 | } |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | * |
636 | 636 | * @access protected |
637 | 637 | */ |
638 | - protected static function getTypeAndModel(ReflectionClass $class, array $scope, $prefix='', array $rules=array()) |
|
638 | + protected static function getTypeAndModel(ReflectionClass $class, array $scope, $prefix = '', array $rules = array()) |
|
639 | 639 | { |
640 | 640 | $className = $class->getName(); |
641 | 641 | $dataName = CommentParser::$embeddedDataName; |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | if ($magic_properties = static::parseMagic($class, empty($prefix))) { |
648 | 648 | foreach ($magic_properties as $prop) { |
649 | 649 | if (!isset($prop['name'])) { |
650 | - throw new Exception('@property comment is not properly defined in ' . $className . ' class'); |
|
650 | + throw new Exception('@property comment is not properly defined in '.$className.' class'); |
|
651 | 651 | } |
652 | 652 | if (!isset($prop[$dataName]['label'])) { |
653 | 653 | $prop[$dataName]['label'] = Text::title($prop['name']); |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | } |
704 | 704 | } catch (Exception $e) { |
705 | 705 | if (Text::endsWith($e->getFile(), 'CommentParser.php')) { |
706 | - throw new RestException(500, "Error while parsing comments of `$className` class. " . $e->getMessage()); |
|
706 | + throw new RestException(500, "Error while parsing comments of `$className` class. ".$e->getMessage()); |
|
707 | 707 | } |
708 | 708 | throw $e; |
709 | 709 | } |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | { |
770 | 770 | $namespace = $class->getNamespaceName(); |
771 | 771 | $imports = array( |
772 | - '*' => empty($namespace) ? '' : $namespace . '\\' |
|
772 | + '*' => empty($namespace) ? '' : $namespace.'\\' |
|
773 | 773 | ); |
774 | 774 | $file = file_get_contents($class->getFileName()); |
775 | 775 | $tokens = token_get_all($file); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | static::$self = $this; |
26 | 26 | if (!empty(static::$_waitList)) { |
27 | 27 | foreach (static::$_waitList as $param) { |
28 | - call_user_func_array(array($this,$param[0]), $param[1]); |
|
28 | + call_user_func_array(array($this, $param[0]), $param[1]); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public static function __callStatic($eventName, $params) |
34 | 34 | { |
35 | 35 | if (0 === strpos($eventName, 'on')) { |
36 | - if(static::$self){ |
|
36 | + if (static::$self) { |
|
37 | 37 | return call_user_func_array(array(static::$self, $eventName), $params); |
38 | 38 | } |
39 | 39 | static::$_waitList[] = func_get_args(); |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | // |
56 | 56 | // OPERATIONS |
57 | 57 | // |
58 | - public function cupsGetDefaults($attributes=array("all")) |
|
58 | + public function cupsGetDefaults($attributes = array("all")) |
|
59 | 59 | { |
60 | 60 | //The CUPS-Get-Default operation returns the default printer URI and attributes |
61 | 61 | |
62 | - $this->jobs = array_merge($this->jobs,array("")); |
|
63 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
62 | + $this->jobs = array_merge($this->jobs, array("")); |
|
63 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
64 | 64 | $this->parsed = array(); |
65 | 65 | unset($this->printer_attributes); |
66 | 66 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | self::_setOperationId(); |
78 | 78 | |
79 | - for($i = 0 ; $i < count($attributes) ; $i++) |
|
79 | + for ($i = 0; $i < count($attributes); $i++) |
|
80 | 80 | { |
81 | 81 | if ($i == 0) |
82 | 82 | { |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
98 | - $this->stringjob = chr(0x01) . chr(0x01) // IPP version 1.1 |
|
99 | - . chr(0x40). chr(0x01) // operation: cups vendor extension: get defaults |
|
98 | + $this->stringjob = chr(0x01).chr(0x01) // IPP version 1.1 |
|
99 | + . chr(0x40).chr(0x01) // operation: cups vendor extension: get defaults |
|
100 | 100 | . $this->meta->operation_id // request-id |
101 | 101 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
102 | 102 | . $this->meta->charset |
@@ -108,13 +108,13 @@ discard block |
||
108 | 108 | |
109 | 109 | self::_putDebug("Request: ".$this->output); |
110 | 110 | |
111 | - $post_values = array( "Content-Type" => "application/ipp", |
|
111 | + $post_values = array("Content-Type" => "application/ipp", |
|
112 | 112 | "Data" => $this->output); |
113 | 113 | |
114 | - if (self::_sendHttp ($post_values,'/')) |
|
114 | + if (self::_sendHttp($post_values, '/')) |
|
115 | 115 | { |
116 | 116 | |
117 | - if(self::_parseServerOutput()) |
|
117 | + if (self::_parseServerOutput()) |
|
118 | 118 | { |
119 | 119 | self::_parsePrinterAttributes(); |
120 | 120 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $printer_type = $this->printer_attributes->printer_type->_value0; |
128 | 128 | $table = self::_interpretPrinterType($printer_type); |
129 | 129 | |
130 | - for($i = 0 ; $i < count($table) ; $i++ ) |
|
130 | + for ($i = 0; $i < count($table); $i++) |
|
131 | 131 | { |
132 | 132 | $index = '_value'.$i; |
133 | 133 | $this->printer_attributes->printer_type->$index = $table[$i]; |
@@ -137,22 +137,22 @@ discard block |
||
137 | 137 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
138 | 138 | { |
139 | 139 | |
140 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
140 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
141 | 141 | if ($this->serveroutput->status == "successfull-ok") |
142 | 142 | { |
143 | - self::_errorLog("getting defaults: ".$this->serveroutput->status,3); |
|
143 | + self::_errorLog("getting defaults: ".$this->serveroutput->status, 3); |
|
144 | 144 | } |
145 | 145 | else |
146 | 146 | { |
147 | - self::_errorLog("getting defaults: ".$this->serveroutput->status,1); |
|
147 | + self::_errorLog("getting defaults: ".$this->serveroutput->status, 1); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | return $this->serveroutput->status; |
151 | 151 | } |
152 | 152 | else |
153 | 153 | { |
154 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
155 | - self::_errorLog("getting defaults : OPERATION FAILED",1); |
|
154 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
155 | + self::_errorLog("getting defaults : OPERATION FAILED", 1); |
|
156 | 156 | } |
157 | 157 | return false; |
158 | 158 | } |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | { |
163 | 163 | //The CUPS-Get-Default operation returns the default printer URI and attributes |
164 | 164 | |
165 | - $this->jobs = array_merge($this->jobs,array("")); |
|
166 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
165 | + $this->jobs = array_merge($this->jobs, array("")); |
|
166 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
167 | 167 | $this->parsed = array(); |
168 | 168 | unset($this->printer_attributes); |
169 | 169 | |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | |
180 | 180 | self::_setOperationId(); |
181 | 181 | |
182 | - $this->stringjob = chr(0x01) . chr(0x01) // IPP version 1.1 |
|
183 | - . chr(0x40). chr(0x08) // operation: cups vendor extension: Accept-Jobs |
|
182 | + $this->stringjob = chr(0x01).chr(0x01) // IPP version 1.1 |
|
183 | + . chr(0x40).chr(0x08) // operation: cups vendor extension: Accept-Jobs |
|
184 | 184 | . $this->meta->operation_id // request-id |
185 | 185 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
186 | 186 | . $this->meta->charset |
@@ -196,13 +196,13 @@ discard block |
||
196 | 196 | |
197 | 197 | self::_putDebug("Request: ".$this->output); |
198 | 198 | |
199 | - $post_values = array( "Content-Type" => "application/ipp", |
|
199 | + $post_values = array("Content-Type" => "application/ipp", |
|
200 | 200 | "Data" => $this->output); |
201 | 201 | |
202 | - if (self::_sendHttp ($post_values,'/admin/')) |
|
202 | + if (self::_sendHttp($post_values, '/admin/')) |
|
203 | 203 | { |
204 | 204 | |
205 | - if(self::_parseServerOutput()) |
|
205 | + if (self::_parseServerOutput()) |
|
206 | 206 | { |
207 | 207 | self::_parseAttributes(); |
208 | 208 | } |
@@ -211,33 +211,33 @@ discard block |
||
211 | 211 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
212 | 212 | { |
213 | 213 | |
214 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
214 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
215 | 215 | if ($this->serveroutput->status == "successfull-ok") |
216 | 216 | { |
217 | - self::_errorLog("getting defaults: ".$this->serveroutput->status,3); |
|
217 | + self::_errorLog("getting defaults: ".$this->serveroutput->status, 3); |
|
218 | 218 | } |
219 | 219 | else |
220 | 220 | { |
221 | - self::_errorLog("getting defaults: ".$this->serveroutput->status,1); |
|
221 | + self::_errorLog("getting defaults: ".$this->serveroutput->status, 1); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | return $this->serveroutput->status; |
225 | 225 | } |
226 | 226 | else |
227 | 227 | { |
228 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
229 | - self::_errorLog("getting defaults : OPERATION FAILED",1); |
|
228 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
229 | + self::_errorLog("getting defaults : OPERATION FAILED", 1); |
|
230 | 230 | } |
231 | 231 | return false; |
232 | 232 | } |
233 | 233 | |
234 | 234 | |
235 | - public function cupsRejectJobs($printer_uri,$printer_state_message) |
|
235 | + public function cupsRejectJobs($printer_uri, $printer_state_message) |
|
236 | 236 | { |
237 | 237 | //The CUPS-Get-Default operation returns the default printer URI and attributes |
238 | 238 | |
239 | - $this->jobs = array_merge($this->jobs,array("")); |
|
240 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
239 | + $this->jobs = array_merge($this->jobs, array("")); |
|
240 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
241 | 241 | $this->parsed = array(); |
242 | 242 | unset($this->attributes); |
243 | 243 | |
@@ -264,8 +264,8 @@ discard block |
||
264 | 264 | . $printer_state_message; |
265 | 265 | } |
266 | 266 | |
267 | - $this->stringjob = chr(0x01) . chr(0x01) // IPP version 1.1 |
|
268 | - . chr(0x40). chr(0x09) // operation: cups vendor extension: Reject-Jobs |
|
267 | + $this->stringjob = chr(0x01).chr(0x01) // IPP version 1.1 |
|
268 | + . chr(0x40).chr(0x09) // operation: cups vendor extension: Reject-Jobs |
|
269 | 269 | . $this->meta->operation_id // request-id |
270 | 270 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
271 | 271 | . $this->meta->charset |
@@ -282,13 +282,13 @@ discard block |
||
282 | 282 | |
283 | 283 | self::_putDebug("Request: ".$this->output); |
284 | 284 | |
285 | - $post_values = array( "Content-Type" => "application/ipp", |
|
285 | + $post_values = array("Content-Type" => "application/ipp", |
|
286 | 286 | "Data" => $this->output); |
287 | 287 | |
288 | - if (self::_sendHttp ($post_values,'/admin/')) |
|
288 | + if (self::_sendHttp($post_values, '/admin/')) |
|
289 | 289 | { |
290 | 290 | |
291 | - if(self::_parseServerOutput()) |
|
291 | + if (self::_parseServerOutput()) |
|
292 | 292 | { |
293 | 293 | self::_parseAttributes(); |
294 | 294 | } |
@@ -297,36 +297,36 @@ discard block |
||
297 | 297 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
298 | 298 | { |
299 | 299 | |
300 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
300 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
301 | 301 | if ($this->serveroutput->status == "successfull-ok") |
302 | 302 | { |
303 | - self::_errorLog("getting defaults: ".$this->serveroutput->status,3); |
|
303 | + self::_errorLog("getting defaults: ".$this->serveroutput->status, 3); |
|
304 | 304 | } |
305 | 305 | else |
306 | 306 | { |
307 | - self::_errorLog("getting defaults: ".$this->serveroutput->status,1); |
|
307 | + self::_errorLog("getting defaults: ".$this->serveroutput->status, 1); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | return $this->serveroutput->status; |
311 | 311 | } |
312 | 312 | else |
313 | 313 | { |
314 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
315 | - self::_errorLog("getting defaults : OPERATION FAILED",1); |
|
314 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
315 | + self::_errorLog("getting defaults : OPERATION FAILED", 1); |
|
316 | 316 | } |
317 | 317 | return false; |
318 | 318 | } |
319 | 319 | |
320 | 320 | |
321 | - public function getPrinters($printer_location=false,$printer_info=false,$attributes=array()) |
|
321 | + public function getPrinters($printer_location = false, $printer_info = false, $attributes = array()) |
|
322 | 322 | { |
323 | 323 | if (count($attributes) == 0) |
324 | 324 | { |
325 | 325 | true; |
326 | 326 | } |
327 | - $attributes=array('printer-uri-supported', 'printer-location', 'printer-info', 'printer-type', 'color-supported', 'printer-name'); |
|
328 | - $this->jobs = array_merge($this->jobs,array("")); |
|
329 | - $this->jobs_uri = array_merge($this->jobs_uri,array("")); |
|
327 | + $attributes = array('printer-uri-supported', 'printer-location', 'printer-info', 'printer-type', 'color-supported', 'printer-name'); |
|
328 | + $this->jobs = array_merge($this->jobs, array("")); |
|
329 | + $this->jobs_uri = array_merge($this->jobs_uri, array("")); |
|
330 | 330 | |
331 | 331 | unset ($this->printers_attributes); |
332 | 332 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | |
343 | 343 | self::_setOperationId(); |
344 | 344 | |
345 | - $this->meta->attributes=''; |
|
345 | + $this->meta->attributes = ''; |
|
346 | 346 | |
347 | 347 | if ($printer_location) |
348 | 348 | { |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | . $printer_info; |
363 | 363 | } |
364 | 364 | |
365 | - for($i = 0 ; $i < count($attributes) ; $i++) |
|
365 | + for ($i = 0; $i < count($attributes); $i++) |
|
366 | 366 | { |
367 | 367 | if ($i == 0) |
368 | 368 | { |
@@ -381,8 +381,8 @@ discard block |
||
381 | 381 | } |
382 | 382 | } |
383 | 383 | |
384 | - $this->stringjob = chr(0x01) . chr(0x01) // IPP version 1.1 |
|
385 | - . chr(0x40). chr(0x02) // operation: cups vendor extension: get printers |
|
384 | + $this->stringjob = chr(0x01).chr(0x01) // IPP version 1.1 |
|
385 | + . chr(0x40).chr(0x02) // operation: cups vendor extension: get printers |
|
386 | 386 | . $this->meta->operation_id // request-id |
387 | 387 | . chr(0x01) // start operation-attributes | operation-attributes-tag |
388 | 388 | . $this->meta->charset |
@@ -392,13 +392,13 @@ discard block |
||
392 | 392 | |
393 | 393 | $this->output = $this->stringjob; |
394 | 394 | |
395 | - $post_values = array( "Content-Type" => "application/ipp", |
|
395 | + $post_values = array("Content-Type" => "application/ipp", |
|
396 | 396 | "Data" => $this->output); |
397 | 397 | |
398 | - if (self::_sendHttp ($post_values,'/')) |
|
398 | + if (self::_sendHttp($post_values, '/')) |
|
399 | 399 | { |
400 | 400 | |
401 | - if(self::_parseServerOutput()) |
|
401 | + if (self::_parseServerOutput()) |
|
402 | 402 | { |
403 | 403 | $this->_getAvailablePrinters(); |
404 | 404 | } |
@@ -407,27 +407,27 @@ discard block |
||
407 | 407 | if (isset($this->serveroutput) && isset($this->serveroutput->status)) |
408 | 408 | { |
409 | 409 | |
410 | - $this->status = array_merge($this->status,array($this->serveroutput->status)); |
|
410 | + $this->status = array_merge($this->status, array($this->serveroutput->status)); |
|
411 | 411 | if ($this->serveroutput->status == "successfull-ok") |
412 | 412 | { |
413 | - self::_errorLog("getting printers: ".$this->serveroutput->status,3); |
|
413 | + self::_errorLog("getting printers: ".$this->serveroutput->status, 3); |
|
414 | 414 | } |
415 | 415 | else |
416 | 416 | { |
417 | - self::_errorLog("getting printers: ".$this->serveroutput->status,1); |
|
417 | + self::_errorLog("getting printers: ".$this->serveroutput->status, 1); |
|
418 | 418 | } |
419 | 419 | return $this->serveroutput->status; |
420 | 420 | } |
421 | 421 | else |
422 | 422 | { |
423 | - $this->status = array_merge($this->status,array("OPERATION FAILED")); |
|
424 | - self::_errorLog("getting printers : OPERATION FAILED",1); |
|
423 | + $this->status = array_merge($this->status, array("OPERATION FAILED")); |
|
424 | + self::_errorLog("getting printers : OPERATION FAILED", 1); |
|
425 | 425 | } |
426 | 426 | return false; |
427 | 427 | } |
428 | 428 | |
429 | 429 | |
430 | - public function cupsGetPrinters () |
|
430 | + public function cupsGetPrinters() |
|
431 | 431 | { |
432 | 432 | // alias for getPrinters(); |
433 | 433 | self::getPrinters(); |
@@ -438,11 +438,11 @@ discard block |
||
438 | 438 | { |
439 | 439 | // complete informations from parent with Cups-specific stuff |
440 | 440 | |
441 | - if(!$result = parent::getPrinterAttributes()) |
|
441 | + if (!$result = parent::getPrinterAttributes()) |
|
442 | 442 | { |
443 | 443 | return FALSE; |
444 | 444 | } |
445 | - if(!isset($this->printer_attributes)) |
|
445 | + if (!isset($this->printer_attributes)) |
|
446 | 446 | { |
447 | 447 | return FALSE; |
448 | 448 | } |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | $printer_type = $this->printer_attributes->printer_type->_value0; |
453 | 453 | $table = self::_interpretPrinterType($printer_type); |
454 | 454 | |
455 | - for($i = 0 ; $i < count($table) ; $i++ ) |
|
455 | + for ($i = 0; $i < count($table); $i++) |
|
456 | 456 | { |
457 | 457 | $index = '_value'.$i; |
458 | 458 | $this->printer_attributes->printer_type->$index = $table[$i]; |
@@ -465,14 +465,14 @@ discard block |
||
465 | 465 | // |
466 | 466 | // SETUP |
467 | 467 | // |
468 | - protected function _initTags () |
|
468 | + protected function _initTags() |
|
469 | 469 | { |
470 | 470 | // override parent with specific cups attributes |
471 | 471 | |
472 | - $operation_tags = array (); |
|
473 | - $this->operation_tags = array_merge ($this->operation_tags, $operation_tags); |
|
472 | + $operation_tags = array(); |
|
473 | + $this->operation_tags = array_merge($this->operation_tags, $operation_tags); |
|
474 | 474 | |
475 | - $job_tags = array ( "job-billing" => array("tag" => "textWithoutLanguage"), |
|
475 | + $job_tags = array("job-billing" => array("tag" => "textWithoutLanguage"), |
|
476 | 476 | "blackplot" => array("tag" => "boolean"), |
477 | 477 | "brightness" => array("tag" => "integer"), |
478 | 478 | "columns" => array("tag" => "integer"), |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | "gamma" => array("tag" => "integer"), |
482 | 482 | "hue" => array("tag" => "integer"), |
483 | 483 | "lpi" => array("tag" => "enum"), |
484 | - "mirror" => array("tag","boolean"), |
|
484 | + "mirror" => array("tag", "boolean"), |
|
485 | 485 | "natural-scaling" => array("tag" => "integer"), |
486 | 486 | "number-up-layout" => array("tag" => "keyword"), |
487 | 487 | "page-border" => array("tag" => "keyword"), |
@@ -494,21 +494,21 @@ discard block |
||
494 | 494 | "penwidth" => array("tag" => "integer"), |
495 | 495 | "position" => array("tag" => "keyword"), |
496 | 496 | "ppi" => array("tag" => "integer"), |
497 | - "prettyprint" => array("tag","boolean"), |
|
497 | + "prettyprint" => array("tag", "boolean"), |
|
498 | 498 | "saturation" => array("tag" => "integer"), |
499 | 499 | "scaling" => array("tag" => "integer"), |
500 | - "wrap" => array("tag","boolean"), |
|
500 | + "wrap" => array("tag", "boolean"), |
|
501 | 501 | |
502 | 502 | ); |
503 | - $this->job_tags = array_merge ($this->job_tags, $job_tags); |
|
503 | + $this->job_tags = array_merge($this->job_tags, $job_tags); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | // |
507 | 507 | // REQUEST BUILDING |
508 | 508 | // |
509 | - protected function _enumBuild ($tag,$value) |
|
509 | + protected function _enumBuild($tag, $value) |
|
510 | 510 | { |
511 | - $value_built = parent::_enumBuild($tag,$value); |
|
511 | + $value_built = parent::_enumBuild($tag, $value); |
|
512 | 512 | |
513 | 513 | switch ($tag) |
514 | 514 | { |
@@ -552,35 +552,35 @@ discard block |
||
552 | 552 | // |
553 | 553 | // RESPONSE PARSING |
554 | 554 | // |
555 | - private function _getAvailablePrinters () |
|
555 | + private function _getAvailablePrinters() |
|
556 | 556 | { |
557 | 557 | $this->available_printers = array(); |
558 | 558 | $this->printer_map = array(); |
559 | 559 | $k = 0; |
560 | 560 | $this->printers_attributes = new \stdClass(); |
561 | 561 | |
562 | - for ($i = 0 ; (array_key_exists($i,$this->serveroutput->response)) ; $i ++) |
|
562 | + for ($i = 0; (array_key_exists($i, $this->serveroutput->response)); $i++) |
|
563 | 563 | { |
564 | 564 | if (($this->serveroutput->response[$i]['attributes']) == "printer-attributes") |
565 | 565 | { |
566 | 566 | $phpname = "_printer".$k; |
567 | 567 | $this->printers_attributes->$phpname = new \stdClass(); |
568 | - for ($j = 0 ; array_key_exists($j,$this->serveroutput->response[$i]) ; $j++) |
|
568 | + for ($j = 0; array_key_exists($j, $this->serveroutput->response[$i]); $j++) |
|
569 | 569 | { |
570 | 570 | |
571 | 571 | $value = $this->serveroutput->response[$i][$j]['value']; |
572 | - $name = str_replace("-","_",$this->serveroutput->response[$i][$j]['name']); |
|
572 | + $name = str_replace("-", "_", $this->serveroutput->response[$i][$j]['name']); |
|
573 | 573 | |
574 | 574 | switch ($name) |
575 | 575 | { |
576 | 576 | case "printer_uri_supported": |
577 | - $this->available_printers = array_merge($this->available_printers,array($value)); |
|
577 | + $this->available_printers = array_merge($this->available_printers, array($value)); |
|
578 | 578 | break; |
579 | 579 | case "printer_type": |
580 | 580 | $table = self::_interpretPrinterType($value); |
581 | 581 | $this->printers_attributes->$phpname->$name = new \stdClass(); |
582 | 582 | |
583 | - for($l = 0 ; $l < count($table) ; $l++ ) |
|
583 | + for ($l = 0; $l < count($table); $l++) |
|
584 | 584 | { |
585 | 585 | $index = '_value'.$l; |
586 | 586 | $this->printers_attributes->$phpname->$name->$index = $table[$l]; |
@@ -597,12 +597,12 @@ discard block |
||
597 | 597 | break; |
598 | 598 | } |
599 | 599 | } |
600 | - $k ++; |
|
600 | + $k++; |
|
601 | 601 | } |
602 | 602 | } |
603 | 603 | } |
604 | 604 | |
605 | - protected function _getEnumVendorExtensions ($value_parsed) |
|
605 | + protected function _getEnumVendorExtensions($value_parsed) |
|
606 | 606 | { |
607 | 607 | switch ($value_parsed) |
608 | 608 | { |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | $value = 'Get-Availables-Printers'; |
611 | 611 | break; |
612 | 612 | default: |
613 | - $value = sprintf('Unknown(Cups extension for operations): 0x%x',$value_parsed); |
|
613 | + $value = sprintf('Unknown(Cups extension for operations): 0x%x', $value_parsed); |
|
614 | 614 | break; |
615 | 615 | } |
616 | 616 | |
@@ -619,16 +619,16 @@ discard block |
||
619 | 619 | return ($value); |
620 | 620 | } |
621 | 621 | |
622 | - return sprintf('Unknown: 0x%x',$value_parsed); |
|
622 | + return sprintf('Unknown: 0x%x', $value_parsed); |
|
623 | 623 | } |
624 | 624 | |
625 | 625 | |
626 | 626 | private function _interpretPrinterType($value) |
627 | 627 | { |
628 | 628 | $value_parsed = 0; |
629 | - for ($i = strlen($value) ; $i > 0 ; $i --) |
|
629 | + for ($i = strlen($value); $i > 0; $i--) |
|
630 | 630 | { |
631 | - $value_parsed += pow(256,($i - 1)) * ord($value[strlen($value) - $i]); |
|
631 | + $value_parsed += pow(256, ($i - 1)) * ord($value[strlen($value) - $i]); |
|
632 | 632 | } |
633 | 633 | |
634 | 634 | $type[0] = $type[1] = $type[2] = $type[3] = $type[4] = $type[5] = ''; |
@@ -636,115 +636,115 @@ discard block |
||
636 | 636 | $type[11] = $type[12] = $type[13] = $type[14] = $type[15] = ''; |
637 | 637 | $type[16] = $type[17] = $type[18] = $type[19] = ''; |
638 | 638 | |
639 | - if ($value_parsed %2 == 1) |
|
639 | + if ($value_parsed % 2 == 1) |
|
640 | 640 | { |
641 | 641 | $type[0] = 'printer-class'; |
642 | 642 | $value_parsed -= 1; |
643 | 643 | } |
644 | 644 | |
645 | - if ($value_parsed %4 == 2 ) |
|
645 | + if ($value_parsed % 4 == 2) |
|
646 | 646 | { |
647 | 647 | $type[1] = 'remote-destination'; |
648 | 648 | $value_parsed -= 2; |
649 | 649 | } |
650 | 650 | |
651 | - if ($value_parsed %8 == 4 ) |
|
651 | + if ($value_parsed % 8 == 4) |
|
652 | 652 | { |
653 | 653 | $type[2] = 'print-black'; |
654 | 654 | $value_parsed -= 4; |
655 | 655 | } |
656 | 656 | |
657 | - if ($value_parsed %16 == 8 ) |
|
657 | + if ($value_parsed % 16 == 8) |
|
658 | 658 | { |
659 | 659 | $type[3] = 'print-color'; |
660 | 660 | $value_parsed -= 8; |
661 | 661 | } |
662 | 662 | |
663 | - if ($value_parsed %32 == 16) |
|
663 | + if ($value_parsed % 32 == 16) |
|
664 | 664 | { |
665 | 665 | $type[4] = 'hardware-print-on-both-sides'; |
666 | 666 | $value_parsed -= 16; |
667 | 667 | } |
668 | 668 | |
669 | - if ($value_parsed %64 == 32) |
|
669 | + if ($value_parsed % 64 == 32) |
|
670 | 670 | { |
671 | 671 | $type[5] = 'hardware-staple-output'; |
672 | 672 | $value_parsed -= 32; |
673 | 673 | } |
674 | 674 | |
675 | - if ($value_parsed %128 == 64) |
|
675 | + if ($value_parsed % 128 == 64) |
|
676 | 676 | { |
677 | 677 | $type[6] = 'hardware-fast-copies'; |
678 | 678 | $value_parsed -= 64; |
679 | 679 | } |
680 | 680 | |
681 | - if ($value_parsed %256 == 128) |
|
681 | + if ($value_parsed % 256 == 128) |
|
682 | 682 | { |
683 | 683 | $type[7] = 'hardware-fast-copy-collation'; |
684 | 684 | $value_parsed -= 128; |
685 | 685 | } |
686 | 686 | |
687 | - if ($value_parsed %512 == 256) |
|
687 | + if ($value_parsed % 512 == 256) |
|
688 | 688 | { |
689 | 689 | $type[8] = 'punch-output'; |
690 | 690 | $value_parsed -= 256; |
691 | 691 | } |
692 | 692 | |
693 | - if ($value_parsed %1024 == 512) |
|
693 | + if ($value_parsed % 1024 == 512) |
|
694 | 694 | { |
695 | 695 | $type[9] = 'cover-output'; |
696 | 696 | $value_parsed -= 512; |
697 | 697 | } |
698 | 698 | |
699 | - if ($value_parsed %2048 == 1024) |
|
699 | + if ($value_parsed % 2048 == 1024) |
|
700 | 700 | { |
701 | 701 | $type[10] = 'bind-output'; |
702 | 702 | $value_parsed -= 1024; |
703 | 703 | } |
704 | 704 | |
705 | - if ($value_parsed %4096 == 2048) |
|
705 | + if ($value_parsed % 4096 == 2048) |
|
706 | 706 | { |
707 | 707 | $type[11] = 'sort-output'; |
708 | 708 | $value_parsed -= 2048; |
709 | 709 | } |
710 | 710 | |
711 | - if ($value_parsed %8192 == 4096) |
|
711 | + if ($value_parsed % 8192 == 4096) |
|
712 | 712 | { |
713 | 713 | $type[12] = 'handle-media-up-to-US-Legal-A4'; |
714 | 714 | $value_parsed -= 4096; |
715 | 715 | } |
716 | 716 | |
717 | - if ($value_parsed %16384 == 8192) |
|
717 | + if ($value_parsed % 16384 == 8192) |
|
718 | 718 | { |
719 | 719 | $type[13] = 'handle-media-between-US-Legal-A4-and-ISO_C-A2'; |
720 | 720 | $value_parsed -= 8192; |
721 | 721 | } |
722 | 722 | |
723 | - if ($value_parsed %32768 == 16384) |
|
723 | + if ($value_parsed % 32768 == 16384) |
|
724 | 724 | { |
725 | 725 | $type[14] = 'handle-media-larger-than-ISO_C-A2'; |
726 | 726 | $value_parsed -= 16384; |
727 | 727 | } |
728 | 728 | |
729 | - if ($value_parsed %65536 == 32768) |
|
729 | + if ($value_parsed % 65536 == 32768) |
|
730 | 730 | { |
731 | 731 | $type[15] = 'handle-user-defined-media-sizes'; |
732 | 732 | $value_parsed -= 32768; |
733 | 733 | } |
734 | 734 | |
735 | - if ($value_parsed %131072 == 65536) |
|
735 | + if ($value_parsed % 131072 == 65536) |
|
736 | 736 | { |
737 | 737 | $type[16] = 'implicit-server-generated-class'; |
738 | 738 | $value_parsed -= 65536; |
739 | 739 | } |
740 | 740 | |
741 | - if ($value_parsed %262144 == 131072) |
|
741 | + if ($value_parsed % 262144 == 131072) |
|
742 | 742 | { |
743 | 743 | $type[17] = 'network-default-printer'; |
744 | 744 | $value_parsed -= 131072; |
745 | 745 | } |
746 | 746 | |
747 | - if ($value_parsed %524288 == 262144) |
|
747 | + if ($value_parsed % 524288 == 262144) |
|
748 | 748 | { |
749 | 749 | $type[18] = 'fax-device'; |
750 | 750 | $value_parsed -= 262144; |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | } |
755 | 755 | |
756 | 756 | |
757 | - protected function _interpretEnum($attribute_name,$value) |
|
757 | + protected function _interpretEnum($attribute_name, $value) |
|
758 | 758 | { |
759 | 759 | $value_parsed = self::_interpretInteger($value); |
760 | 760 | |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | $value = $value_parsed; |
766 | 766 | break; |
767 | 767 | default: |
768 | - $value = parent::_interpretEnum($attribute_name,$value); |
|
768 | + $value = parent::_interpretEnum($attribute_name, $value); |
|
769 | 769 | break; |
770 | 770 | } |
771 | 771 |