GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

App.php ➔ __autoload()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Kotori.php
4
 *
5
 * A Tiny Model-View-Controller PHP Framework
6
 *
7
 * This content is released under the Apache 2 License
8
 *
9
 * Copyright (c) 2015-2017 Kotori Technology. All rights reserved.
10
 *
11
 * Licensed under the Apache License, Version 2.0 (the "License");
12
 * you may not use this file except in compliance with the License.
13
 * You may obtain a copy of the License at
14
 *
15
 *     http://www.apache.org/licenses/LICENSE-2.0
16
 *
17
 * Unless required by applicable law or agreed to in writing, software
18
 * distributed under the License is distributed on an "AS IS" BASIS,
19
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
 * See the License for the specific language governing permissions and
21
 * limitations under the License.
22
 */
23
24
/**
25
 * Kotori Initialization Class
26
 *
27
 * Loads the base classes and executes the request.
28
 *
29
 * @package     Kotori
30
 * @subpackage  Kotori
31
 * @author      Kokororin
32
 * @link        https://kotori.love
33
 */
34
namespace Kotori;
35
36
use Kotori\Core\Container;
37
use Kotori\Core\Helper;
38
use Kotori\Core\Middleware;
39
40
class App
41
{
42
    /**
43
     * Config Array
44
     *
45
     * @var array
46
     */
47
    protected $config = [];
48
49
    /**
50
     * Class constructor
51
     *
52
     * Initialize Framework.
53
     *
54
     * @param  array $config
55
     */
56 1
    public function __construct($config = [])
57
    {
58 1
        if (version_compare(PHP_VERSION, '5.5.0', '<')) {
59
            exit('Kotori.php requires PHP >= 5.5.0 !');
0 ignored issues
show
Coding Style Compatibility introduced by
The method __construct() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
60
        }
61
62 1
        ini_set('display_errors', 'off');
63 1
        define('KOTORI_START_TIME', microtime(true));
64 1
        define('KOTORI_START_MEMORY', memory_get_usage());
65 1
        if (!empty($config)) {
66
            $this->config = $config;
67
        }
68 1
    }
69
70
    /**
71
     * Start the App.
72
     *
73
     * @return void
74
     */
75
    public function run()
76
    {
77
        // Define a custom error handler so we can log PHP errors
78
        set_error_handler([\Kotori\Core\Handle::class, 'error']);
79
        set_exception_handler([\Kotori\Core\Handle::class, 'exception']);
80
        register_shutdown_function([\Kotori\Core\Handle::class, 'end']);
81
82
        Container::get('config')->initialize($this->config);
83
        Middleware::register('before_app');
84
85
        ini_set('date.timezone', Container::get('config')->get('time_zone'));
86
87
        // Load application's common functions
88
        Helper::import(Container::get('config')->get('app_full_path') . '/common.php');
89
90
        // @codingStandardsIgnoreStart
91
        if (function_exists('spl_autoload_register')) {
92
            spl_autoload_register(['\\Kotori\\Core\\Helper', 'autoload']);
93
        } else {
94
            function __autoload($className)
95
            {
96
                Helper::autoload($className);
97
            }
98
        }
99
        // @codingStandardsIgnoreEnd
100
101
        // Init session
102
        Container::get('request')->sessionInit();
103
104
        Middleware::register('after_app');
105
        // Load route class
106
        Container::get('route')->dispatch();
107
    }
108
}
109