@@ -62,12 +62,12 @@ |
||
| 62 | 62 | |
| 63 | 63 | protected function authorizePostRequest(): void |
| 64 | 64 | { |
| 65 | - if (! $this->isRequestMadeFromLocalhost()) { |
|
| 65 | + if (!$this->isRequestMadeFromLocalhost()) { |
|
| 66 | 66 | throw new HttpException(403, "Refusing to serve request from address {$_SERVER['REMOTE_ADDR']} (must be on localhost)"); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | if ($this->withSession) { |
| 70 | - if (! $this->validateCSRFToken($this->request->get('_token'))) { |
|
| 70 | + if (!$this->validateCSRFToken($this->request->get('_token'))) { |
|
| 71 | 71 | throw new HttpException(403, 'Invalid CSRF token'); |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -11,17 +11,17 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | define('BASE_PATH', realpath(__DIR__.'/../../../')); |
| 13 | 13 | |
| 14 | -if (BASE_PATH === false || ! file_exists(BASE_PATH.'/hyde')) { |
|
| 14 | +if (BASE_PATH === false || !file_exists(BASE_PATH.'/hyde')) { |
|
| 15 | 15 | throw new InvalidArgumentException('This test suite must be run from the root of the hydephp/develop monorepo.'); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | ob_start(); |
| 19 | 19 | |
| 20 | -beforeEach(function () { |
|
| 20 | +beforeEach(function() { |
|
| 21 | 21 | putenv('SERVER_LIVE_EDIT=false'); |
| 22 | 22 | }); |
| 23 | 23 | |
| 24 | -test('handle routes index page', function () { |
|
| 24 | +test('handle routes index page', function() { |
|
| 25 | 25 | putenv('SERVER_DASHBOARD=false'); |
| 26 | 26 | mockRoute(''); |
| 27 | 27 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | Filesystem::unlink('_site/index.html'); |
| 41 | 41 | }); |
| 42 | 42 | |
| 43 | -test('handle routes custom pages', function () { |
|
| 43 | +test('handle routes custom pages', function() { |
|
| 44 | 44 | mockRoute('foo'); |
| 45 | 45 | |
| 46 | 46 | Filesystem::put('_pages/foo.md', '# Hello World!'); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | Filesystem::unlink('_site/foo.html'); |
| 59 | 59 | }); |
| 60 | 60 | |
| 61 | -test('handle routes pages with .html extension', function () { |
|
| 61 | +test('handle routes pages with .html extension', function() { |
|
| 62 | 62 | mockRoute('foo.html'); |
| 63 | 63 | |
| 64 | 64 | Filesystem::put('_pages/foo.md', '# Hello World!'); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | Filesystem::unlink('_site/foo.html'); |
| 77 | 77 | }); |
| 78 | 78 | |
| 79 | -test('handle routes static assets', function () { |
|
| 79 | +test('handle routes static assets', function() { |
|
| 80 | 80 | mockRoute('media/app.css'); |
| 81 | 81 | |
| 82 | 82 | $kernel = new HttpKernel(); |
@@ -89,14 +89,14 @@ discard block |
||
| 89 | 89 | expect($response->body)->toBe(file_get_contents(\Hyde\Hyde::path('_media/app.css'))); |
| 90 | 90 | }); |
| 91 | 91 | |
| 92 | -test('handle throws route not found exception for missing route', function () { |
|
| 92 | +test('handle throws route not found exception for missing route', function() { |
|
| 93 | 93 | mockRoute('missing'); |
| 94 | 94 | |
| 95 | 95 | $kernel = new HttpKernel(); |
| 96 | 96 | $kernel->handle(new Request()); |
| 97 | 97 | })->throws(RouteNotFoundException::class, 'Route [missing] not found'); |
| 98 | 98 | |
| 99 | -test('handle sends 404 error response for missing asset', function () { |
|
| 99 | +test('handle sends 404 error response for missing asset', function() { |
|
| 100 | 100 | mockRoute('missing.css'); |
| 101 | 101 | |
| 102 | 102 | $kernel = new HttpKernel(); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | // Filesystem::unlink('_site/foo.html'); |
| 128 | 128 | //})->skip('Underlying framework does not buffer headers (yet)'); |
| 129 | 129 | |
| 130 | -test('trailing slashes are normalized from route', function () { |
|
| 130 | +test('trailing slashes are normalized from route', function() { |
|
| 131 | 131 | mockRoute('foo/'); |
| 132 | 132 | |
| 133 | 133 | Filesystem::put('_pages/foo.md', '# Hello World!'); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | Filesystem::unlink('_site/foo.html'); |
| 146 | 146 | }); |
| 147 | 147 | |
| 148 | -test('docs uri path is rerouted to docs/index', function () { |
|
| 148 | +test('docs uri path is rerouted to docs/index', function() { |
|
| 149 | 149 | mockRoute('docs'); |
| 150 | 150 | |
| 151 | 151 | Filesystem::put('_docs/index.md', '# Hello World!'); |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | Filesystem::unlink('_site/docs/index.html'); |
| 164 | 164 | }); |
| 165 | 165 | |
| 166 | -test('docs/search renders search page', function () { |
|
| 166 | +test('docs/search renders search page', function() { |
|
| 167 | 167 | mockRoute('docs/search'); |
| 168 | 168 | |
| 169 | 169 | $kernel = new HttpKernel(); |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | Filesystem::unlink('_site/docs/search.html'); |
| 179 | 179 | }); |
| 180 | 180 | |
| 181 | -test('ping route returns ping response', function () { |
|
| 181 | +test('ping route returns ping response', function() { |
|
| 182 | 182 | mockRoute('ping'); |
| 183 | 183 | |
| 184 | 184 | $kernel = new HttpKernel(); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | ->and($response->statusMessage)->toBe('OK'); |
| 190 | 190 | }); |
| 191 | 191 | |
| 192 | -test('exception handling', function () { |
|
| 192 | +test('exception handling', function() { |
|
| 193 | 193 | $exception = new Exception('foo'); |
| 194 | 194 | $response = ExceptionHandler::handle($exception); |
| 195 | 195 | |
@@ -46,11 +46,11 @@ |
||
| 46 | 46 | |
| 47 | 47 | $page = Hyde::pages()->getPage($pagePath); |
| 48 | 48 | |
| 49 | - if (! $page instanceof BaseMarkdownPage) { |
|
| 49 | + if (!$page instanceof BaseMarkdownPage) { |
|
| 50 | 50 | $this->abort(400, 'Page is not a markdown page'); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - if (! $force && hash('sha256', $page->markdown()->body()) !== $currentContentHash) { |
|
| 53 | + if (!$force && hash('sha256', $page->markdown()->body()) !== $currentContentHash) { |
|
| 54 | 54 | $this->abort(409, 'Content has changed in another window'); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | /** Get all the configuration files for the application. */ |
| 20 | 20 | protected function getConfigurationFiles(Application $app): array |
| 21 | 21 | { |
| 22 | - return (array) tap(parent::getConfigurationFiles($app), function (array &$files) use ($app): void { |
|
| 22 | + return (array) tap(parent::getConfigurationFiles($app), function(array &$files) use ($app): void { |
|
| 23 | 23 | // Inject our custom config file which is stored in `app/config.php`. |
| 24 | 24 | $files['app'] ??= $app->basePath().DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'config.php'; |
| 25 | 25 | }); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | protected function getEnvironmentVariables(): array |
| 82 | 82 | { |
| 83 | 83 | return Arr::whereNotNull([ |
| 84 | - 'HYDE_SERVER_REQUEST_OUTPUT' => ! $this->option('no-ansi'), |
|
| 84 | + 'HYDE_SERVER_REQUEST_OUTPUT' => !$this->option('no-ansi'), |
|
| 85 | 85 | 'HYDE_SERVER_SAVE_PREVIEW' => $this->parseEnvironmentOption('save-preview'), |
| 86 | 86 | 'HYDE_SERVER_DASHBOARD' => $this->parseEnvironmentOption('dashboard'), |
| 87 | 87 | 'HYDE_PRETTY_URLS' => $this->parseEnvironmentOption('pretty-urls'), |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | protected function configureOutput(): void |
| 93 | 93 | { |
| 94 | - if (! $this->useBasicOutput()) { |
|
| 94 | + if (!$this->useBasicOutput()) { |
|
| 95 | 95 | $this->console = new ConsoleOutput($this->output->isVerbose()); |
| 96 | 96 | } |
| 97 | 97 | } |
@@ -105,14 +105,14 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | protected function getOutputHandler(): Closure |
| 107 | 107 | { |
| 108 | - return $this->useBasicOutput() ? function (string $type, string $line): void { |
|
| 108 | + return $this->useBasicOutput() ? function(string $type, string $line): void { |
|
| 109 | 109 | $this->output->write($line); |
| 110 | 110 | } : $this->console->getFormatter(); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | protected function useBasicOutput(): bool |
| 114 | 114 | { |
| 115 | - return $this->option('no-ansi') || ! class_exists(ConsoleOutput::class); |
|
| 115 | + return $this->option('no-ansi') || !class_exists(ConsoleOutput::class); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | protected function parseEnvironmentOption(string $name): ?string |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | $process = $command ? Process::command(sprintf('%s http://%s:%d', $command, $this->getHostSelection(), $this->getPortSelection()))->run() : null; |
| 155 | 155 | |
| 156 | - if (! $process || $process->failed()) { |
|
| 156 | + if (!$process || $process->failed()) { |
|
| 157 | 157 | $this->warn('Unable to open the site preview in the browser on your system:'); |
| 158 | 158 | $this->line(sprintf(' %s', str_replace("\n", "\n ", $process ? $process->errorOutput() : "Missing suitable 'open' binary."))); |
| 159 | 159 | $this->newLine(); |
@@ -14,8 +14,8 @@ |
||
| 14 | 14 | { |
| 15 | 15 | public const NAVIGATION_SCHEMA = [ |
| 16 | 16 | 'label' => 'string', // The text to display |
| 17 | - 'priority' => 'int', // Order is also supported |
|
| 18 | - 'hidden' => 'bool', // Visible is also supported (but obviously invert the value) |
|
| 17 | + 'priority' => 'int', // Order is also supported |
|
| 18 | + 'hidden' => 'bool', // Visible is also supported (but obviously invert the value) |
|
| 19 | 19 | 'group' => 'string', // Category is also supported |
| 20 | 20 | ]; |
| 21 | 21 | } |