PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / 2.1.0
Fluent Support – Helpdesk & Customer Support Ticket System v2.1.0
2.4.0 2.3.2 2.3.1 2.3.0 2.2.1 2.2.0 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.4.0 1.4.1 1.4.2 1.4.5 1.4.6 1.4.7 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 All 68 releases
fluent-support / app / Api / Api.php

Api.php in Fluent Support – Helpdesk & Customer Support Ticket System 2.1.0, at app/Api/Api.php

48 lines 939 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentSupport\App\Api;
4
5
6
7 final class Api
8 {
9
10 private $app;
11
12 public function __construct($app)
13 {
14 $this->app = $app;
15 $this->register();
16 }
17
18 private function register()
19 {
20 foreach ($this->getClasses() as $key => $class) {
21 $this->app->singleton($this->key($key), function($app) use ($class) {
22 return new FSApi($app->make($class));
23 });
24 }
25 }
26
27 private function getClasses()
28 {
29 return require_once(
30 $this->app['path.app'].'Api/config.php'
31 );
32 }
33
34 private function key($key)
35 {
36 return '__fluentsupport_api__.' . $key;
37 }
38
39 public function __get($key)
40 {
41 try {
42 return $this->app[$this->key($key)];
43 } catch(\Exception $e) {
44 throw new \Exception(sprintf('The %s doesn\'t exist in FluentSupportApi.', esc_html($key)));
45 }
46 }
47 }
48