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.

Setup::database()   A
last analyzed

Complexity

Conditions 6
Paths 3

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
nc 3
nop 1
dl 0
loc 16
rs 9.1111
c 0
b 0
f 0
1
<?php
2
3
namespace App;
4
5
/**
6
 * Setup Class.
7
 *
8
 * @author Vijay Mahrra <[email protected]>
9
 * @copyright (c) Copyright 2016 Vijay Mahrra
10
 * @license GPLv3 (http://www.gnu.org/licenses/gpl-3.0.html)
11
 */
12
class Setup
13
{
14
15
    /**
16
     * setup database
17
     *
18
     * @param \Dice\Dice dependency injector
19
     * @param \Dice\Dice $dice
20
     * @return void
21
     */
22
    public static function database(&$dice)
23
    {
24
        $f3 = \Base::instance();
25
        $cache = \Cache::instance();
26
        // cli mode will not use cache on cli and will check db every time if in dev mode
27
        if ($f3->get('db.create') && (!$cache->exists('tables', $tables) || PHP_SAPI == 'cli' || 'dev' == $f3->get('app.env'))) {
28
            $db = $dice->create('DB\\SQL');
29
            $tables = $db->exec('SHOW TABLES');
30
            if (empty($tables)) {
31
                $sql = $f3->get('HOMEDIR') . '/data/db/sql/create.sql';
32
                $db->exec(file_get_contents($sql));
33
                $tables = $db->exec('SHOW TABLES');
34
            }
35
            $cache->set('tables', $tables, 600);
36
        }
37
    }
38
}
39