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.

DB::__construct()   A
last analyzed

Complexity

Conditions 5
Paths 16

Size

Total Lines 28

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
nc 16
nop 3
dl 0
loc 28
rs 9.1608
c 0
b 0
f 0
1
<?php
2
3
namespace App\Models;
4
5
/**
6
 * Base Database Class
7
 *
8
 * @author Vijay Mahrra <[email protected]>
9
 * @copyright (c) Copyright 2015 Vijay Mahrra
10
 * @license GPLv3 (http://www.gnu.org/licenses/gpl-3.0.html)
11
 * @see https://fatfreeframework.com/sql
12
 */
13
abstract class DB extends Base
14
{
15
    /**
16
     * @var \DB\SQL database class
17
     */
18
    public $db;
19
20
    /**
21
     * @var string table in the db
22
     */
23
    public $table;
24
25
    /**
26
     * initialize with array of params, 'db' and 'logger' can be injected
27
     *
28
     * @param null|\Log $logger
29
     * @param null|\DB\SQL $db
30
     */
31
    public function __construct(array $params = [], \Log $logger = null, \DB\SQL $db = null)
32
    {
33
        $f3 = \Base::instance();
34
35
        if (is_object($logger)) {
36
            \Registry::set('logger', $logger);
37
        }
38
        $this->logObject = \Registry::get('logger');
39
40
        if (is_object($db)) {
41
            \Registry::set('db', $db);
42
        }
43
        $this->db = \Registry::get('db');
44
45
        // guess the table name from the class name if not specified as a class member
46
        $class = strrchr(get_class($this), '\\');
47
        $class = \UTF::instance()->substr($class, 1);
48
        if (empty($this->table)) {
49
            $table = $f3->snakecase($class);
50
        } else {
51
            $table = $this->table;
52
        }
53
        $this->table = $table;
54
55
        foreach ($params as $k => $v) {
56
            $this->$k = $v;
57
        }
58
    }
59
}
60