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.
Completed
Push — master ( 859d66...4f628a )
by やかみ
01:26
created

src/App.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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