Passed
Pull Request — master (#1198)
by
unknown
08:15
created
controller/EntityController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
         $baseurl = $this->getBaseHref();
17 17
         $vocid = $vocab->getId();
18 18
         $query = http_build_query(array('uri'=>$uri, 'format'=>$targetFormat));
19
-        $url = $baseurl . "rest/v1/$vocid/data?$query";
19
+        $url = $baseurl."rest/v1/$vocid/data?$query";
20 20
         $this->redirect303($url);
21 21
     }
22 22
 
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
27 27
         $localname = $vocab->getLocalName($uri);
28 28
 
29 29
         if (!$localname) {
30
-            $url = $baseurl . "$vocid/";
30
+            $url = $baseurl."$vocid/";
31 31
         } else {
32 32
 
33 33
    	        if ($localname !== $uri && $localname === urlencode($localname)) {
34 34
    	        // the URI can be shortened
35
-            $url = $baseurl . "$vocid/page/$localname";
35
+            $url = $baseurl."$vocid/page/$localname";
36 36
             } else {
37 37
                 // must use full URI
38 38
    	            $query = http_build_query(array('uri'=>$uri));
39
-                $url = $baseurl . "$vocid/page/?" . $query;
39
+                $url = $baseurl."$vocid/page/?".$query;
40 40
 	        }
41 41
         }
42 42
         $this->redirect303($url);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             // guess vocabulary based on URI
58 58
             $vocab = $this->model->guessVocabularyFromURI($request->getUri());
59 59
             if ($vocab === null) {
60
-                return $this->returnError('404', 'Not Found', 'Unrecognized URI ' . $request->getUri());
60
+                return $this->returnError('404', 'Not Found', 'Unrecognized URI '.$request->getUri());
61 61
             }
62 62
             $request->setVocab($vocab->getId());
63 63
         }
Please login to merge, or discard this patch.
model/GlobalConfig.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,17 +28,17 @@  discard block
 block discarded – undo
28 28
      */
29 29
     private $configModifiedTime = null;
30 30
 
31
-    public function __construct($config_name='/../config.ttl')
31
+    public function __construct($config_name = '/../config.ttl')
32 32
     {
33 33
         $this->cache = new Cache();
34 34
         try {
35
-            $this->filePath = realpath( dirname(__FILE__) . $config_name );
35
+            $this->filePath = realpath(dirname(__FILE__).$config_name);
36 36
             if (!file_exists($this->filePath)) {
37 37
                 throw new Exception('config.ttl file is missing, please provide one.');
38 38
             }
39 39
             $this->initializeConfig();
40 40
         } catch (Exception $e) {
41
-            echo "Error: " . $e->getMessage();
41
+            echo "Error: ".$e->getMessage();
42 42
             return;
43 43
         }
44 44
     }
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
             // use APC user cache to store parsed config.ttl configuration
73 73
             if ($this->cache->isAvailable() && !is_null($this->configModifiedTime)) {
74 74
                 // @codeCoverageIgnoreStart
75
-                $key = realpath($this->filePath) . ", " . $this->configModifiedTime;
76
-                $nskey = "namespaces of " . $key;
75
+                $key = realpath($this->filePath).", ".$this->configModifiedTime;
76
+                $nskey = "namespaces of ".$key;
77 77
                 $this->graph = $this->cache->fetch($key);
78 78
                 $this->namespaces = $this->cache->fetch($nskey);
79 79
                 if ($this->graph === false || $this->namespaces === false) { // was not found in cache
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
             $this->resource = $configResources[0];
95 95
             $this->initializeNamespaces();
96 96
         } catch (Exception $e) {
97
-            echo "Error: " . $e->getMessage();
97
+            echo "Error: ".$e->getMessage();
98 98
         }      
99 99
     }
100 100
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
     public function getGlobalPlugins()
