← All changes
|
vendor/wpfluent/framework/src/WPFluent/Foundation/App.php
+18
-30
1.10.02
→
2.5.0
View file →
| @@ -3,34 +3,31 @@ | ||
| 3 | 3 | namespace FluentBooking\Framework\Foundation; |
| 4 | 4 | |
| 5 | 5 | use FluentBooking\Framework\Container\Contracts\BindingResolutionException; |
| 6 | 6 | |
| 7 | +/** | |
| 8 | + * @method static \FluentBooking\Framework\Database\DatabaseManager db() | |
| 9 | + * @method static \FluentBooking\Framework\View\View view() | |
| 10 | + * @method static \FluentBooking\Framework\Events\Dispatcher events() | |
| 11 | + * @method static \FluentBooking\Framework\Foundation\Config config() | |
| 12 | + * @method static \FluentBooking\Framework\Http\Request\Request request() | |
| 13 | + * @method static \FluentBooking\Framework\Http\Response\Response response() | |
| 14 | + * @method static \FluentBooking\Framework\Encryption\Encrypter encrypter() | |
| 15 | + * @method static \FluentBooking\Framework\Validator\Validator validator() | |
| 16 | + */ | |
| 7 | 17 | class App |
| 8 | 18 | { |
| 9 | 19 | /** |
| 10 | 20 | * Application instance |
| 11 | 21 | * |
| 12 | - * @var FluentBooking\Framework\Foundation\Application | |
| 22 | + * @var \FluentBooking\Framework\Foundation\Application | |
| 13 | 23 | */ |
| 14 | 24 | protected static $instance = null; |
| 15 | 25 | |
| 16 | 26 | /** |
| 17 | - * Resolve dynamically accessed class. | |
| 18 | - * | |
| 19 | - * @param string $module | |
| 20 | - * @return string | |
| 21 | - */ | |
| 22 | - protected static function resolve($module) | |
| 23 | - { | |
| 24 | - $pieces = explode('\\', __NAMESPACE__); | |
| 25 | - array_pop($pieces) && $prefix = implode('\\', $pieces); | |
| 26 | - return $prefix . '\\' . str_replace('.', '\\', $module); | |
| 27 | - } | |
| 28 | - | |
| 29 | - /** | |
| 30 | 27 | * Set the application instance |
| 31 | 28 | * |
| 32 | - * @param FluentBooking\Framework\Foundation\Application $app | |
| 29 | + * @param \FluentBooking\Framework\Foundation\Application $app | |
| 33 | 30 | */ |
| 34 | 31 | public static function setInstance($app) |
| 35 | 32 | { |
| 36 | 33 | static::$instance = $app; |
| @@ -40,26 +37,17 @@ | ||
| 40 | 37 | * Get the application instance |
| 41 | 38 | * |
| 42 | 39 | * @param string $module The binding/key name for a component. |
| 43 | 40 | * @param array $parameters constructor dependencies if any. |
| 44 | - * @return FluentBooking\Framework\Foundation\Application|mixed | |
| 41 | + * @return \FluentBooking\Framework\Foundation\Application|mixed | |
| 45 | 42 | */ |
| 46 | 43 | public static function getInstance($module = null, $parameters = []) |
| 47 | 44 | { |
| 48 | - try { | |
| 49 | - if ($module) { | |
| 50 | - return static::$instance->make($module, $parameters); | |
| 51 | - } | |
| 45 | + if ($module) { | |
| 46 | + return static::$instance->make($module, $parameters); | |
| 47 | + } | |
| 52 | 48 | |
| 53 | - return static::$instance; | |
| 54 | - | |
| 55 | - } catch (BindingResolutionException $e) { | |
| 56 | - if (class_exists($class = static::resolve($module))) { | |
| 57 | - return static::$instance->make($class, $parameters); | |
| 58 | - } | |
| 59 | - | |
| 60 | - throw $e; | |
| 61 | - } | |
| 49 | + return static::$instance; | |
| 62 | 50 | } |
| 63 | 51 | |
| 64 | 52 | /** |
| 65 | 53 | * Retrive a component from the container |
| @@ -65,9 +53,9 @@ | ||
| 65 | 53 | * Retrive a component from the container |
| 66 | 54 | * |
| 67 | 55 | * @param string $module The binding/key name for a component. |
| 68 | 56 | * @param array $parameters constructor dependencies if any. |
| 69 | - * @return FluentBooking\Framework\Foundation\Application|mixed | |
| 57 | + * @return \FluentBooking\Framework\Foundation\Application|mixed | |
| 70 | 58 | */ |
| 71 | 59 | public static function make($module = null, $parameters = []) |
| 72 | 60 | { |
| 73 | 61 | return static::getInstance($module, $parameters); |