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 ( ee2d44...c597f0 )
by やかみ
03:11
created

App   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 27.27%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 69
ccs 6
cts 22
cp 0.2727
rs 10
wmc 5
lcom 1
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A hp ➔ __autoload() 0 4 1
A __construct() 0 13 3
B run() 0 32 2
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\Helper;
37
use Kotori\Facade\Config;
38
use Kotori\Facade\Route;
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
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
55
     */
56 1
    public function __construct($config = [])
57
    {
58 1
        if (version_compare(PHP_VERSION, '7.0.0', '<')) {
59
            exit('Kotori.php requires PHP >= 7.0.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
        // ini_set('display_errors', 'off');
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

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.

Loading history...
63 1
        define('START_TIME', microtime(true));
64 1
        define('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', 'error']);
79
        set_exception_handler(['\\Kotori\Core\Handle', 'exception']);
80
        register_shutdown_function(['\\Kotori\Core\Handle', 'end']);
81
82
        Config::initialize($this->_config);
83
84
        ini_set('date.timezone', Config::get('TIME_ZONE'));
85
86
        if (Config::get('USE_SESSION')) {
87
            !session_id() && session_start();
88
        }
89
90
        // Load application's common functions
91
        Helper::import(Config::get('APP_FULL_PATH') . '/common.php');
92
93
        // @codingStandardsIgnoreStart
94
        if (function_exists('spl_autoload_register')) {
95
            spl_autoload_register(['\\Kotori\\Core\\Helper', 'autoload']);
96
        } else {
97
            function __autoload($className)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
98
            {
99
                Helper::autoload($className);
100
            }
101
        }
102
        // @codingStandardsIgnoreEnd
103
104
        // Load route class
105
        Route::dispatch();
106
    }
107
108
}
109