@@ -6508,15 +6508,13 @@ discard block |
||
6508 | 6508 | $xml .= $this->serializeType ($eName, |
6509 | 6509 | isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], |
6510 | 6510 | $v, $use, $encodingStyle, $unqualified); |
6511 | - } |
|
6512 | - elseif (isset($attrs['type']) || isset($attrs['ref'])) |
|
6511 | + } elseif (isset($attrs['type']) || isset($attrs['ref'])) |
|
6513 | 6512 | { |
6514 | 6513 | // serialize schema-defined type |
6515 | 6514 | $xml .= $this->serializeType ($eName, |
6516 | 6515 | isset($attrs['type']) ? $attrs['type'] : $attrs['ref'], |
6517 | 6516 | $v, $use, $encodingStyle, $unqualified); |
6518 | - } |
|
6519 | - else |
|
6517 | + } else |
|
6520 | 6518 | { |
6521 | 6519 | // serialize generic type (can this ever really happen?) |
6522 | 6520 | $this->debug ("calling serialize_val() for $v, $eName, false, false, false, false, $use"); |
@@ -7018,8 +7016,7 @@ discard block |
||
7018 | 7016 | if (isset($this->namespaces[$value_prefix])) |
7019 | 7017 | { |
7020 | 7018 | $this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix]; |
7021 | - } |
|
7022 | - elseif (isset($attrs['xmlns:' . $value_prefix])) |
|
7019 | + } elseif (isset($attrs['xmlns:' . $value_prefix])) |
|
7023 | 7020 | { |
7024 | 7021 | $this->message[$pos]['type_namespace'] = $attrs['xmlns:' . $value_prefix]; |
7025 | 7022 | } |
@@ -243,10 +243,11 @@ |
||
243 | 243 | $this->assertEquals($result, 2); |
244 | 244 | |
245 | 245 | |
246 | - foreach ($localobject->html_images as $i => $val) |
|
247 | - if ($localobject->html_images[$i]) { |
|
246 | + foreach ($localobject->html_images as $i => $val) { |
|
247 | + if ($localobject->html_images[$i]) { |
|
248 | 248 | if (preg_match('/img250x20\.png/i', $localobject->html_images[$i]['fullpath'])) { |
249 | 249 | print __METHOD__ . " content type must be image png =" . $localobject->html_images[$i]['content_type'] . "\n"; |
250 | + } |
|
250 | 251 | $this->assertEquals($localobject->html_images[$i]['content_type'], 'image/png'); |
251 | 252 | |
252 | 253 | print __METHOD__ . " type must be cidfromurl =" . $localobject->html_images[$i]['type'] . "\n"; |
@@ -52,9 +52,11 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public static function addPath($path) |
54 | 54 | { |
55 | - if (false === $path = stream_resolve_include_path($path)) |
|
56 | - return false; |
|
57 | - else set_include_path($path.PATH_SEPARATOR.get_include_path()); |
|
55 | + if (false === $path = stream_resolve_include_path($path)) { |
|
56 | + return false; |
|
57 | + } else { |
|
58 | + set_include_path($path.PATH_SEPARATOR.get_include_path()); |
|
59 | + } |
|
58 | 60 | return $path; |
59 | 61 | } |
60 | 62 | |
@@ -67,16 +69,19 @@ discard block |
||
67 | 69 | */ |
68 | 70 | public static function thereCanBeOnlyOne() |
69 | 71 | { |
70 | - if (static::$perfectLoaders === spl_autoload_functions()) |
|
71 | - return static::$instance; |
|
72 | + if (static::$perfectLoaders === spl_autoload_functions()) { |
|
73 | + return static::$instance; |
|
74 | + } |
|
72 | 75 | |
73 | - if (false !== $loaders = spl_autoload_functions()) |
|
74 | - if (0 < $count = count($loaders)) |
|
76 | + if (false !== $loaders = spl_autoload_functions()) { |
|
77 | + if (0 < $count = count($loaders)) |
|
75 | 78 | for ($i = 0, static::$rogueLoaders += $loaders; |
79 | + } |
|
76 | 80 | $i < $count && false != ($loader = $loaders[$i]); |
77 | - $i++) |
|
78 | - if ($loader !== static::$perfectLoaders[0]) |
|
81 | + $i++) { |
|
82 | + if ($loader !== static::$perfectLoaders[0]) |
|
79 | 83 | spl_autoload_unregister($loader); |
84 | + } |
|
80 | 85 | |
81 | 86 | return static::$instance; |
82 | 87 | } |
@@ -105,12 +110,14 @@ discard block |
||
105 | 110 | return false; |
106 | 111 | } |
107 | 112 | |
108 | - if (empty(static::$classMap[$key])) |
|
109 | - static::$classMap[$key] = $value; |
|
113 | + if (empty(static::$classMap[$key])) { |
|
114 | + static::$classMap[$key] = $value; |
|
115 | + } |
|
110 | 116 | |
111 | - if (is_string($alias = static::$classMap[$key])) |
|
112 | - if (isset(static::$classMap[$alias])) |
|
117 | + if (is_string($alias = static::$classMap[$key])) { |
|
118 | + if (isset(static::$classMap[$alias])) |
|
113 | 119 | return static::$classMap[$alias]; |
120 | + } |
|
114 | 121 | |
115 | 122 | return static::$classMap[$key]; |
116 | 123 | } |
@@ -138,8 +145,8 @@ discard block |
||
138 | 145 | array($dir, 'vendor', 'composer'), |
139 | 146 | array($dir, '..', '..', '..', 'php'), |
140 | 147 | array($dir, 'vendor', 'php')) |
141 | - as $includePath) |
|
142 | - if (false !== $path = stream_resolve_include_path( |
|
148 | + as $includePath) { |
|
149 | + if (false !== $path = stream_resolve_include_path( |
|
143 | 150 | implode($slash, $includePath) |
144 | 151 | )) |
145 | 152 | if ('composer' == end($includePath) && |
@@ -150,18 +157,22 @@ discard block |
||
150 | 157 | static::seen(static::loadFile( |
151 | 158 | $classmapPath |
152 | 159 | )); |
160 | + } |
|
153 | 161 | $paths = array_merge( |
154 | 162 | $paths, |
155 | 163 | array_values(static::loadFile( |
156 | 164 | "$path{$slash}autoload_namespaces.php" |
157 | 165 | )) |
158 | 166 | ); |
159 | - } else $paths[] = $path; |
|
167 | + } else { |
|
168 | + $paths[] = $path; |
|
169 | + } |
|
160 | 170 | |
161 | 171 | $paths = array_filter(array_map( |
162 | 172 | function ($path) { |
163 | - if (false == $realPath = @realpath($path)) |
|
164 | - return null; |
|
173 | + if (false == $realPath = @realpath($path)) { |
|
174 | + return null; |
|
175 | + } |
|
165 | 176 | return $realPath . DIRECTORY_SEPARATOR; |
166 | 177 | }, |
167 | 178 | $paths |
@@ -200,9 +211,11 @@ discard block |
||
200 | 211 | private function loadPrefixes($className) |
201 | 212 | { |
202 | 213 | $currentClass = $className; |
203 | - if (false !== $pos = strrpos($className, '\\')) |
|
204 | - $className = substr($className, $pos); |
|
205 | - else $className = "\\$className"; |
|
214 | + if (false !== $pos = strrpos($className, '\\')) { |
|
215 | + $className = substr($className, $pos); |
|
216 | + } else { |
|
217 | + $className = "\\$className"; |
|
218 | + } |
|
206 | 219 | |
207 | 220 | for ( |
208 | 221 | $i = 0, |
@@ -231,12 +244,13 @@ discard block |
||
231 | 244 | private function loadAliases($className) |
232 | 245 | { |
233 | 246 | $file = false; |
234 | - if (preg_match('/(.+)(\\\\\w+$)/U', $className, $parts)) |
|
235 | - for ( |
|
247 | + if (preg_match('/(.+)(\\\\\w+$)/U', $className, $parts)) { |
|
248 | + for ( |
|
236 | 249 | $i = 0, |
237 | 250 | $aliases = isset(static::$aliases[$parts[1]]) |
238 | 251 | ? static::$aliases[$parts[1]] : array(), |
239 | 252 | $count = count($aliases); |
253 | + } |
|
240 | 254 | $i < $count && false === $file; |
241 | 255 | $file = $this->discover( |
242 | 256 | "{$aliases[$i++]}$parts[2]", |
@@ -263,13 +277,15 @@ discard block |
||
263 | 277 | { |
264 | 278 | $loaders = array_unique(static::$rogueLoaders, SORT_REGULAR); |
265 | 279 | if (isset($loader)) { |
266 | - if (false === array_search($loader, $loaders)) |
|
267 | - static::$rogueLoaders[] = $loader; |
|
280 | + if (false === array_search($loader, $loaders)) { |
|
281 | + static::$rogueLoaders[] = $loader; |
|
282 | + } |
|
268 | 283 | return $this->loadThisLoader($className, $loader); |
269 | 284 | } |
270 | - foreach ($loaders as $loader) |
|
271 | - if (false !== $file = $this->loadThisLoader($className, $loader)) |
|
285 | + foreach ($loaders as $loader) { |
|
286 | + if (false !== $file = $this->loadThisLoader($className, $loader)) |
|
272 | 287 | return $file; |
288 | + } |
|
273 | 289 | |
274 | 290 | return false; |
275 | 291 | } |
@@ -313,13 +329,18 @@ discard block |
||
313 | 329 | */ |
314 | 330 | private function alias($className, $currentClass) |
315 | 331 | { |
316 | - if ($className == 'Luracast\Restler\string') return; |
|
317 | - if ($className == 'Luracast\Restler\mixed') return; |
|
332 | + if ($className == 'Luracast\Restler\string') { |
|
333 | + return; |
|
334 | + } |
|
335 | + if ($className == 'Luracast\Restler\mixed') { |
|
336 | + return; |
|
337 | + } |
|
318 | 338 | if ($className != $currentClass |
319 | - && false !== strpos($className, $currentClass)) |
|
320 | - if (!class_exists($currentClass, false) |
|
339 | + && false !== strpos($className, $currentClass)) { |
|
340 | + if (!class_exists($currentClass, false) |
|
321 | 341 | && class_alias($className, $currentClass)) |
322 | 342 | static::seen($currentClass, $className); |
343 | + } |
|
323 | 344 | } |
324 | 345 | |
325 | 346 | /** |
@@ -337,11 +358,12 @@ discard block |
||
337 | 358 | |
338 | 359 | /** The short version we've done this before and found it in cache */ |
339 | 360 | if (false !== $file = static::seen($className)) { |
340 | - if (!$this->exists($className)) |
|
341 | - if (is_callable($file)) |
|
361 | + if (!$this->exists($className)) { |
|
362 | + if (is_callable($file)) |
|
342 | 363 | $file = $this->loadLastResort($className, $file); |
343 | - elseif ($file = stream_resolve_include_path($file)) |
|
344 | - $file = static::loadFile($file); |
|
364 | + } elseif ($file = stream_resolve_include_path($file)) { |
|
365 | + $file = static::loadFile($file); |
|
366 | + } |
|
345 | 367 | |
346 | 368 | $this->alias($className, $currentClass); |
347 | 369 | return $file; |
@@ -351,15 +373,17 @@ discard block |
||
351 | 373 | |
352 | 374 | /** replace \ with / and _ in CLASS NAME with / = PSR-0 in 3 lines */ |
353 | 375 | $file = preg_replace("/\\\|_(?=\w+$)/", DIRECTORY_SEPARATOR, $className); |
354 | - if (false === $file = stream_resolve_include_path("$file.php")) |
|
355 | - return false; |
|
376 | + if (false === $file = stream_resolve_include_path("$file.php")) { |
|
377 | + return false; |
|
378 | + } |
|
356 | 379 | |
357 | 380 | /** have we loaded this file before could this be an alias */ |
358 | 381 | if (in_array($file, get_included_files())) { |
359 | - if (false !== $sameFile = array_search($file, static::$classMap)) |
|
360 | - if (!$this->exists($className, $file)) |
|
382 | + if (false !== $sameFile = array_search($file, static::$classMap)) { |
|
383 | + if (!$this->exists($className, $file)) |
|
361 | 384 | if (false !== strpos($sameFile, $className)) |
362 | 385 | $this->alias($sameFile, $className); |
386 | + } |
|
363 | 387 | |
364 | 388 | return $file; |
365 | 389 | } |
@@ -367,17 +391,19 @@ discard block |
||
367 | 391 | $state = array_merge(get_declared_classes(), get_declared_interfaces()); |
368 | 392 | |
369 | 393 | if (false !== $result = static::loadFile($file)) { |
370 | - if ($this->exists($className, $file)) |
|
371 | - $this->alias($className, $currentClass); |
|
372 | - elseif (false != $diff = array_diff( |
|
373 | - array_merge(get_declared_classes(), get_declared_interfaces()), $state)) |
|
374 | - foreach ($diff as $autoLoaded) |
|
394 | + if ($this->exists($className, $file)) { |
|
395 | + $this->alias($className, $currentClass); |
|
396 | + } elseif (false != $diff = array_diff( |
|
397 | + array_merge(get_declared_classes(), get_declared_interfaces()), $state)) { |
|
398 | + foreach ($diff as $autoLoaded) |
|
375 | 399 | if ($this->exists($autoLoaded, $file)) |
376 | 400 | if (false !== strpos($autoLoaded, $className)) |
377 | 401 | $this->alias($autoLoaded, $className); |
402 | + } |
|
378 | 403 | |
379 | - if (!$this->exists($currentClass)) |
|
380 | - $result = false; |
|
404 | + if (!$this->exists($currentClass)) { |
|
405 | + $result = false; |
|
406 | + } |
|
381 | 407 | } |
382 | 408 | |
383 | 409 | return $result; |
@@ -395,10 +421,12 @@ discard block |
||
395 | 421 | private function exists($className, $mapping = null) |
396 | 422 | { |
397 | 423 | if (class_exists($className, false) |
398 | - || interface_exists($className, false)) |
|
399 | - if (isset($mapping)) |
|
424 | + || interface_exists($className, false)) { |
|
425 | + if (isset($mapping)) |
|
400 | 426 | return static::seen($className, $mapping); |
401 | - else return true; |
|
427 | + } else { |
|
428 | + return true; |
|
429 | + } |
|
402 | 430 | return false; |
403 | 431 | } |
404 | 432 | |
@@ -411,22 +439,27 @@ discard block |
||
411 | 439 | */ |
412 | 440 | public function __invoke($className) |
413 | 441 | { |
414 | - if (empty($className)) |
|
415 | - return false; |
|
442 | + if (empty($className)) { |
|
443 | + return false; |
|
444 | + } |
|
416 | 445 | |
417 | - if (false !== $includeReference = $this->discover($className)) |
|
418 | - return $includeReference; |
|
446 | + if (false !== $includeReference = $this->discover($className)) { |
|
447 | + return $includeReference; |
|
448 | + } |
|
419 | 449 | |
420 | 450 | static::thereCanBeOnlyOne(); |
421 | 451 | |
422 | - if (false !== $includeReference = $this->loadAliases($className)) |
|
423 | - return $includeReference; |
|
452 | + if (false !== $includeReference = $this->loadAliases($className)) { |
|
453 | + return $includeReference; |
|
454 | + } |
|
424 | 455 | |
425 | - if (false !== $includeReference = $this->loadPrefixes($className)) |
|
426 | - return $includeReference; |
|
456 | + if (false !== $includeReference = $this->loadPrefixes($className)) { |
|
457 | + return $includeReference; |
|
458 | + } |
|
427 | 459 | |
428 | - if (false !== $includeReference = $this->loadLastResort($className)) |
|
429 | - return $includeReference; |
|
460 | + if (false !== $includeReference = $this->loadLastResort($className)) { |
|
461 | + return $includeReference; |
|
462 | + } |
|
430 | 463 | |
431 | 464 | static::seen($className, true); |
432 | 465 | return null; |
@@ -327,10 +327,16 @@ |
||
327 | 327 | } |
328 | 328 | } |
329 | 329 | |
330 | - if (empty($idorcode)) $idorcode = 'all'; |
|
330 | + if (empty($idorcode)) { |
|
331 | + $idorcode = 'all'; |
|
332 | + } |
|
331 | 333 | $TType = $TSystem[$idorcode]; |
332 | - if (! empty($TSystemAuto[$idorcode])) $TType = array_merge($TSystem[$idorcode], $TSystemAuto[$idorcode]); |
|
333 | - if (! empty($TModule[$idorcode])) $TType = array_merge($TSystem[$idorcode], $TModule[$idorcode]); |
|
334 | + if (! empty($TSystemAuto[$idorcode])) { |
|
335 | + $TType = array_merge($TSystem[$idorcode], $TSystemAuto[$idorcode]); |
|
336 | + } |
|
337 | + if (! empty($TModule[$idorcode])) { |
|
338 | + $TType = array_merge($TSystem[$idorcode], $TModule[$idorcode]); |
|
339 | + } |
|
334 | 340 | $this->liste_array = $TType; |
335 | 341 | |
336 | 342 |