@@ -9,7 +9,7 @@ |
||
| 9 | 9 | |
| 10 | 10 | |
| 11 | 11 | // Create services and inject into the app. |
| 12 | -$di = new \Anax\DI\CDIFactoryDefault(); |
|
| 12 | +$di = new \Anax\DI\CDIFactoryDefault(); |
|
| 13 | 13 | |
| 14 | 14 | $di->set('RssController', function() use ($di) {
|
| 15 | 15 | $controller = new \petlid\RSSReader\RSSReaderController("http://www.historytoday.com/feed/rss.xml");
|
@@ -341,6 +341,10 @@ |
||
| 341 | 341 | return $file; |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | + /** |
|
| 345 | + * @param string $class |
|
| 346 | + * @param string $ext |
|
| 347 | + */ |
|
| 344 | 348 | private function findFileWithExtension($class, $ext) |
| 345 | 349 | { |
| 346 | 350 | // PSR-4 lookup |
@@ -123,20 +123,20 @@ discard block |
||
| 123 | 123 | return; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - $first = $prefix[0]; |
|
| 127 | - if (!isset($this->prefixesPsr0[$first][$prefix])) { |
|
| 128 | - $this->prefixesPsr0[$first][$prefix] = (array) $paths; |
|
| 126 | + $first = $prefix[ 0 ]; |
|
| 127 | + if (!isset($this->prefixesPsr0[ $first ][ $prefix ])) { |
|
| 128 | + $this->prefixesPsr0[ $first ][ $prefix ] = (array) $paths; |
|
| 129 | 129 | |
| 130 | 130 | return; |
| 131 | 131 | } |
| 132 | 132 | if ($prepend) { |
| 133 | - $this->prefixesPsr0[$first][$prefix] = array_merge( |
|
| 133 | + $this->prefixesPsr0[ $first ][ $prefix ] = array_merge( |
|
| 134 | 134 | (array) $paths, |
| 135 | - $this->prefixesPsr0[$first][$prefix] |
|
| 135 | + $this->prefixesPsr0[ $first ][ $prefix ] |
|
| 136 | 136 | ); |
| 137 | 137 | } else { |
| 138 | - $this->prefixesPsr0[$first][$prefix] = array_merge( |
|
| 139 | - $this->prefixesPsr0[$first][$prefix], |
|
| 138 | + $this->prefixesPsr0[ $first ][ $prefix ] = array_merge( |
|
| 139 | + $this->prefixesPsr0[ $first ][ $prefix ], |
|
| 140 | 140 | (array) $paths |
| 141 | 141 | ); |
| 142 | 142 | } |
@@ -167,24 +167,24 @@ discard block |
||
| 167 | 167 | (array) $paths |
| 168 | 168 | ); |
| 169 | 169 | } |
| 170 | - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { |
|
| 170 | + } elseif (!isset($this->prefixDirsPsr4[ $prefix ])) { |
|
| 171 | 171 | // Register directories for a new namespace. |
| 172 | 172 | $length = strlen($prefix); |
| 173 | - if ('\\' !== $prefix[$length - 1]) { |
|
| 173 | + if ('\\' !== $prefix[ $length - 1 ]) { |
|
| 174 | 174 | throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); |
| 175 | 175 | } |
| 176 | - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; |
|
| 177 | - $this->prefixDirsPsr4[$prefix] = (array) $paths; |
|
| 176 | + $this->prefixLengthsPsr4[ $prefix[ 0 ] ][ $prefix ] = $length; |
|
| 177 | + $this->prefixDirsPsr4[ $prefix ] = (array) $paths; |
|
| 178 | 178 | } elseif ($prepend) { |
| 179 | 179 | // Prepend directories for an already registered namespace. |
| 180 | - $this->prefixDirsPsr4[$prefix] = array_merge( |
|
| 180 | + $this->prefixDirsPsr4[ $prefix ] = array_merge( |
|
| 181 | 181 | (array) $paths, |
| 182 | - $this->prefixDirsPsr4[$prefix] |
|
| 182 | + $this->prefixDirsPsr4[ $prefix ] |
|
| 183 | 183 | ); |
| 184 | 184 | } else { |
| 185 | 185 | // Append directories for an already registered namespace. |
| 186 | - $this->prefixDirsPsr4[$prefix] = array_merge( |
|
| 187 | - $this->prefixDirsPsr4[$prefix], |
|
| 186 | + $this->prefixDirsPsr4[ $prefix ] = array_merge( |
|
| 187 | + $this->prefixDirsPsr4[ $prefix ], |
|
| 188 | 188 | (array) $paths |
| 189 | 189 | ); |
| 190 | 190 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | if (!$prefix) { |
| 203 | 203 | $this->fallbackDirsPsr0 = (array) $paths; |
| 204 | 204 | } else { |
| 205 | - $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; |
|
| 205 | + $this->prefixesPsr0[ $prefix[ 0 ] ][ $prefix ] = (array) $paths; |
|
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | 208 | |
@@ -221,11 +221,11 @@ discard block |
||
| 221 | 221 | $this->fallbackDirsPsr4 = (array) $paths; |
| 222 | 222 | } else { |
| 223 | 223 | $length = strlen($prefix); |
| 224 | - if ('\\' !== $prefix[$length - 1]) { |
|
| 224 | + if ('\\' !== $prefix[ $length - 1 ]) { |
|
| 225 | 225 | throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); |
| 226 | 226 | } |
| 227 | - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; |
|
| 228 | - $this->prefixDirsPsr4[$prefix] = (array) $paths; |
|
| 227 | + $this->prefixLengthsPsr4[ $prefix[ 0 ] ][ $prefix ] = $length; |
|
| 228 | + $this->prefixDirsPsr4[ $prefix ] = (array) $paths; |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
@@ -314,13 +314,13 @@ discard block |
||
| 314 | 314 | public function findFile($class) |
| 315 | 315 | { |
| 316 | 316 | // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731 |
| 317 | - if ('\\' == $class[0]) { |
|
| 317 | + if ('\\' == $class[ 0 ]) { |
|
| 318 | 318 | $class = substr($class, 1); |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | // class map lookup |
| 322 | - if (isset($this->classMap[$class])) { |
|
| 323 | - return $this->classMap[$class]; |
|
| 322 | + if (isset($this->classMap[ $class ])) { |
|
| 323 | + return $this->classMap[ $class ]; |
|
| 324 | 324 | } |
| 325 | 325 | if ($this->classMapAuthoritative) { |
| 326 | 326 | return false; |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | if ($file === null) { |
| 337 | 337 | // Remember that this class does not exist. |
| 338 | - return $this->classMap[$class] = false; |
|
| 338 | + return $this->classMap[ $class ] = false; |
|
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | return $file; |
@@ -344,14 +344,14 @@ discard block |
||
| 344 | 344 | private function findFileWithExtension($class, $ext) |
| 345 | 345 | { |
| 346 | 346 | // PSR-4 lookup |
| 347 | - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
|
| 347 | + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR).$ext; |
|
| 348 | 348 | |
| 349 | - $first = $class[0]; |
|
| 350 | - if (isset($this->prefixLengthsPsr4[$first])) { |
|
| 351 | - foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { |
|
| 349 | + $first = $class[ 0 ]; |
|
| 350 | + if (isset($this->prefixLengthsPsr4[ $first ])) { |
|
| 351 | + foreach ($this->prefixLengthsPsr4[ $first ] as $prefix => $length) { |
|
| 352 | 352 | if (0 === strpos($class, $prefix)) { |
| 353 | - foreach ($this->prefixDirsPsr4[$prefix] as $dir) { |
|
| 354 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { |
|
| 353 | + foreach ($this->prefixDirsPsr4[ $prefix ] as $dir) { |
|
| 354 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.substr($logicalPathPsr4, $length))) { |
|
| 355 | 355 | return $file; |
| 356 | 356 | } |
| 357 | 357 | } |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | |
| 362 | 362 | // PSR-4 fallback dirs |
| 363 | 363 | foreach ($this->fallbackDirsPsr4 as $dir) { |
| 364 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
|
| 364 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr4)) { |
|
| 365 | 365 | return $file; |
| 366 | 366 | } |
| 367 | 367 | } |
@@ -373,14 +373,14 @@ discard block |
||
| 373 | 373 | . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
| 374 | 374 | } else { |
| 375 | 375 | // PEAR-like class name |
| 376 | - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
|
| 376 | + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR).$ext; |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - if (isset($this->prefixesPsr0[$first])) { |
|
| 380 | - foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
|
| 379 | + if (isset($this->prefixesPsr0[ $first ])) { |
|
| 380 | + foreach ($this->prefixesPsr0[ $first ] as $prefix => $dirs) { |
|
| 381 | 381 | if (0 === strpos($class, $prefix)) { |
| 382 | 382 | foreach ($dirs as $dir) { |
| 383 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
| 383 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
| 384 | 384 | return $file; |
| 385 | 385 | } |
| 386 | 386 | } |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | |
| 391 | 391 | // PSR-0 fallback dirs |
| 392 | 392 | foreach ($this->fallbackDirsPsr0 as $dir) { |
| 393 | - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
|
| 393 | + if (file_exists($file = $dir.DIRECTORY_SEPARATOR.$logicalPathPsr0)) { |
|
| 394 | 394 | return $file; |
| 395 | 395 | } |
| 396 | 396 | } |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <div class="rss-feed"> |
| 2 | 2 | <ul> |
| 3 | 3 | |
| 4 | - <?php foreach($items as $key => $item) {
|
|
| 4 | + <?php foreach ($items as $key => $item) {
|
|
| 5 | 5 | echo "<li> |
| 6 | 6 | <a href={$item->get_link()}>
|
| 7 | 7 | <div class='rss-item'> |
@@ -2,6 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | // autoload.php @generated by Composer |
| 4 | 4 | |
| 5 | -require_once __DIR__ . '/composer' . '/autoload_real.php'; |
|
| 5 | +require_once __DIR__.'/composer'.'/autoload_real.php'; |
|
| 6 | 6 | |
| 7 | 7 | return ComposerAutoloaderInit62f39d7a932289837b43d6101406a178::getLoader(); |
@@ -9,6 +9,11 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | class HTMLPurifier_Arborize |
| 11 | 11 | { |
| 12 | + /** |
|
| 13 | + * @param HTMLPurifier_Token[] $tokens |
|
| 14 | + * @param HTMLPurifier_Config $config |
|
| 15 | + * @param HTMLPurifier_Context $context |
|
| 16 | + */ |
|
| 12 | 17 | public static function arborize($tokens, $config, $context) { |
| 13 | 18 | $definition = $config->getHTMLDefinition(); |
| 14 | 19 | $parent = new HTMLPurifier_Token_Start($definition->info_parent); |
@@ -36,6 +41,10 @@ discard block |
||
| 36 | 41 | return $stack[0]; |
| 37 | 42 | } |
| 38 | 43 | |
| 44 | + /** |
|
| 45 | + * @param HTMLPurifier_Config $config |
|
| 46 | + * @param HTMLPurifier_Context $context |
|
| 47 | + */ |
|
| 39 | 48 | public static function flatten($node, $config, $context) { |
| 40 | 49 | $level = 0; |
| 41 | 50 | $nodes = array($level => new HTMLPurifier_Queue(array($node))); |
@@ -27,13 +27,13 @@ discard block |
||
| 27 | 27 | continue; |
| 28 | 28 | } |
| 29 | 29 | $node = $token->toNode(); |
| 30 | - $stack[count($stack)-1]->children[] = $node; |
|
| 30 | + $stack[ count($stack) - 1 ]->children[ ] = $node; |
|
| 31 | 31 | if ($token instanceof HTMLPurifier_Token_Start) { |
| 32 | - $stack[] = $node; |
|
| 32 | + $stack[ ] = $node; |
|
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | assert(count($stack) == 1); |
| 36 | - return $stack[0]; |
|
| 36 | + return $stack[ 0 ]; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public static function flatten($node, $config, $context) { |
@@ -42,27 +42,27 @@ discard block |
||
| 42 | 42 | $closingTokens = array(); |
| 43 | 43 | $tokens = array(); |
| 44 | 44 | do { |
| 45 | - while (!$nodes[$level]->isEmpty()) { |
|
| 46 | - $node = $nodes[$level]->shift(); // FIFO |
|
| 45 | + while (!$nodes[ $level ]->isEmpty()) { |
|
| 46 | + $node = $nodes[ $level ]->shift(); // FIFO |
|
| 47 | 47 | list($start, $end) = $node->toTokenPair(); |
| 48 | 48 | if ($level > 0) { |
| 49 | - $tokens[] = $start; |
|
| 49 | + $tokens[ ] = $start; |
|
| 50 | 50 | } |
| 51 | 51 | if ($end !== NULL) { |
| 52 | - $closingTokens[$level][] = $end; |
|
| 52 | + $closingTokens[ $level ][ ] = $end; |
|
| 53 | 53 | } |
| 54 | 54 | if ($node instanceof HTMLPurifier_Node_Element) { |
| 55 | 55 | $level++; |
| 56 | - $nodes[$level] = new HTMLPurifier_Queue(); |
|
| 56 | + $nodes[ $level ] = new HTMLPurifier_Queue(); |
|
| 57 | 57 | foreach ($node->children as $childNode) { |
| 58 | - $nodes[$level]->push($childNode); |
|
| 58 | + $nodes[ $level ]->push($childNode); |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | $level--; |
| 63 | - if ($level && isset($closingTokens[$level])) { |
|
| 64 | - while ($token = array_pop($closingTokens[$level])) { |
|
| 65 | - $tokens[] = $token; |
|
| 63 | + if ($level && isset($closingTokens[ $level ])) { |
|
| 64 | + while ($token = array_pop($closingTokens[ $level ])) { |
|
| 65 | + $tokens[ ] = $token; |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | } while ($level > 0); |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | * @param string $number |
| 25 | 25 | * @param HTMLPurifier_Config $config |
| 26 | 26 | * @param HTMLPurifier_Context $context |
| 27 | - * @return string|bool |
|
| 27 | + * @return false|string |
|
| 28 | 28 | * @warning Some contexts do not pass $config, $context. These |
| 29 | 29 | * variables should not be used without checking HTMLPurifier_Length |
| 30 | 30 | */ |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | $sign = ''; |
| 43 | - switch ($number[0]) { |
|
| 43 | + switch ($number[ 0 ]) { |
|
| 44 | 44 | case '-': |
| 45 | 45 | if ($this->non_negative) { |
| 46 | 46 | return false; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | if (ctype_digit($number)) { |
| 54 | 54 | $number = ltrim($number, '0'); |
| 55 | - return $number ? $sign . $number : '0'; |
|
| 55 | + return $number ? $sign.$number : '0'; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // Period is the only non-numeric character allowed |
@@ -73,11 +73,11 @@ discard block |
||
| 73 | 73 | $right = rtrim($right, '0'); |
| 74 | 74 | |
| 75 | 75 | if ($right === '') { |
| 76 | - return $left ? $sign . $left : '0'; |
|
| 76 | + return $left ? $sign.$left : '0'; |
|
| 77 | 77 | } elseif (!ctype_digit($right)) { |
| 78 | 78 | return false; |
| 79 | 79 | } |
| 80 | - return $sign . $left . '.' . $right; |
|
| 80 | + return $sign.$left.'.'.$right; |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | * @param string $string |
| 29 | 29 | * @param HTMLPurifier_Config $config |
| 30 | 30 | * @param HTMLPurifier_Context $context |
| 31 | - * @return bool|string |
|
| 31 | + * @return boolean |
|
| 32 | 32 | */ |
| 33 | 33 | public function validate($string, $config, $context) |
| 34 | 34 | { |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | * @param string $string |
| 25 | 25 | * @param HTMLPurifier_Config $config |
| 26 | 26 | * @param HTMLPurifier_Context $context |
| 27 | - * @return bool|string |
|
| 27 | + * @return string|false |
|
| 28 | 28 | */ |
| 29 | 29 | public function validate($string, $config, $context) |
| 30 | 30 | { |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @param string $string |
| 11 | 11 | * @param HTMLPurifier_Config $config |
| 12 | 12 | * @param HTMLPurifier_Context $context |
| 13 | - * @return bool|string |
|
| 13 | + * @return false|string |
|
| 14 | 14 | */ |
| 15 | 15 | public function validate($string, $config, $context) |
| 16 | 16 | { |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @param string $string |
| 35 | 35 | * @param HTMLPurifier_Config $config |
| 36 | 36 | * @param HTMLPurifier_Context $context |
| 37 | - * @return array |
|
| 37 | + * @return string[] |
|
| 38 | 38 | */ |
| 39 | 39 | protected function split($string, $config, $context) |
| 40 | 40 | { |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * Template method for removing certain tokens based on arbitrary criteria. |
| 57 | 57 | * @note If we wanted to be really functional, we'd do an array_filter |
| 58 | 58 | * with a callback. But... we're not. |
| 59 | - * @param array $tokens |
|
| 59 | + * @param string[] $tokens |
|
| 60 | 60 | * @param HTMLPurifier_Config $config |
| 61 | 61 | * @param HTMLPurifier_Context $context |
| 62 | 62 | * @return array |
@@ -45,11 +45,11 @@ |
||
| 45 | 45 | // escaping because I don't know how to do that with regexps |
| 46 | 46 | // and plus it would complicate optimization efforts (you never |
| 47 | 47 | // see that anyway). |
| 48 | - $pattern = '/(?:(?<=\s)|\A)' . // look behind for space or string start |
|
| 49 | - '((?:--|-?[A-Za-z_])[A-Za-z_\-0-9]*)' . |
|
| 48 | + $pattern = '/(?:(?<=\s)|\A)'.// look behind for space or string start |
|
| 49 | + '((?:--|-?[A-Za-z_])[A-Za-z_\-0-9]*)'. |
|
| 50 | 50 | '(?:(?=\s)|\z)/'; // look ahead for space or string end |
| 51 | 51 | preg_match_all($pattern, $string, $matches); |
| 52 | - return $matches[1]; |
|
| 52 | + return $matches[ 1 ]; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |