← All changes
|
vendor/wpfluent/framework/src/WPFluent/Foundation/App.php
+27
-4
1.21
→
2.1.0
View file →
| @@ -1,15 +1,27 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace FluentBoards\Framework\Foundation; |
| 4 | 4 | |
| 5 | +use FluentBoards\Framework\Container\Contracts\BindingResolutionException; | |
| 5 | 6 | |
| 7 | +/** | |
| 8 | + * @method static db(); | |
| 9 | + * @method static view(); | |
| 10 | + * @method static events(); | |
| 11 | + * @method static config(); | |
| 12 | + * @method static request(); | |
| 13 | + * @method static response(); | |
| 14 | + * @method static encrypter(); | |
| 15 | + * @method static validator(); | |
| 16 | + */ | |
| 17 | + | |
| 6 | 18 | class App |
| 7 | 19 | { |
| 8 | 20 | /** |
| 9 | 21 | * Application instance |
| 10 | 22 | * |
| 11 | - * @var FluentBoards\Framework\Foundation\Application | |
| 23 | + * @var \FluentBoards\Framework\Foundation\Application | |
| 12 | 24 | */ |
| 13 | 25 | protected static $instance = null; |
| 14 | 26 | |
| 15 | 27 | /** |
| @@ -14,9 +26,9 @@ | ||
| 14 | 26 | |
| 15 | 27 | /** |
| 16 | 28 | * Set the application instance |
| 17 | 29 | * |
| 18 | - * @param FluentBoards\Framework\Foundation\Application $app | |
| 30 | + * @param \FluentBoards\Framework\Foundation\Application $app | |
| 19 | 31 | */ |
| 20 | 32 | public static function setInstance($app) |
| 21 | 33 | { |
| 22 | 34 | static::$instance = $app; |
| @@ -26,9 +38,9 @@ | ||
| 26 | 38 | * Get the application instance |
| 27 | 39 | * |
| 28 | 40 | * @param string $module The binding/key name for a component. |
| 29 | 41 | * @param array $parameters constructor dependencies if any. |
| 30 | - * @return FluentBoards\Framework\Foundation\Application|mixed | |
| 42 | + * @return \FluentBoards\Framework\Foundation\Application|mixed | |
| 31 | 43 | */ |
| 32 | 44 | public static function getInstance($module = null, $parameters = []) |
| 33 | 45 | { |
| 34 | 46 | if ($module) { |
| @@ -42,9 +54,9 @@ | ||
| 42 | 54 | * Retrive a component from the container |
| 43 | 55 | * |
| 44 | 56 | * @param string $module The binding/key name for a component. |
| 45 | 57 | * @param array $parameters constructor dependencies if any. |
| 46 | - * @return FluentBoards\Framework\Foundation\Application|mixed | |
| 58 | + * @return \FluentBoards\Framework\Foundation\Application|mixed | |
| 47 | 59 | */ |
| 48 | 60 | public static function make($module = null, $parameters = []) |
| 49 | 61 | { |
| 50 | 62 | return static::getInstance($module, $parameters); |
| @@ -58,7 +70,18 @@ | ||
| 58 | 70 | * @return mixed |
| 59 | 71 | */ |
| 60 | 72 | public static function __callStatic($method, $params) |
| 61 | 73 | { |
| 74 | + if ($method === 'support') { | |
| 75 | + $param = array_splice($params, 0, 1); | |
| 76 | + return static::getInstance( | |
| 77 | + 'Support.' . implode('.', $param), ...$params | |
| 78 | + ); | |
| 79 | + } | |
| 80 | + | |
| 81 | + if (method_exists(static::$instance, $method)) { | |
| 82 | + return static::$instance->{$method}(...$params); | |
| 83 | + } | |
| 84 | + | |
| 62 | 85 | return static::getInstance($method, ...$params); |
| 63 | 86 | } |
| 64 | 87 | } |