Completed
Push — master ( fa6f45...27cd9e )
by Daniel
02:16
created

InformatorKnownLabels::knownLabelsGlobal()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 15
rs 9.4286
cc 1
eloc 12
nc 1
nop 1
1
<?php
2
3
/*
4
 * The MIT License
5
 *
6
 * Copyright 2016 Daniel Popiniuc.
7
 *
8
 * Permission is hereby granted, free of charge, to any person obtaining a copy
9
 * of this software and associated documentation files (the "Software"), to deal
10
 * in the Software without restriction, including without limitation the rights
11
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
 * copies of the Software, and to permit persons to whom the Software is
13
 * furnished to do so, subject to the following conditions:
14
 *
15
 * The above copyright notice and this permission notice shall be included in
16
 * all copies or substantial portions of the Software.
17
 *
18
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
 * THE SOFTWARE.
25
 */
26
27
namespace danielgp\informator;
28
29
trait InformatorKnownLabels
30
{
31
32
    protected function knownLabelsForMySql()
33
    {
34
        return [
35
            'Databases All'    => ['getMySQLlistDatabases', false],
36
            'Databases Client' => ['getMySQLlistDatabases', true],
37
            'Engines Active'   => ['getMySQLlistEngines', true],
38
            'Engines All'      => ['getMySQLlistEngines', false],
39
            'General'          => ['getMySQLgenericInformations'],
40
            'Variables Global' => ['getMySQLglobalVariables'],
41
        ];
42
    }
43
44
    protected function knownLabelsForPhp()
45
    {
46
        return [
47
            'Extensions Loaded' => ['setArrayValuesAsKey', 'get_loaded_extensions'],
48
            'Stream Filters'    => ['setArrayValuesAsKey', 'stream_get_filters'],
49
            'Stream Transports' => ['setArrayValuesAsKey', 'stream_get_transports'],
50
            'Stream Wrappers'   => ['setArrayValuesAsKey', 'stream_get_wrappers'],
51
            'Temporary Folder'  => ['getTemporaryFolder'],
52
        ];
53
    }
54
55
    protected function knownLabelsGlobal($inArray)
56
    {
57
        $aReturn = [
58
            '--- List of known labels' => '',
59
            'Apache Info'              => ['getApacheDetails'],
60
            'Auto Dependencies'        => ['getPackageDetailsFromGivenComposerLockFile', $inArray['composerLockFile']],
61
            'Auto Dependencies File'   => [$inArray['composerLockFile']],
62
            'Client Info'              => ['getClientBrowserDetailsForInformator', null],
63
            'Informator File Details'  => ['getFileDetails', $inArray['informatorFile']],
64
            'Server Info'              => ['getServerDetails'],
65
            'System Info'              => ['systemInfo'],
66
            'Tomcat Info'              => ['getTomcatDetails'],
67
        ];
68
        return array_merge($aReturn, array_merge($this->subLabelsMySql(), $this->subLabelsPhp()));
69
    }
70
71
    private function subLabelsMySql()
72
    {
73
        return [
74
            'MySQL Databases All'    => ['getMySQLinfo', ['Databases All']],
75
            'MySQL Databases Client' => ['getMySQLinfo', ['Databases Client']],
76
            'MySQL Engines Active'   => ['getMySQLinfo', ['Engines Active']],
77
            'MySQL Engines All'      => ['getMySQLinfo', ['Engines All']],
78
            'MySQL General'          => ['getMySQLinfo', ['General']],
79
            'MySQL Variables Global' => ['getMySQLinfo', ['Variables Global']],
80
            'MySQL Info'             => ['getMySQLinfo', ['Engines Active', 'General', 'Variables Global']],
81
        ];
82
    }
83
84
    private function subLabelsPhp()
85
    {
86
        return [
87
            'Php Extensions Loaded' => ['getPhpDetails', ['Extensions Loaded']],
88
            'Php General'           => ['getPhpDetails', ['General']],
89
            'Php INI Settings'      => ['getPhpDetails', ['INI Settings']],
90
            'Php Stream Filters'    => ['getPhpDetails', ['Stream Filters']],
91
            'Php Stream Transports' => ['getPhpDetails', ['Stream Transports']],
92
            'Php Stream Wrappers'   => ['getPhpDetails', ['Stream Wrappers']],
93
            'Php Info'              => ['getPhpDetails'],
94
        ];
95
    }
96
}
97