Total Complexity | 18 |
Total Lines | 108 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
5 | class Controller |
||
6 | { |
||
7 | /** |
||
8 | * @var Application |
||
9 | */ |
||
10 | protected $app; |
||
11 | |||
12 | public function __construct(Application $app) |
||
15 | } |
||
16 | |||
17 | /** |
||
18 | * @action admin_enqueue_scripts |
||
19 | * @action wp_enqueue_scripts |
||
20 | */ |
||
21 | public function enqueueAssets(): void |
||
22 | { |
||
23 | wp_enqueue_script(Application::ID, $this->app->url('assets/main.js')); |
||
24 | wp_enqueue_style(Application::ID, $this->app->url('assets/main.css'), ['dashicons']); |
||
25 | wp_enqueue_style(Application::ID.'-syntax', $this->app->url('assets/syntax.css')); |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @param string $classes |
||
30 | * @action admin_body_class |
||
31 | */ |
||
32 | public function filterBodyClasses($classes): string |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * @action all |
||
39 | */ |
||
40 | public function initActions(): void |
||
44 | } |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @action all |
||
49 | */ |
||
50 | public function initConsole(): void |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * @action all |
||
69 | */ |
||
70 | public function initProfiler(): void |
||
71 | { |
||
72 | $hook = func_get_arg(0); |
||
73 | $name = func_num_args() > 1 ? func_get_arg(1) : 'Timer'; |
||
74 | $microtime = microtime(true); |
||
75 | if ('timer:start' === $hook) { |
||
76 | $this->app->profiler->start($name); |
||
77 | } elseif ('timer:stop' === $hook) { |
||
78 | $this->app->profiler->stop($name); |
||
79 | } elseif ('blackbar/profiler/noise' === $hook) { |
||
80 | $this->app->profiler->setNoise($microtime); |
||
1 ignored issue
–
show
|
|||
81 | } elseif ('blackbar/profiler/start' === $hook) { |
||
82 | $this->app->profiler->setStart($microtime); |
||
1 ignored issue
–
show
|
|||
83 | } elseif ('blackbar/profiler/stop' === $hook) { |
||
84 | $this->app->profiler->setStop($microtime); |
||
1 ignored issue
–
show
|
|||
85 | } |
||
86 | } |
||
87 | |||
88 | /** |
||
89 | * @action plugins_loaded |
||
90 | */ |
||
91 | public function registerLanguages(): void |
||
95 | ); |
||
96 | } |
||
97 | |||
98 | /** |
||
99 | * @action admin_footer |
||
100 | * @action wp_footer |
||
101 | */ |
||
102 | public function renderBar(): void |
||
117 |