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.

DatabaseLog::logDeprecated()   A
last analyzed

Complexity

Conditions 2
Paths 3

Size

Total Lines 33

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 9.392
c 0
b 0
f 0
cc 2
nc 3
nop 5
1
<?php declare (strict_types=1);
2
/**
3
 * @license MIT
4
 * @author Samuel Adeshina <[email protected]>
5
 *
6
 * This file is part of the EmmetBlue project, please read the license document
7
 * available in the root level of the project
8
 */
9
namespace EmmetBlue\Core\Logger;
10
11
use EmmetBlue\Core\Builder\BuilderFactory as Builder;
12
use EmmetBlue\Core\Factory\DatabaseConnectionFactory as DBConnectionFactory;
13
use EmmetBlue\Core\Builder\QueryBuilder\QueryBuilder as QB;
14
use EmmetBlue\Core\Exception\SQLException;
15
16
/**
17
 * Class DatabaseLog
18
 *
19
 * @author Samuel Adeshina <[email protected]>
20
 *
21
 * @since v0.0.1 08/06/2016 14:20
22
 */
23
class DatabaseLog implements LogInterface
24
{
25
    public static function logDeprecated(string $databaseUserId, string $event, string $objectSchema, string $object, string $tSql)
26
    {
27
        $insertBuilder = (new Builder("QueryBuilder", "Insert"))->getBuilder();
28
        try {
29
            $insertBuilder
30
                ->into('
31
                    [Logs].[DatabaseLog]
32
                    (
33
                        PostTime,
34
                        DatabaseUserId,
35
                        Event,
36
                        ObjectSchema,
37
                        Object,
38
                        TSQL
39
                    )
40
                ')
41
                ->values([
42
                    'GETDATE()',
43
                    QB::wrapString($databaseUserId, "'"),
44
                    QB::wrapString((string)$event, "'"),
45
                    QB::wrapString($objectSchema, "'"),
46
                    QB::wrapString($object, "'"),
47
                    QB::wrapString(str_replace("'", "\"", $tSql), "'")
48
                ]);
49
            
50
            DBConnectionFactory::getConnection()->query((string)$insertBuilder);
51
        } catch (\PDOException $e) {
52
            echo $e->getMessage();
53
            throw new SQLException(sprintf(
54
                    "Unable to store database log"
55
                ), 1);
56
        }
57
    }
58
59
    public static function log(string $databaseUserId, string $event, string $objectSchema, string $object, string $tSql){
0 ignored issues
show
Unused Code introduced by
The parameter $databaseUserId is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $event is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $objectSchema is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $object is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $tSql is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
60
61
    }
62
}
63