Added code format

pull/498/head
fadrian06 1 year ago
parent ba0c6bda33
commit 42ec161d8a

@ -0,0 +1,12 @@
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
indent_size = 2

1
.gitignore vendored

@ -2,3 +2,4 @@
vendor/ vendor/
composer.phar composer.phar
composer.lock composer.lock
*.sublime-workspace

@ -22,7 +22,10 @@
"ext-json": "*" "ext-json": "*"
}, },
"autoload": { "autoload": {
"files": [ "flight/autoload.php", "flight/Flight.php" ] "files": [
"flight/autoload.php",
"flight/Flight.php"
]
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^9.5", "phpunit/phpunit": "^9.5",

@ -0,0 +1,21 @@
{
"folders": [
{
"path": ".",
}
],
"settings": {
"LSP": {
"LSP-intelephense": {
"settings": {
"intelephense.environment.phpVersion": "7.4.0",
"intelephense.format.braces": "psr12",
},
},
"formatters":
{
"embedding.php": "LSP-intelephense"
},
},
},
}

@ -397,9 +397,10 @@ class Engine
*/ */
public function _error($e): void public function _error($e): void
{ {
$msg = sprintf('<h1>500 Internal Server Error</h1>' . $msg = sprintf(
'<h3>%s (%s)</h3>' . '<h1>500 Internal Server Error</h1>' .
'<pre>%s</pre>', '<h3>%s (%s)</h3>' .
'<pre>%s</pre>',
$e->getMessage(), $e->getMessage(),
$e->getCode(), $e->getCode(),
$e->getTraceAsString() $e->getTraceAsString()
@ -524,8 +525,8 @@ class Engine
->status(404) ->status(404)
->write( ->write(
'<h1>404 Not Found</h1>' . '<h1>404 Not Found</h1>' .
'<h3>The page you have requested could not be found.</h3>' . '<h3>The page you have requested could not be found.</h3>' .
str_repeat(' ', 512) str_repeat(' ', 512)
) )
->send(); ->send();
} }
@ -644,8 +645,10 @@ class Engine
$this->response()->header('ETag', $id); $this->response()->header('ETag', $id);
if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && if (
$_SERVER['HTTP_IF_NONE_MATCH'] === $id) { isset($_SERVER['HTTP_IF_NONE_MATCH']) &&
$_SERVER['HTTP_IF_NONE_MATCH'] === $id
) {
$this->halt(304); $this->halt(304);
} }
} }
@ -659,8 +662,10 @@ class Engine
{ {
$this->response()->header('Last-Modified', gmdate('D, d M Y H:i:s \G\M\T', $time)); $this->response()->header('Last-Modified', gmdate('D, d M Y H:i:s \G\M\T', $time));
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && if (
strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) === $time) { isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) &&
strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) === $time
) {
$this->halt(304); $this->halt(304);
} }
} }

@ -23,7 +23,7 @@ use flight\template\View;
* @method static void stop() Stops the framework and sends a response. * @method static void stop() Stops the framework and sends a response.
* @method static void halt(int $code = 200, string $message = '') Stop the framework with an optional status code and message. * @method static void halt(int $code = 200, string $message = '') Stop the framework with an optional status code and message.
* *
* @method static void route(string $pattern, callable $callback) Maps a URL pattern to a callback. * @method static void route(string $pattern, callable $callback, bool $pass_route = false) Maps a URL pattern to a callback.
* @method static Router router() Returns Router instance. * @method static Router router() Returns Router instance.
* *
* @method static void map(string $name, callable $callback) Creates a custom framework method. * @method static void map(string $name, callable $callback) Creates a custom framework method.
@ -80,8 +80,9 @@ class Flight
* @param ?Closure(T $instance): void $callback Perform actions with the instance * @param ?Closure(T $instance): void $callback Perform actions with the instance
* @return void * @return void
*/ */
static function register($name, $class, $params = array(), $callback = null) { static function register($name, $class, $params = array(), $callback = null)
static::__callStatic('register', func_get_args()); {
static::__callStatic('register', func_get_args());
} }
/** /**

@ -251,7 +251,8 @@ class Response
'%s %d %s', '%s %d %s',
$_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1', $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1',
$this->status, $this->status,
self::$codes[$this->status]), self::$codes[$this->status]
),
true, true,
$this->status $this->status
); );

@ -0,0 +1,3 @@
<?php
class ReturnTypeWillChange {}

@ -1,10 +1,10 @@
includes: includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon - vendor/phpstan/phpstan/conf/bleedingEdge.neon
parameters: parameters:
level: 6 level: 6
excludePaths: excludePaths:
- vendor - vendor
paths: paths:
- flight - flight
- index.php - index.php

Loading…
Cancel
Save