Completed
Push — master ( 3a9c1f...b05d7f )
by Henri
03:36
created

GlobalConfig::getSparqlGraphStore()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 7
rs 9.4286
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
class GlobalConfig {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
    private $languages;
5
6
    public function __construct($config_name=null) 
7
    {
8
        try {
9
            $file_path = dirname(__FILE__);
10
            if ($config_name !== null) {
11
                $file_path .= $config_name;
12
            } else {
13
                $file_path .= '/../config.inc';
14
            }
15
            if (!file_exists(dirname(__FILE__).'/../config.inc')) {
16
                throw new Exception('config.inc file is missing, please provide one.');
17
            }
18
            require_once($file_path);
19
            if (isset($languages)) {
0 ignored issues
show
Bug introduced by
The variable $languages seems to never exist, and therefore isset should always return false. Did you maybe rename this variable?

This check looks for calls to isset(...) or empty() on variables that are yet undefined. These calls will always produce the same result and can be removed.

This is most likely caused by the renaming of a variable or the removal of a function/method parameter.

Loading history...
20
                $this->languages = $LANGUAGES;
0 ignored issues
show
Bug introduced by
The variable $LANGUAGES does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
21
            }
22
        } catch (Exception $e) {
23
            echo "Error: " . $e->getMessage();
24
            return;
25
        }
26
    }
27
28
    public function getLanguages() 
29
    {
30
        return $this->languages;
31
    }
32
    
33
    public function getVocabularyConfigFile() 
34
    {
35
        if (defined('VOCABULARIES_FILE')) {
36
            return VOCABULARIES_FILE;
37
        }
38
        return null;
39
    }
40
    
41
    public function getHttpTimeout() 
42
    {
43
        if (defined('HTTP_TIMEOUT')) {
44
            return HTTP_TIMEOUT;
45
        }
46
        return null;
47
    }
48
    
49
    public function getDefaultEndpoint() 
50
    {
51
        if (defined('DEFAULT_ENDPOINT')) {
52
            return DEFAULT_ENDPOINT;
53
        }
54
        return null;
55
    }
56
    
57
    public function getSparqlGraphStore() 
58
    {
59
        if (defined('SPARQL_GRAPH_STORE')) {
60
            return SPARQL_GRAPH_STORE;
61
        }
62
        return null;
63
    }
64
    
65
    public function getDefaultTransitiveLimit() 
66
    {
67
        if (defined('DEFAULT_TRANSITIVE_LIMIT')) {
68
            return DEFAULT_TRANSITIVE_LIMIT;
69
        }
70
        return null;
71
    }
72
    
73
    public function getDefaultSearchLimit() 
74
    {
75
        if (defined('DEFAULT_SEARCH_LIMIT')) {
76
            return DEFAULT_SEARCH_LIMIT;
77
        }
78
        return null;
79
    }
80
    
81
    public function getTemplateCache() 
82
    {
83
        if (defined('TEMPLATE_CACHE')) {
84
            return TEMPLATE_CACHE;
85
        }
86
        return null;
87
    }
88
    
89
    public function getDefaultSparqlDialect() 
90
    {
91
        if (defined('DEFAULT_SPARQL_DIALECT')) {
92
            return DEFAULT_SPARQL_DIALECT;
93
        }
94
        return null;
95
    }
96
97
    public function getFeedbackAddress() 
98
    {
99
        if (defined('FEEDBACK_ADDRESS')) {
100
            return FEEDBACK_ADDRESS;
101
        }
102
        return null;
103
    }
104
    
105
    public function getLogCaughtExceptions() 
106
    {
107
        if (defined('LOG_CAUGHT_EXCEPTIONS')) {
108
            return LOG_CAUGHT_EXCEPTIONS;
109
        }
110
        return null;
111
    }
112
    
113
    public function getServiceName() 
114
    {
115
        if (defined('SERVICE_NAME')) {
116
            return SERVICE_NAME;
117
        }
118
        return null;
119
    }
120
    
121
    public function getServiceTagline() 
122
    {
123
        if (defined('SERVICE_TAGLINE')) {
124
            return SERVICE_TAGLINE;
125
        }
126
        return null;
127
    }
128
    
129
    public function getServiceLogo() 
130
    {
131
        if (defined('SERVICE_LOGO')) {
132
            return SERVICE_LOGO;
133
        }
134
        return null;
135
    }
136
    
137
    public function getCustomCss() 
138
    {
139
        if (defined('CUSTOM_CSS')) {
140
            return CUSTOM_CSS;
141
        }
142
        return null;
143
    }
144
    
145
    public function getUiLanguageDropdown() 
146
    {
147
        if (defined('UI_LANGUAGE_DROPDOWN')) {
148
            return UI_LANGUAGE_DROPDOWN;
149
        }
150
        return null;
151
    }
152
    
153
    public function getBaseHref() 
154
    {
155
        if (defined('BASE_HREF')) {
156
            return BASE_HREF;
157
        }
158
        return null;
159
    }
160
}
161