1 | <?php |
||
2 | /** @var object $loader */ |
||
3 | // check if loader is initialized |
||
4 | if (!defined('root')) { |
||
5 | die('Hack attempt'); |
||
6 | } |
||
7 | |||
8 | // global environment |
||
9 | define('env_name', 'Api'); |
||
10 | // this environment have no layouts |
||
11 | define('env_no_layout', true); |
||
12 | // this environment is based on json response type |
||
13 | define('env_type', 'json'); |
||
14 | |||
15 | require_once(root . '/Loader/Autoload.php'); |
||
16 | |||
17 | // make fast-access alias \App::$Object |
||
0 ignored issues
–
show
|
|||
18 | // class_alias('Ffcms\Core\App', 'App'); |
||
19 | class App extends Ffcms\Core\App |
||
20 | { |
||
21 | } |
||
22 | /** |
||
23 | * Alias for translate function for fast usage. Example: __('Welcome my friend') |
||
24 | * @param string $text |
||
25 | * @param array $params |
||
26 | * @return string |
||
27 | */ |
||
28 | function __($text, array $params = []) |
||
29 | { |
||
30 | return \App::$Translate->translate($text, $params); |
||
31 | } |
||
32 | |||
33 | try { |
||
34 | // build app entry point factory instance |
||
35 | $app = \App::factory([ |
||
36 | 'Database' => true, |
||
37 | 'Session' => true, |
||
38 | 'Debug' => false, |
||
39 | 'User' => true, |
||
40 | 'Mailer' => true, |
||
41 | 'Captcha' => true, |
||
42 | 'Cache' => true |
||
43 | ], $loader); |
||
44 | // display output |
||
45 | $app->run(); |
||
46 | } catch (Exception $e) { |
||
47 | echo (new \Ffcms\Core\Exception\NativeException($e->getMessage()))->display(); |
||
48 | } |
||
49 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.