Flight and Engine docblocks refactored

pull/532/head
fadrian06 1 year ago
parent 1485540ad9
commit f8a3b841cf

@ -1,12 +1,5 @@
<?php <?php
/**
* Flight: An extensible micro-framework.
*
* @copyright Copyright (c) 2011, Mike Cao <mike@mikecao.com>
* @license MIT, http://flightphp.com/license
*/
declare(strict_types=1); declare(strict_types=1);
namespace flight; namespace flight;
@ -28,36 +21,46 @@ use flight\net\Route;
* It is responsible for loading an HTTP request, running the assigned services, * It is responsible for loading an HTTP request, running the assigned services,
* and generating an HTTP response. * and generating an HTTP response.
* *
* Core methods * @license MIT, http://flightphp.com/license
* @copyright Copyright (c) 2011, Mike Cao <mike@mikecao.com>
* *
* # Core methods
* @method void start() Starts engine * @method void start() Starts engine
* @method void stop() Stops framework and outputs current response * @method void stop() Stops framework and outputs current response
* @method void halt(int $code = 200, string $message = '') Stops processing and returns a given response. * @method void halt(int $code = 200, string $message = '') Stops processing and returns a given response.
* *
* Routing * # Routing
* @method Route route(string $pattern, callable $callback, bool $pass_route = false, string $alias = '') Routes a URL to a callback function with all applicable methods * @method Route route(string $pattern, callable $callback, bool $pass_route = false, string $alias = '')
* @method void group(string $pattern, callable $callback, array $group_middlewares = []) Groups a set of routes together under a common prefix. * Routes a URL to a callback function with all applicable methods
* @method Route post(string $pattern, callable $callback, bool $pass_route = false, string $alias = '') Routes a POST URL to a callback function. * @method void group(string $pattern, callable $callback, array $group_middlewares = [])
* @method Route put(string $pattern, callable $callback, bool $pass_route = false, string $alias = '') Routes a PUT URL to a callback function. * Groups a set of routes together under a common prefix.
* @method Route patch(string $pattern, callable $callback, bool $pass_route = false, string $alias = '') Routes a PATCH URL to a callback function. * @method Route post(string $pattern, callable $callback, bool $pass_route = false, string $alias = '')
* @method Route delete(string $pattern, callable $callback, bool $pass_route = false, string $alias = '') Routes a DELETE URL to a callback function. * Routes a POST URL to a callback function.
* @method Route put(string $pattern, callable $callback, bool $pass_route = false, string $alias = '')
* Routes a PUT URL to a callback function.
* @method Route patch(string $pattern, callable $callback, bool $pass_route = false, string $alias = '')
* Routes a PATCH URL to a callback function.
* @method Route delete(string $pattern, callable $callback, bool $pass_route = false, string $alias = '')
* Routes a DELETE URL to a callback function.
* @method Router router() Gets router * @method Router router() Gets router
* @method string getUrl(string $alias) Gets a url from an alias * @method string getUrl(string $alias) Gets a url from an alias
* *
* Views * # Views
* @method void render(string $file, array $data = null, string $key = null) Renders template * @method void render(string $file, array $data = null, string $key = null) Renders template
* @method View view() Gets current view * @method View view() Gets current view
* *
* Request-response * # Request-Response
* @method Request request() Gets current request * @method Request request() Gets current request
* @method Response response() Gets current response * @method Response response() Gets current response
* @method void error(Throwable $e) Sends an HTTP 500 response for any errors. * @method void error(Throwable $e) Sends an HTTP 500 response for any errors.
* @method void notFound() Sends an HTTP 404 response when a URL is not found. * @method void notFound() Sends an HTTP 404 response when a URL is not found.
* @method void redirect(string $url, int $code = 303) Redirects the current request to another URL. * @method void redirect(string $url, int $code = 303) Redirects the current request to another URL.
* @method void json(mixed $data, int $code = 200, bool $encode = true, string $charset = 'utf-8', int $option = 0) Sends a JSON response. * @method void json(mixed $data, int $code = 200, bool $encode = true, string $charset = 'utf-8', int $option = 0)
* @method void jsonp(mixed $data, string $param = 'jsonp', int $code = 200, bool $encode = true, string $charset = 'utf-8', int $option = 0) Sends a JSONP response. * Sends a JSON response.
* @method void jsonp(mixed $data, string $param = 'jsonp', int $code = 200,
* bool $encode = true, string $charset = 'utf-8', int $option = 0) Sends a JSONP response.
* *
* HTTP caching * # HTTP caching
* @method void etag($id, string $type = 'strong') Handles ETag HTTP caching. * @method void etag($id, string $type = 'strong') Handles ETag HTTP caching.
* @method void lastModified(int $time) Handles last modified HTTP caching. * @method void lastModified(int $time) Handles last modified HTTP caching.
*/ */
@ -601,7 +604,6 @@ class Engine
* *
* @param int $code HTTP status code * @param int $code HTTP status code
* @param string $message Response message * @param string $message Response message
*
*/ */
public function _halt(int $code = 200, string $message = ''): void public function _halt(int $code = 200, string $message = ''): void
{ {

@ -1,12 +1,5 @@
<?php <?php
/**
* Flight: An extensible micro-framework.
*
* @copyright Copyright (c) 2011, Mike Cao <mike@mikecao.com>
* @license MIT, http://flightphp.com/license
*/
declare(strict_types=1); declare(strict_types=1);
use flight\core\Dispatcher; use flight\core\Dispatcher;
@ -19,18 +12,29 @@ use flight\net\Route;
/** /**
* The Flight class is a static representation of the framework. * The Flight class is a static representation of the framework.
* @license MIT, http://flightphp.com/license
* @copyright Copyright (c) 2011, Mike Cao <mike@mikecao.com>
* *
* # Core methods
* @method static void start() Starts the framework. * @method static void start() Starts the framework.
* @method static void path(string $path) Adds a path for autoloading classes. * @method static void path(string $path) Adds a path for autoloading classes.
* @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 Route route(string $pattern, callable $callback, bool $pass_route = false, string $alias = '') Maps a URL pattern to a callback with all applicable methods. * # Routing
* @method static void group(string $pattern, callable $callback, array $group_middlewares = []) Groups a set of routes together under a common prefix. * @method static Route route(string $pattern, callable $callback, bool $pass_route = false, string $alias = '')
* @method static Route post(string $pattern, callable $callback, bool $pass_route = false, string $alias = '') Routes a POST URL to a callback function. * Maps a URL pattern to a callback with all applicable methods.
* @method static Route put(string $pattern, callable $callback, bool $pass_route = false, string $alias = '') Routes a PUT URL to a callback function. * @method static void group(string $pattern, callable $callback, array $group_middlewares = [])
* @method static Route patch(string $pattern, callable $callback, bool $pass_route = false, string $alias = '') Routes a PATCH URL to a callback function. * Groups a set of routes together under a common prefix.
* @method static Route delete(string $pattern, callable $callback, bool $pass_route = false, string $alias = '') Routes a DELETE URL to a callback function. * @method static Route post(string $pattern, callable $callback, bool $pass_route = false, string $alias = '')
* Routes a POST URL to a callback function.
* @method static Route put(string $pattern, callable $callback, bool $pass_route = false, string $alias = '')
* Routes a PUT URL to a callback function.
* @method static Route patch(string $pattern, callable $callback, bool $pass_route = false, string $alias = '')
* Routes a PATCH URL to a callback function.
* @method static Route delete(string $pattern, callable $callback, bool $pass_route = false, string $alias = '')
* Routes a DELETE URL to a callback function.
* @method static Router router() Returns Router instance. * @method static Router router() Returns Router instance.
* @method static string getUrl(string $alias) Gets a url from an alias * @method static string getUrl(string $alias) Gets a url from an alias
* *
@ -44,17 +48,22 @@ use flight\net\Route;
* @method static bool has($key) Checks if a variable is set. * @method static bool has($key) Checks if a variable is set.
* @method static void clear($key = null) Clears a variable. * @method static void clear($key = null) Clears a variable.
* *
* # Views
* @method static void render($file, array $data = null, $key = null) Renders a template file. * @method static void render($file, array $data = null, $key = null) Renders a template file.
* @method static View view() Returns View instance. * @method static View view() Returns View instance.
* *
* # Request-Response
* @method static Request request() Returns Request instance. * @method static Request request() Returns Request instance.
* @method static Response response() Returns Response instance. * @method static Response response() Returns Response instance.
* @method static void redirect($url, $code = 303) Redirects to another URL. * @method static void redirect($url, $code = 303) Redirects to another URL.
* @method static void json($data, $code = 200, $encode = true, $charset = "utf8", $encodeOption = 0, $encodeDepth = 512) Sends a JSON response. * @method static void json($data, $code = 200, $encode = true, $charset = "utf8",
* @method static void jsonp($data, $param = 'jsonp', $code = 200, $encode = true, $charset = "utf8", $encodeOption = 0, $encodeDepth = 512) Sends a JSONP response. * $encodeOption = 0, $encodeDepth = 512) Sends a JSON response.
* @method static void jsonp($data, $param = 'jsonp', $code = 200, $encode = true,
* $charset = "utf8", $encodeOption = 0, $encodeDepth = 512) Sends a JSONP response.
* @method static void error($exception) Sends an HTTP 500 response. * @method static void error($exception) Sends an HTTP 500 response.
* @method static void notFound() Sends an HTTP 404 response. * @method static void notFound() Sends an HTTP 404 response.
* *
* # HTTP caching
* @method static void etag($id, $type = 'strong') Performs ETag HTTP caching. * @method static void etag($id, $type = 'strong') Performs ETag HTTP caching.
* @method static void lastModified($time) Performs last modified HTTP caching. * @method static void lastModified($time) Performs last modified HTTP caching.
*/ */

@ -1,12 +1,5 @@
<?php <?php
/**
* Flight: An extensible micro-framework.
*
* @copyright Copyright (c) 2013, Mike Cao <mike@mikecao.com>
* @license MIT, http://flightphp.com/license
*/
declare(strict_types=1); declare(strict_types=1);
use flight\core\Loader; use flight\core\Loader;

Loading…
Cancel
Save