PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.10.0
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.10.0
2.11.0 2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 All 78 releases
fluent-community / vendor / wpfluent / framework / src / WPFluent / Foundation / App.php

App.php in FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses 2.10.0, at vendor/wpfluent/framework/src/WPFluent/Foundation/App.php

87 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCommunity\Framework\Foundation;
4
5 use FluentCommunity\Framework\Container\Contracts\BindingResolutionException;
6
7 /**
8 * @method static \FluentCommunity\Framework\Database\DatabaseManager db()
9 * @method static \FluentCommunity\Framework\View\View view()
10 * @method static \FluentCommunity\Framework\Events\Dispatcher events()
11 * @method static \FluentCommunity\Framework\Foundation\Config config()
12 * @method static \FluentCommunity\Framework\Http\Request\Request request()
13 * @method static \FluentCommunity\Framework\Http\Response\Response response()
14 * @method static \FluentCommunity\Framework\Encryption\Encrypter encrypter()
15 * @method static \FluentCommunity\Framework\Validator\Validator validator()
16 */
17 class App
18 {
19 /**
20 * Application instance
21 *
22 * @var \FluentCommunity\Framework\Foundation\Application
23 */
24 protected static $instance = null;
25
26 /**
27 * Set the application instance
28 *
29 * @param \FluentCommunity\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 \FluentCommunity\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 \FluentCommunity\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