PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / 2.5.0
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution v2.5.0
2.5.0 2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 All 34 releases
fluent-booking / vendor / wpfluent / framework / src / WPFluent / Foundation / App.php

App.php in Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution 2.5.0, at vendor/wpfluent/framework/src/WPFluent/Foundation/App.php

87 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentBooking\Framework\Foundation;
4
5 use FluentBooking\Framework\Container\Contracts\BindingResolutionException;
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 */
17 class App
18 {
19 /**
20 * Application instance
21 *
22 * @var \FluentBooking\Framework\Foundation\Application
23 */
24 protected static $instance = null;
25
26 /**
27 * Set the application instance
28 *
29 * @param \FluentBooking\Framework\Foundation\Application $app
30 */
31 public static function setInstance($app)
32 {
33 static::$instance = $app;
34 }
35
36 /**
37 * Get the application instance
38 *
39 * @param string $module The binding/key name for a component.
40 * @param array $parameters constructor dependencies if any.
41 * @return \FluentBooking\Framework\Foundation\Application|mixed
42 */
43 public static function getInstance($module = null, $parameters = [])
44 {
45 if ($module) {
46 return static::$instance->make($module, $parameters);
47 }
48
49 return static::$instance;
50 }
51
52 /**
53 * Retrive a component from the container
54 *
55 * @param string $module The binding/key name for a component.
56 * @param array $parameters constructor dependencies if any.
57 * @return \FluentBooking\Framework\Foundation\Application|mixed
58 */
59 public static function make($module = null, $parameters = [])
60 {
61 return static::getInstance($module, $parameters);
62 }
63
64 /**
65 * Handle dynamic method calls
66 *
67 * @param string $method
68 * @param array $params
69 * @return mixed
70 */
71 public static function __callStatic($method, $params)
72 {
73 if ($method === 'support') {
74 $param = array_splice($params, 0, 1);
75 return static::getInstance(
76 'Support.' . implode('.', $param), ...$params
77 );
78 }
79
80 if (method_exists(static::$instance, $method)) {
81 return static::$instance->{$method}(...$params);
82 }
83
84 return static::getInstance($method, ...$params);
85 }
86 }
87