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 ( 152c49...9fed71 )
by やかみ
05:22
created

Logger::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
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
 * Logging Class
26
 *
27
 * @package     Kotori
28
 * @subpackage  Debug
29
 * @author      Kokororin
30
 * @link        https://kotori.love
31
 */
32
namespace Kotori\Debug;
33
34
use Kotori\Core\Container;
35
use Kotori\Core\Helper;
36
37
class Logger
38
{
39
    /**
40
     * Class constructor
41
     *
42
     * Initialize Logger.
43
     *
44
     * @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...
45
     */
46 1
    public function __construct()
47
    {
48 1
        Hook::listen(__CLASS__);
49 1
    }
50
51
    /**
52
     * Write Log File
53
     *
54
     * @param  string $msg
55
     * @param  string $level
56
     * @return void
57
     */
58 4
    public function write($msg, $level = 'APP')
59
    {
60 4
        if (!Container::get('config')->get('app_debug') && $level != 'APP') {
61 4
            return;
62
        }
63
64
        $msg = date('[Y-m-d H:i:s]') . "\r\n" . "[{$level}]" . "\r\n" . $msg . "\r\n\r\n";
65
        $logPath = Container::get('config')->get('app_full_path') . '/logs';
66
        if (!file_exists($logPath)) {
67
            Helper::mkdirs($logPath);
68
        }
69
70
        if (file_exists($logPath)) {
71
            file_put_contents($logPath . '/' . date('Ymd') . '.log', $msg, FILE_APPEND);
72
        }
73
    }
74
75
    /**
76
     * Write Normal Log
77
     *
78
     * @param string $msg
79
     */
80
    public function normal($msg)
81
    {
82
        $this->write($msg, 'NORMAL');
83
    }
84
85
    /**
86
     * Write SQL Log
87
     *
88
     * @param string $msg
89
     */
90 4
    public function sql($msg)
91
    {
92 4
        $this->write($msg, 'SQL');
93 4
    }
94
}
95