Sqlite   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A connect() 0 17 1
1
<?php
2
namespace WebStream\Database\Driver;
3
4
use Doctrine\DBAL\Configuration;
0 ignored issues
show
Bug introduced by
The type Doctrine\DBAL\Configuration was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
5
use Doctrine\DBAL\DriverManager;
0 ignored issues
show
Bug introduced by
The type Doctrine\DBAL\DriverManager was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
/**
8
 * Sqlite
9
 * @author Ryuichi TANAKA.
10
 * @since 2013/12/07
11
 * @version 0.4
12
 */
13
class Sqlite extends DatabaseDriver
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function connect()
19
    {
20
        $params = [
21
            'path'     => $this->config->dbfile,
0 ignored issues
show
Bug Best Practice introduced by
The property dbfile does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
22
            'user'     => $this->config->username,
0 ignored issues
show
Bug Best Practice introduced by
The property username does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
23
            'password' => $this->config->password,
0 ignored issues
show
Bug Best Practice introduced by
The property password does not exist on WebStream\Container\Container. Since you implemented __get, consider adding a @property annotation.
Loading history...
24
            'driver'   => 'pdo_sqlite',
25
            'charset'  => 'utf8'
26
        ];
27
28
        $config = new Configuration([
29
            \PDO::ATTR_PERSISTENT => true,
30
            \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION
31
        ]);
32
33
        $this->connection = DriverManager::getConnection($params, $config);
34
        $this->logger->debug(get_class($this) . " connect.");
0 ignored issues
show
Bug introduced by
The method debug() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
        $this->logger->/** @scrutinizer ignore-call */ 
35
                       debug(get_class($this) . " connect.");

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Bug Best Practice introduced by
The property logger does not exist on WebStream\Database\Driver\Sqlite. Since you implemented __get, consider adding a @property annotation.
Loading history...
35
    }
36
}
37