From a60a31c4bd6d2dc07db776126f80d8f0a0b6a80d Mon Sep 17 00:00:00 2001 From: n0nag0n Date: Thu, 15 Feb 2024 22:43:11 -0700 Subject: [PATCH] added constant --- flight/Engine.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/flight/Engine.php b/flight/Engine.php index 52f0c98..d6e5490 100644 --- a/flight/Engine.php +++ b/flight/Engine.php @@ -66,6 +66,16 @@ use flight\net\Route; */ class Engine { + + /** + * @var array List of methods that can be extended in the Engine class. + */ + private const MAPPABLE_METHODS = [ + 'start', 'stop', 'route', 'halt', 'error', 'notFound', + 'render', 'redirect', 'etag', 'lastModified', 'json', 'jsonp', + 'post', 'put', 'patch', 'delete', 'group', 'getUrl' + ]; + /** @var array Stored variables. */ protected array $vars = []; @@ -137,14 +147,7 @@ class Engine $view->extension = $self->get('flight.views.extension'); }); - // Register framework methods - $methods = [ - 'start', 'stop', 'route', 'halt', 'error', 'notFound', - 'render', 'redirect', 'etag', 'lastModified', 'json', 'jsonp', - 'post', 'put', 'patch', 'delete', 'group', 'getUrl', - ]; - - foreach ($methods as $name) { + foreach (self::MAPPABLE_METHODS as $name) { $this->dispatcher->set($name, [$this, "_$name"]); }