325 325
     {
326 326
         $globalPlugins = array();
327
-        $globalPluginsResource =  $this->getResource()->getResource("skosmos:globalPlugins");
327
+        $globalPluginsResource = $this->getResource()->getResource("skosmos:globalPlugins");
328 328
         if ($globalPluginsResource) {
329 329
             foreach ($globalPluginsResource as $resource) {
330 330
                 $globalPlugins[] = $resource->getValue();
Please login to merge, or discard this patch.
model/ConceptPropertyValue.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $label = is_string($this->getLabel()) ? $this->getLabel() : $this->getLabel()->getValue();
26 26
         if ($this->vocab->getConfig()->sortByNotation()) {
27
-            $label = ltrim($this->getNotation() . ' ') . $label;
27
+            $label = ltrim($this->getNotation().' ').$label;
28 28
         }
29 29
 
30 30
         return $label;
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
                 }
48 48
                 // We need to check all the labels in case one of them matches a subtag of the current language
49 49
                 if ($this->resource->allLiterals('skos:prefLabel')) {
50
-                    foreach($this->resource->allLiterals('skos:prefLabel') as $label) {
50
+                    foreach ($this->resource->allLiterals('skos:prefLabel') as $label) {
51 51
                         // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language
52
-                        if ($label !== null && strpos($label->getLang(), $fallback . '-') === 0) {
52
+                        if ($label !== null && strpos($label->getLang(), $fallback.'-') === 0) {
53 53
                             return EasyRdf\Literal::create($label, $fallback);
54 54
                         }
55 55
                     }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     public function getReifiedPropertyValues() {
142 142
         $ret = array();
143 143
         $props = $this->resource->propertyUris();
144
-        foreach($props as $prop) {
144
+        foreach ($props as $prop) {
145 145
             $prop = (EasyRdf\RdfNamespace::shorten($prop) !== null) ? EasyRdf\RdfNamespace::shorten($prop) : $prop;
146 146
             foreach ($this->resource->allLiterals($prop) as $val) {
147 147
                 if ($prop !== 'rdf:value') { // shown elsewhere
Please login to merge, or discard this patch.
model/resolver/LOCResource.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
             $opts = array('http' => array('method'=>'HEAD',
14 14
                                           'user_agent' => 'Skosmos',
15 15
                                           'timeout' => $timeout));
16
-            $context  = stream_context_create($opts);
16
+            $context = stream_context_create($opts);
17 17
             $fd = fopen($this->uri, 'rb', false, $context);
18 18
             $headers = stream_get_meta_data($fd)['wrapper_data'];
19 19
             foreach ($headers as $header) {
Please login to merge, or discard this patch.
model/sparql/JenaTextSparql.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         // 1. Ensure characters with special meaning in Lucene are escaped
42 42
         $lucenemap = array();
43 43
         foreach (str_split(self::LUCENE_ESCAPE_CHARS) as $char) {
44
-            $lucenemap[$char] = '\\' . $char; // escape with a backslash
44
+            $lucenemap[$char] = '\\'.$char; // escape with a backslash
45 45
         }
46 46
         $term = strtr($term, $lucenemap);
47 47
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      * @return string sparql order by clause
93 93
      */
94 94
     private function formatOrderBy($expression, $lang) {
95
-        if(!$this->model->getConfig()->getCollationEnabled()) {
95
+        if (!$this->model->getConfig()->getCollationEnabled()) {
96 96
             return $expression;
97 97
         }
98 98
         $orderby = sprintf('arq:collation(\'%2$s\', %1$s)', $expression, $lang);
@@ -126,15 +126,15 @@  discard block
 block discarded – undo
126 126
         # make text query clause
127 127
         $lcletter = mb_strtolower($letter, 'UTF-8'); // convert to lower case, UTF-8 safe
128 128
         $langClause = $this->generateLangClause($lang);
129
-        $textcondPref = $this->createTextQueryCondition($letter . '*', 'skos:prefLabel', $langClause);
130
-        $textcondAlt = $this->createTextQueryCondition($letter . '*', 'skos:altLabel', $langClause);
131
-        $orderbyclause = $this->formatOrderBy("LCASE(?match)", $lang) . " STR(?s) LCASE(STR(?qualifier))";
129
+        $textcondPref = $this->createTextQueryCondition($letter.'*', 'skos:prefLabel', $langClause);
130
+        $textcondAlt = $this->createTextQueryCondition($letter.'*', 'skos:altLabel', $langClause);
131
+        $orderbyclause = $this->formatOrderBy("LCASE(?match)", $lang)." STR(?s) LCASE(STR(?qualifier))";
132 132
 
133
-        $qualifierClause = $qualifier ? "OPTIONAL { ?s <" . $qualifier->getURI() . "> ?qualifier }" : "";
133
+        $qualifierClause = $qualifier ? "OPTIONAL { ?s <".$qualifier->getURI()."> ?qualifier }" : "";
134 134
 
135
-        $filterDeprecated="";
136
-        if(!$showDeprecated){
137
-            $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }";
135
+        $filterDeprecated = "";
136
+        if (!$showDeprecated) {
137
+            $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }";
138 138
         }
139 139
 
140 140
         $query = <<<EOQ
Please login to merge, or discard this patch.
controller/Controller.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -156,18 +156,18 @@  discard block
 block discarded – undo
156 156
         $localname = $vocab->getLocalName($uri);
157 157
         if ($localname !== $uri && $localname === urlencode($localname)) {
158 158
             // check that the prefix stripping worked, and there are no problematic chars in localname
159
-            $paramstr = count($params) > 0 ? '?' . http_build_query($params) : '';
159
+            $paramstr = count($params) > 0 ? '?'.http_build_query($params) : '';
160 160
             if ($type && $type !== '' && $type !== 'vocab' && !($localname === '' && $type === 'page')) {
161
-                return "$vocid/$lang/$type/$localname" . $paramstr;
161
+                return "$vocid/$lang/$type/$localname".$paramstr;
162 162
             }
163 163
 
164
-            return "$vocid/$lang/$localname" . $paramstr;
164
+            return "$vocid/$lang/$localname".$paramstr;
165 165
         }
166 166
 
167 167
         // case 2: URI outside vocabulary namespace, or has problematic chars
168 168
         // pass the full URI as parameter instead
169 169
         $params['uri'] = $uri;
170
-        return "$vocid/$lang/$type/?" . http_build_query($params);
170
+        return "$vocid/$lang/$type/?".http_build_query($params);
171 171
     }
172 172
 
173 173
     /**
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     {
294 294
         if ($modifiedDate) {
295 295
             $ifModifiedSince = $this->getIfModifiedSince();
296
-            $this->sendHeader("Last-Modified: " . $modifiedDate->format('D, d M Y H:i:s \G\M\T'));
296
+            $this->sendHeader("Last-Modified: ".$modifiedDate->format('D, d M Y H:i:s \G\M\T'));
297 297
             if ($ifModifiedSince !== null && $ifModifiedSince >= $modifiedDate) {
298 298
                 $this->sendHeader("HTTP/1.0 304 Not Modified");
299 299
                 return true;
Please login to merge, or discard this patch.
model/VocabularyConfig.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     "skos:related", "skos:historyNote", "skosmos:memberOf",
29 29
     "skosmos:memberOfArray");
30 30
 
31
-    public function __construct($resource, $globalPlugins=array())
31
+    public function __construct($resource, $globalPlugins = array())
32 32
     {
33 33
         $this->resource = $resource;
34 34
         $plugins = $this->resource->allLiterals('skosmos:usePlugin');
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
                         $paramValue = $paramLiteral->getValue();
57 57
                         $paramLang = $paramLiteral->getLang();
58 58
                         if ($paramLang) {
59
-                            $paramName .= '_' . $paramLang;
59
+                            $paramName .= '_'.$paramLang;
60 60
                         }
61 61
                         $this->pluginParameters[$pluginName][$paramName] = $paramValue;
62 62
                     }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         $langs = $this->getLanguages();
84 84
         $deflang = reset($langs); // picking the first one from the list with reset since the keys are not numeric
85 85
         if (sizeof($langs) > 1) {
86
-            trigger_error("Default language for vocabulary '" . $this->getShortName() . "' unknown, choosing '$deflang'.", E_USER_WARNING);
86
+            trigger_error("Default language for vocabulary '".$this->getShortName()."' unknown, choosing '$deflang'.", E_USER_WARNING);
87 87
         }
88 88
 
89 89
         return $deflang;
Please login to merge, or discard this patch.
model/ConceptProperty.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      * @param string $super URI of superproperty
28 28
      * @param boolean $sort_by_notation whether to sort the property values by their notation code
29 29
      */
30
-    public function __construct($prop, $label, $tooltip=null, $super=null, $sort_by_notation=false)
30
+    public function __construct($prop, $label, $tooltip = null, $super = null, $sort_by_notation = false)
31 31
     {
32 32
         $this->prop = $prop;
33 33
         $this->label = $label;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function getDescription()
69 69
     {
70
-        $helpprop = $this->prop . "_help";
70
+        $helpprop = $this->prop."_help";
71 71
 
72 72
         // see if we have a translation with the help text
73 73
         $help = gettext($helpprop);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
     public function addValue($value)
100 100
     {
101
-        $this->values[ltrim($value->getNotation() . ' ') . $value->getLabel() . rtrim(' ' . $value->getUri())] = $value;
101
+        $this->values[ltrim($value->getNotation().' ').$value->getLabel().rtrim(' '.$value->getUri())] = $value;
102 102
         $this->is_sorted = false;
103 103
     }
104 104
 
Please login to merge, or discard this patch.
model/ConceptMappingPropertyValue.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         $label = $this->getLabel();
38 38
         $notation = $this->getNotation();
39
-        return ltrim($notation . ' ') . $label;
39
+        return ltrim($notation.' ').$label;
40 40
     }
41 41
 
42 42
     public function getType()
@@ -180,25 +180,25 @@  discard block
 block discarded – undo
180 180
             'from' => [
181 181
                 'memberSet' => [
182 182
                     [
183
-                        'uri' => (string) $this->source->getUri(),
183
+                        'uri' => (string)$this->source->getUri(),
184 184
                     ]
185 185
                 ]
186 186
             ],
187 187
             'to' => [
188 188
                 'memberSet' => [
189 189
                     [
190
-                        'uri' => (string) $this->getUri()
190
+                        'uri' => (string)$this->getUri()
191 191
                     ]
192 192
                 ]
193 193
             ],
194 194
             // EXTRA
195 195
             'hrefLink' => $hrefLink, // link to resource as displayed in the UI
196 196
             'lang' => $propertyLang, // TBD: could it be part of the prefLabel?
197
-            'vocabName' => (string) $this->getVocabName(), // vocabulary as displayed in the UI
197
+            'vocabName' => (string)$this->getVocabName(), // vocabulary as displayed in the UI
198 198
             'typeLabel' => gettext($this->type), // a text used in the UI instead of, for example, skos:closeMatch
199 199
         ];
200 200
 
201
-        $helpprop = $this->type . "_help";
201
+        $helpprop = $this->type."_help";
202 202
         // see if we have a translation for the property help text
203 203
         $help = gettext($helpprop);
204 204
         if ($help != $helpprop) {
@@ -208,20 +208,20 @@  discard block
 block discarded – undo
208 208
         $fromScheme = $this->vocab->getDefaultConceptScheme();
209 209
         if (isset($fromScheme)) {
210 210
             $ret['fromScheme'] = [
211
-                'uri' => (string) $fromScheme,
211
+                'uri' => (string)$fromScheme,
212 212
             ];
213 213
         }
214 214
 
215 215
         $exvocab = $this->getExvocab();
216 216
         if (isset($exvocab)) {
217 217
             $ret['toScheme'] = [
218
-                'uri' => (string) $exvocab->getDefaultConceptScheme(),
218
+                'uri' => (string)$exvocab->getDefaultConceptScheme(),
219 219
             ];
220 220
         }
221 221
 
222 222
         $notation = $this->getNotation();
223 223
         if (isset($notation)) {
224
-            $ret['to']['memberSet'][0]['notation'] = (string) $notation;
224
+            $ret['to']['memberSet'][0]['notation'] = (string)$notation;
225 225
         }
226 226
 
227 227
         $label = $this->getLabel($lang, $queryExVocabs);
Please login to merge, or discard this patch.