| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package WPEmerge |
| 4 |
* @author Atanas Angelov <hi@atanas.dev> |
| 5 |
* @copyright 2017-2019 Atanas Angelov |
| 6 |
* @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0 |
| 7 |
* @link https://wpemerge.com/ |
| 8 |
*/ |
| 9 |
|
| 10 |
namespace WPEmerge\Application; |
| 11 |
|
| 12 |
use Pimple\Container; |
| 13 |
use Psr\Http\Message\ResponseInterface; |
| 14 |
use WPEmerge\Requests\RequestInterface; |
| 15 |
use WPEmerge\Responses\RedirectResponse; |
| 16 |
use WPEmerge\Routing\RouteBlueprint; |
| 17 |
use WPEmerge\View\ViewInterface; |
| 18 |
|
| 19 |
/** |
| 20 |
* Can be applied to your App class via a "@mixin" annotation for better IDE support. |
| 21 |
* This class is not meant to be used in any other capacity. |
| 22 |
* |
| 23 |
* @codeCoverageIgnore |
| 24 |
*/ |
| 25 |
final class ApplicationMixin { |
| 26 |
/** |
| 27 |
* Prevent class instantiation. |
| 28 |
*/ |
| 29 |
private function __construct() {} |
| 30 |
|
| 31 |
// --- Methods --------------------------------------- // |
| 32 |
|
| 33 |
/** |
| 34 |
* Get whether the application has been bootstrapped. |
| 35 |
* |
| 36 |
* @return boolean |
| 37 |
*/ |
| 38 |
public static function isBootstrapped() {} |
| 39 |
|
| 40 |
/** |
| 41 |
* Bootstrap the application. |
| 42 |
* |
| 43 |
* @param array $config |
| 44 |
* @param boolean $run |
| 45 |
* @return void |
| 46 |
*/ |
| 47 |
public static function bootstrap( $config = [], $run = true ) {} |
| 48 |
|
| 49 |
/** |
| 50 |
* Get the IoC container instance. |
| 51 |
* |
| 52 |
* @codeCoverageIgnore |
| 53 |
* @return Container |
| 54 |
*/ |
| 55 |
public static function container() {} |
| 56 |
|
| 57 |
/** |
| 58 |
* Set the IoC container instance. |
| 59 |
* |
| 60 |
* @codeCoverageIgnore |
| 61 |
* @param Container $container |
| 62 |
* @return void |
| 63 |
*/ |
| 64 |
public static function setContainer( $container ) {} |
| 65 |
|
| 66 |
/** |
| 67 |
* Resolve a dependency from the IoC container. |
| 68 |
* |
| 69 |
* @param string $key |
| 70 |
* @return mixed|null |
| 71 |
*/ |
| 72 |
public static function resolve( $key ) {} |
| 73 |
|
| 74 |
// --- Aliases --------------------------------------- // |
| 75 |
|
| 76 |
/** |
| 77 |
* Get the Application instance. |
| 78 |
* |
| 79 |
* @codeCoverageIgnore |
| 80 |
* @return \WPEmerge\Application\Application |
| 81 |
*/ |
| 82 |
public static function app() {} |
| 83 |
|
| 84 |
/** |
| 85 |
* Get the ClosureFactory instance. |
| 86 |
* |
| 87 |
* @codeCoverageIgnore |
| 88 |
* @return ClosureFactory |
| 89 |
*/ |
| 90 |
public static function closure() {} |
| 91 |
|
| 92 |
/** |
| 93 |
* Get the CSRF service instance. |
| 94 |
* |
| 95 |
* @codeCoverageIgnore |
| 96 |
* @return \WPEmerge\Csrf\Csrf |
| 97 |
*/ |
| 98 |
public static function csrf() {} |
| 99 |
|
| 100 |
/** |
| 101 |
* Get the Flash service instance. |
| 102 |
* |
| 103 |
* @codeCoverageIgnore |
| 104 |
* @return \WPEmerge\Flash\Flash |
| 105 |
*/ |
| 106 |
public static function flash() {} |
| 107 |
|
| 108 |
/** |
| 109 |
* Get the OldInput service instance. |
| 110 |
* |
| 111 |
* @codeCoverageIgnore |
| 112 |
* @return \WPEmerge\Input\OldInput |
| 113 |
*/ |
| 114 |
public static function oldInput() {} |
| 115 |
|
| 116 |
/** |
| 117 |
* Run a full middleware + handler pipeline independently of routes. |
| 118 |
* |
| 119 |
* @codeCoverageIgnore |
| 120 |
* @see \WPEmerge\Kernels\HttpKernel::run() |
| 121 |
* @param RequestInterface $request |
| 122 |
* @param string[] $middleware |
| 123 |
* @param string|\Closure $handler |
| 124 |
* @param array $arguments |
| 125 |
* @return ResponseInterface |
| 126 |
*/ |
| 127 |
public static function run( RequestInterface $request, $middleware, $handler, $arguments = [] ) {} |
| 128 |
|
| 129 |
/** |
| 130 |
* Get the ResponseService instance. |
| 131 |
* |
| 132 |
* @codeCoverageIgnore |
| 133 |
* @return \WPEmerge\Responses\ResponseService |
| 134 |
*/ |
| 135 |
public static function responses() {} |
| 136 |
|
| 137 |
/** |
| 138 |
* Create a "blank" response. |
| 139 |
* |
| 140 |
* @codeCoverageIgnore |
| 141 |
* @see \WPEmerge\Responses\ResponseService::response() |
| 142 |
* @return ResponseInterface |
| 143 |
*/ |
| 144 |
public static function response() {} |
| 145 |
|
| 146 |
/** |
| 147 |
* Create a response with the specified string as its body. |
| 148 |
* |
| 149 |
* @codeCoverageIgnore |
| 150 |
* @see \WPEmerge\Responses\ResponseService::output() |
| 151 |
* @param string $output |
| 152 |
* @return ResponseInterface |
| 153 |
*/ |
| 154 |
public static function output( $output ) {} |
| 155 |
|
| 156 |
/** |
| 157 |
* Create a response with the specified data encoded as JSON as its body. |
| 158 |
* |
| 159 |
* @codeCoverageIgnore |
| 160 |
* @see \WPEmerge\Responses\ResponseService::json() |
| 161 |
* @param mixed $data |
| 162 |
* @return ResponseInterface |
| 163 |
*/ |
| 164 |
public static function json( $data ) {} |
| 165 |
|
| 166 |
/** |
| 167 |
* Create a redirect response. |
| 168 |
* |
| 169 |
* @codeCoverageIgnore |
| 170 |
* @see \WPEmerge\Responses\ResponseService::redirect() |
| 171 |
* @return RedirectResponse |
| 172 |
*/ |
| 173 |
public static function redirect() {} |
| 174 |
|
| 175 |
/** |
| 176 |
* Create a response with the specified error status code. |
| 177 |
* |
| 178 |
* @codeCoverageIgnore |
| 179 |
* @see \WPEmerge\Responses\ResponseService::error() |
| 180 |
* @param integer $status |
| 181 |
* @return ResponseInterface |
| 182 |
*/ |
| 183 |
public static function error( $status ) {} |
| 184 |
|
| 185 |
/** |
| 186 |
* Get the ViewService instance. |
| 187 |
* |
| 188 |
* @codeCoverageIgnore |
| 189 |
* @return \WPEmerge\View\ViewService |
| 190 |
*/ |
| 191 |
public static function views() {} |
| 192 |
|
| 193 |
/** |
| 194 |
* Create a view. |
| 195 |
* |
| 196 |
* @codeCoverageIgnore |
| 197 |
* @see \WPEmerge\View\ViewService::make() |
| 198 |
* @param string|string[] $views |
| 199 |
* @return ViewInterface |
| 200 |
*/ |
| 201 |
public static function view( $views ) {} |
| 202 |
|
| 203 |
/** |
| 204 |
* Output child layout content. |
| 205 |
* |
| 206 |
* @codeCoverageIgnore |
| 207 |
* @see \WPEmerge\View\PhpViewEngine::getLayoutContent() |
| 208 |
* @return void |
| 209 |
*/ |
| 210 |
public static function layoutContent() {} |
| 211 |
|
| 212 |
/** |
| 213 |
* Create a new route. |
| 214 |
* |
| 215 |
* @codeCoverageIgnore |
| 216 |
* @return RouteBlueprint |
| 217 |
*/ |
| 218 |
public static function route() {} |
| 219 |
|
| 220 |
/** |
| 221 |
* Output the specified view. |
| 222 |
* |
| 223 |
* @codeCoverageIgnore |
| 224 |
* @see \WPEmerge\View\ViewService::make() |
| 225 |
* @see \WPEmerge\View\ViewInterface::toString() |
| 226 |
* @param string|string[] $views |
| 227 |
* @param array<string, mixed> $context |
| 228 |
* @return void |
| 229 |
*/ |
| 230 |
public static function render( $views, $context = [] ) {} |
| 231 |
} |
| 232 |
|