Passed
Push — master ( 76bdd0...32d694 )
by Gaetano
18:32
created

AdminerCustomization::name()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
require dirname(dirname(__DIR__)).'/vendor/autoload.php';
4
5
function buildServerList()
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function buildServerList()
Loading history...
6
{
7
    // Avoid bootstrapping Symfony for something so trivial...
8
    $config = \Symfony\Component\Yaml\Yaml::parseFile(dirname(dirname(__DIR__)).'/config/services.yaml');
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Yaml\Yaml 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...
9
    $servers = [];
10
    foreach($config['parameters']['db3v4l.database_instances'] as $instance => $def) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
11
        $servers[$instance] = new AdminerLoginServerEnhanced(
0 ignored issues
show
Bug introduced by
The type AdminerLoginServerEnhanced 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...
12
            (
13
                $def['vendor'] == 'oracle' ?
14
                ('//'.$def['host'].':'.$def['port'].'/'.$def['servicename']) :
15
                ($def['host'].':'.$def['port'])
16
            ),
17
            $def['vendor'].' '.$def['version'],
18
            str_replace(
19
                array('mariadb', 'mysql', 'postgresql'),
20
                array('server', 'server', 'pgsql'),
21
                $def['vendor']
22
            )
23
        );
24
    }
25
    return $servers;
26
}
27
28
function adminer_object()
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function adminer_object()
Loading history...
Coding Style introduced by
Function name "adminer_object" is prefixed with a package name but does not begin with a capital letter
Loading history...
Coding Style introduced by
Function name "adminer_object" is invalid; consider "Adminer_object" instead
Loading history...
29
{
30
    $pluginsDir = dirname(__DIR__).'/adminer/plugins/';
31
32
    // required to run any plugin
33
    include_once "$pluginsDir/plugin.php";
34
35
    // autoloader
36
    foreach (glob("$pluginsDir/*.php") as $filename) {
37
        include_once "$filename";
38
    }
39
40
    // enable plugins
41
    $plugins = array(
42
        new AdminerLoginServersEnhanced(buildServerList())
0 ignored issues
show
Bug introduced by
The type AdminerLoginServersEnhanced 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...
43
    );
44
45
    // customizations
46
    class AdminerCustomization extends AdminerPlugin
0 ignored issues
show
Bug introduced by
The type AdminerPlugin 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...
Coding Style introduced by
You must use "/**" style comments for a class comment
Loading history...
47
    {
48
        function name() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Coding Style introduced by
Missing doc comment for function name()
Loading history...
Coding Style introduced by
Opening brace should be on a new line
Loading history...
49
            // custom name in title and heading
50
            return 'DB-3v4l Admin';
51
        }
52
        function csp() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Coding Style introduced by
Missing doc comment for function csp()
Loading history...
Coding Style introduced by
Opening brace should be on a new line
Loading history...
53
            return array(
54
                array(
55
                    //"script-src" => "'self' 'unsafe-inline' 'nonce-" . get_nonce() . "' 'strict-dynamic'", // 'self' is a fallback for browsers not supporting 'strict-dynamic', 'unsafe-inline' is a fallback for browsers not supporting 'nonce-'
56
                    "connect-src" => "'self'",
57
                    "frame-src" => "https://www.adminer.org",
58
                    "object-src" => "'none'",
59
                    "base-uri" => "'none'",
60
                    "form-action" => "'self'",
61
                ),
62
            );
63
        }
64
    }
65
66
    return new AdminerCustomization($plugins);
67
}
68
69
require dirname(__DIR__).'/adminer/adminer.php';
70