@@ -3,13 +3,17 @@ |
||
| 3 | 3 | require __DIR__ . "/../vendor/autoload.php"; |
| 4 | 4 | |
| 5 | 5 | // The only deprecation warnings we need to ignore/handle are in PHP 7.4 so far |
| 6 | -if (PHP_VERSION_ID >= 70400) { |
|
| 7 | - function customErrorHandler($errno, $errstr, $errfile, $errline) { |
|
| 6 | +if (PHP_VERSION_ID >= 70400) |
|
| 7 | +{ |
|
| 8 | + function customErrorHandler($errno, $errstr, $errfile, $errline) |
|
| 9 | + { |
|
| 8 | 10 | // We know about this deprecation warning exists and it's already been |
| 9 | 11 | // fixed in the 2.x branch. For BC reasons in the 1.x branch, we'll |
| 10 | 12 | // ignore this warning to let tests pass. |
| 11 | - if ($errno === E_DEPRECATED) { |
|
| 12 | - if ($errstr === "Function ReflectionType::__toString() is deprecated") { |
|
| 13 | + if ($errno === E_DEPRECATED) |
|
| 14 | + { |
|
| 15 | + if ($errstr === "Function ReflectionType::__toString() is deprecated") |
|
| 16 | + { |
|
| 13 | 17 | return true; |
| 14 | 18 | } |
| 15 | 19 | } |
@@ -476,7 +476,8 @@ |
||
| 476 | 476 | |
| 477 | 477 | /** @var \ReflectionMethod $fxnToCall */ |
| 478 | 478 | $fxnToCall = \__::chain($fxns) |
| 479 | - ->filter(function (\ReflectionMethod $fxn) use ($method) { |
|
| 479 | + ->filter(function (\ReflectionMethod $fxn) use ($method) |
|
| 480 | + { |
|
| 480 | 481 | return $fxn->getName() === $method; |
| 481 | 482 | }) |
| 482 | 483 | ->get(0, null) |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | * |
| 221 | 221 | * @since 0.1.1 |
| 222 | 222 | */ |
| 223 | - public function compilePageView(BasePageView &$pageView) |
|
| 223 | + public function compilePageView(BasePageView & $pageView) |
|
| 224 | 224 | { |
| 225 | 225 | Service::setOption('currentTemplate', $pageView->getAbsoluteFilePath()); |
| 226 | 226 | $this->logger->debug('Compiling {type} PageView: {pageview}', [ |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | * |
| 268 | 268 | * @throws TemplateErrorInterface |
| 269 | 269 | */ |
| 270 | - private function compileStaticPageView(StaticPageView &$pageView) |
|
| 270 | + private function compileStaticPageView(StaticPageView & $pageView) |
|
| 271 | 271 | { |
| 272 | 272 | $this->writeToFilesystem( |
| 273 | 273 | $pageView->getTargetFile(), |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | * |
| 286 | 286 | * @throws TemplateErrorInterface |
| 287 | 287 | */ |
| 288 | - private function compileDynamicPageView(DynamicPageView &$pageView) |
|
| 288 | + private function compileDynamicPageView(DynamicPageView & $pageView) |
|
| 289 | 289 | { |
| 290 | 290 | $contentItems = $pageView->getCollectableItems(); |
| 291 | 291 | $template = $this->createTwigTemplate($pageView); |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | * |
| 321 | 321 | * @throws TemplateErrorInterface |
| 322 | 322 | */ |
| 323 | - private function compileRepeaterPageView(RepeaterPageView &$pageView) |
|
| 323 | + private function compileRepeaterPageView(RepeaterPageView & $pageView) |
|
| 324 | 324 | { |
| 325 | 325 | $template = $this->createTwigTemplate($pageView); |
| 326 | 326 | $permalinks = $pageView->getRepeaterPermalinks(); |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | * |
| 363 | 363 | * @since 0.1.1 |
| 364 | 364 | */ |
| 365 | - private function compileStandardRedirects(PermalinkDocument &$pageView) |
|
| 365 | + private function compileStandardRedirects(PermalinkDocument & $pageView) |
|
| 366 | 366 | { |
| 367 | 367 | $redirects = $pageView->getRedirects(); |
| 368 | 368 | |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | * |
| 397 | 397 | * @since 0.1.1 |
| 398 | 398 | */ |
| 399 | - private function compileExpandedRedirects(RepeaterPageView &$pageView) |
|
| 399 | + private function compileExpandedRedirects(RepeaterPageView & $pageView) |
|
| 400 | 400 | { |
| 401 | 401 | $permalinks = $pageView->getRepeaterPermalinks(); |
| 402 | 402 | |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | * |
| 447 | 447 | * @return string |
| 448 | 448 | */ |
| 449 | - private function buildRepeaterPageViewHTML(TemplateInterface &$template, RepeaterPageView &$pageView, ExpandedValue &$expandedValue) |
|
| 449 | + private function buildRepeaterPageViewHTML(TemplateInterface & $template, RepeaterPageView & $pageView, ExpandedValue & $expandedValue) |
|
| 450 | 450 | { |
| 451 | 451 | $defaultContext = [ |
| 452 | 452 | 'this' => $pageView->createJail(), |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | * |
| 481 | 481 | * @return string |
| 482 | 482 | */ |
| 483 | - private function buildDynamicPageViewHTML(TemplateInterface &$template, &$twigItem) |
|
| 483 | + private function buildDynamicPageViewHTML(TemplateInterface & $template, &$twigItem) |
|
| 484 | 484 | { |
| 485 | 485 | $defaultContext = [ |
| 486 | 486 | 'this' => $twigItem->createJail(), |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | * |
| 510 | 510 | * @return string |
| 511 | 511 | */ |
| 512 | - private function buildStaticPageViewHTML(StaticPageView &$pageView) |
|
| 512 | + private function buildStaticPageViewHTML(StaticPageView & $pageView) |
|
| 513 | 513 | { |
| 514 | 514 | $defaultContext = [ |
| 515 | 515 | 'this' => $pageView->createJail(), |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | * |
| 540 | 540 | * @return TemplateInterface |
| 541 | 541 | */ |
| 542 | - private function createTwigTemplate(BasePageView &$pageView) |
|
| 542 | + private function createTwigTemplate(BasePageView & $pageView) |
|
| 543 | 543 | { |
| 544 | 544 | try |
| 545 | 545 | { |
@@ -199,7 +199,7 @@ |
||
| 199 | 199 | if ($this->cacheDirectory) |
| 200 | 200 | { |
| 201 | 201 | $cacheOptions = [ |
| 202 | - 'cacheDir' => (string) $this->cacheDirectory->getFilesystemPath(), |
|
| 202 | + 'cacheDir' => (string)$this->cacheDirectory->getFilesystemPath(), |
|
| 203 | 203 | 'forceRefresh' => false, |
| 204 | 204 | ]; |
| 205 | 205 | } |
@@ -62,7 +62,8 @@ |
||
| 62 | 62 | { |
| 63 | 63 | $routes = Controller::create($routeMapper, $compiler); |
| 64 | 64 | |
| 65 | - return new Server(function (ServerRequestInterface $request) use ($routes, $compiler, $assetManager) { |
|
| 65 | + return new Server(function (ServerRequestInterface $request) use ($routes, $compiler, $assetManager) |
|
| 66 | + { |
|
| 66 | 67 | $httpMethod = $request->getMethod(); |
| 67 | 68 | $urlPath = Controller::normalizeUrl($request->getUri()->getPath()); |
| 68 | 69 | |
@@ -45,7 +45,8 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | private function staticPageViewAction(StaticPageView $pageView, Compiler $compiler) |
| 47 | 47 | { |
| 48 | - return function () use ($pageView, $compiler) { |
|
| 48 | + return function () use ($pageView, $compiler) |
|
| 49 | + { |
|
| 49 | 50 | Service::setOption('currentTemplate', $pageView->getAbsoluteFilePath()); |
| 50 | 51 | |
| 51 | 52 | $compiler->getTemplateBridge()->clearTemplateCache(); |
@@ -75,7 +76,8 @@ discard block |
||
| 75 | 76 | */ |
| 76 | 77 | private function dynamicPageViewAction(DynamicPageView $pageView, Compiler $compiler) |
| 77 | 78 | { |
| 78 | - return function (ServerRequestInterface $request) use ($pageView, $compiler) { |
|
| 79 | + return function (ServerRequestInterface $request) use ($pageView, $compiler) |
|
| 80 | + { |
|
| 79 | 81 | Service::setOption('currentTemplate', $pageView->getAbsoluteFilePath()); |
| 80 | 82 | |
| 81 | 83 | $compiler->getTemplateBridge()->clearTemplateCache(); |
@@ -111,7 +113,8 @@ discard block |
||
| 111 | 113 | */ |
| 112 | 114 | private function repeaterPageViewAction(RepeaterPageView $pageView, Compiler $compiler) |
| 113 | 115 | { |
| 114 | - return function (ServerRequestInterface $request) use ($pageView, $compiler) { |
|
| 116 | + return function (ServerRequestInterface $request) use ($pageView, $compiler) |
|
| 117 | + { |
|
| 115 | 118 | Service::setOption('currentTemplate', $pageView->getAbsoluteFilePath()); |
| 116 | 119 | |
| 117 | 120 | $compiler->getTemplateBridge()->clearTemplateCache(); |
@@ -154,7 +157,8 @@ discard block |
||
| 154 | 157 | return $this->repeaterPageViewAction($pageView, $compiler); |
| 155 | 158 | |
| 156 | 159 | default: |
| 157 | - return function () { |
|
| 160 | + return function () |
|
| 161 | + { |
|
| 158 | 162 | $errMsg = 'This URL type has not yet been implemented.'; |
| 159 | 163 | |
| 160 | 164 | return new Response(501, ['Content-Type' => 'text/plain'], $errMsg); |
@@ -171,7 +175,8 @@ discard block |
||
| 171 | 175 | */ |
| 172 | 176 | private function createRedirectAction($to) |
| 173 | 177 | { |
| 174 | - return function () use ($to) { |
|
| 178 | + return function () use ($to) |
|
| 179 | + { |
|
| 175 | 180 | return new Response(302, [ |
| 176 | 181 | 'Location' => $to, |
| 177 | 182 | ]); |
@@ -164,7 +164,8 @@ |
||
| 164 | 164 | |
| 165 | 165 | Service::setRuntimeFlag(RuntimeStatus::USING_HIGHLIGHTER); |
| 166 | 166 | |
| 167 | - if ($this->getConfiguration()->isHighlighterUsingLineNumbers()) { |
|
| 167 | + if ($this->getConfiguration()->isHighlighterUsingLineNumbers()) |
|
| 168 | + { |
|
| 168 | 169 | Service::setRuntimeFlag(RuntimeStatus::USING_LINE_NUMBERS); |
| 169 | 170 | } |
| 170 | 171 | |
@@ -19,7 +19,8 @@ |
||
| 19 | 19 | return $array; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - usort($array, function ($a, $b) use ($key, $order, $case_insensitive) { |
|
| 22 | + usort($array, function ($a, $b) use ($key, $order, $case_insensitive) |
|
| 23 | + { |
|
| 23 | 24 | $aValue = __::get($a, $key); |
| 24 | 25 | $bValue = __::get($b, $key); |
| 25 | 26 | |
@@ -55,14 +55,20 @@ |
||
| 55 | 55 | |
| 56 | 56 | $headingID = $heading->attributes->getNamedItem('id'); |
| 57 | 57 | |
| 58 | - if ($curr > $last) // If the current level is greater than the last level indent one level |
|
| 58 | + if ($curr > $last) |
|
| 59 | + { |
|
| 60 | + // If the current level is greater than the last level indent one level |
|
| 59 | 61 | { |
| 60 | 62 | $toc .= '<ul>'; |
| 61 | 63 | } |
| 62 | - elseif ($curr < $last) // If the current level is less than the last level go up appropriate amount. |
|
| 64 | + } |
|
| 65 | + elseif ($curr < $last) |
|
| 66 | + { |
|
| 67 | + // If the current level is less than the last level go up appropriate amount. |
|
| 63 | 68 | { |
| 64 | 69 | $toc .= str_repeat('</li></ul>', $last - $curr) . '</li>'; |
| 65 | 70 | } |
| 71 | + } |
|
| 66 | 72 | else // If the current level is equal to the last. |
| 67 | 73 | { |
| 68 | 74 | $toc .= '</li>'; |