Passed
Push — issue1514-search-bar-autocompl... ( 7f9043...b871bb )
by
unknown
04:51
created
src/model/GlobalConfig.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,17 +30,17 @@  discard block
 block discarded – undo
30 30
      */
31 31
     private $configModifiedTime = null;
32 32
 
33
-    public function __construct($config_name='../../config.ttl')
33
+    public function __construct($config_name = '../../config.ttl')
34 34
     {
35 35
         $this->cache = new Cache();
36 36
         try {
37
-            $this->filePath = realpath(dirname(__FILE__) . "/" . $config_name);
37
+            $this->filePath = realpath(dirname(__FILE__)."/".$config_name);
38 38
             if (!file_exists($this->filePath)) {
39 39
                 throw new Exception('config.ttl file is missing, please provide one.');
40 40
             }
41 41
             $this->initializeConfig();
42 42
         } catch (Exception $e) {
43
-            echo "Error: " . $e->getMessage();
43
+            echo "Error: ".$e->getMessage();
44 44
             return;
45 45
         }
46 46
     }
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
             // use APC user cache to store parsed config.ttl configuration
75 75
             if ($this->cache->isAvailable() && !is_null($this->configModifiedTime)) {
76 76
                 // @codeCoverageIgnoreStart
77
-                $key = realpath($this->filePath) . ", " . $this->configModifiedTime;
78
-                $nskey = "namespaces of " . $key;
77
+                $key = realpath($this->filePath).", ".$this->configModifiedTime;
78
+                $nskey = "namespaces of ".$key;
79 79
                 $this->graph = $this->cache->fetch($key);
80 80
                 $this->namespaces = $this->cache->fetch($nskey);
81 81
                 if ($this->graph === false || $this->namespaces === false) { // was not found in cache
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             $this->resource = $configResources[0];
97 97
             $this->initializeNamespaces();
98 98
         } catch (Exception $e) {
99
-            echo "Error: " . $e->getMessage();
99
+            echo "Error: ".$e->getMessage();
100 100
         }
101 101
     }
102 102
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
     public function getGlobalPlugins()
329 329
     {
330 330
         $globalPlugins = array();
331
-        $globalPluginsResource =  $this->getResource()->getResource("skosmos:globalPlugins");
331
+        $globalPluginsResource = $this->getResource()->getResource("skosmos:globalPlugins");
332 332
         if ($globalPluginsResource) {
333 333
             foreach ($globalPluginsResource as $resource) {
334 334
                 $globalPlugins[] = $resource->getValue();
Please login to merge, or discard this patch.
src/model/ConceptPropertyValueLiteral.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
                 return Punic\Calendar::formatDate($val, 'short');
70 70
             } catch (Exception $e) {
71 71
                 trigger_error($e->getMessage(), E_USER_WARNING);
72
-                return (string) $this->literal;
72
+                return (string)$this->literal;
73 73
             }
74 74
         }
75 75
         return $this->literal->getValue();
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     {
97 97
         $graph = $this->resource->getGraph();
98 98
         $labelResources = $graph->resourcesMatching('skosxl:literalForm', $this->literal);
99
-        foreach($labelResources as $labres) {
99
+        foreach ($labelResources as $labres) {
100 100
             return new LabelSkosXL($this->model, $labres);
101 101
         }
102 102
         return null;
Please login to merge, or discard this patch.
src/model/ConceptSearchParameters.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
         if ($this->rest) {
76 76
             return $term;
77 77
         }
78
-        return strpos($term, "*") === false ? $term . "*" : $term; // default to prefix search
78
+        return strpos($term, "*") === false ? $term."*" : $term; // default to prefix search
79 79
     }
80 80
 
81 81
     public function getContentLang()
Please login to merge, or discard this patch.
src/model/LabelSkosXL.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
     {
12 12
         $label = null;
13 13
         $labels = $this->resource->allResources('skosxl:prefLabel');
14
-        foreach($labels as $labres) {
14
+        foreach ($labels as $labres) {
15 15
             $label = $labres->getLiteral('skosxl:literalForm');
16 16
             if ($label->getLang() == $this->clang) {
17 17
                 return $label;
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $ret = array();
26 26
         $props = $this->resource->properties();
27
-        foreach($props as $prop) {
27
+        foreach ($props as $prop) {
28 28
             if ($prop !== 'rdf:type' && $prop !== 'skosxl:literalForm') {
29 29
                 // make sure to use the correct gettext keys for DC namespace
30 30
                 $propkey = str_starts_with($prop, 'dc11:') ?
Please login to merge, or discard this patch.
src/model/Request.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 
170 170
     public function getRequestUri()
171 171
     {
172
-        return $this->getServerConstant('HTTP_HOST') . $this->getServerConstant('REQUEST_URI');
172
+        return $this->getServerConstant('HTTP_HOST').$this->getServerConstant('REQUEST_URI');
173 173
     }
174 174
 
175 175
     /**
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      * @param string $newlang new UI language to set
178 178
      * @return string the relative url of the page
179 179
      */
180
-    public function getLangUrl($newlang=null)
180
+    public function getLangUrl($newlang = null)
181 181
     {
182 182
         $script_name = str_replace('/index.php', '', $this->getServerConstant('SCRIPT_NAME'));
183 183
         $langurl = substr(str_replace($script_name, '', strval($this->getServerConstant('REQUEST_URI'))), 1);
Please login to merge, or discard this patch.
src/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.
src/model/PluginRegister.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
     private $requestedPlugins;
6 6
     private $pluginOrder;
7 7
 
8
-    public function __construct($requestedPlugins=array())
8
+    public function __construct($requestedPlugins = array())
9 9
     {
10 10
         $this->requestedPlugins = $requestedPlugins;
11 11
         $this->pluginOrder = array();
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      * @param boolean $raw interpret $type values as raw text instead of files
50 50
      * @return array
51 51
      */
52
-    private function filterPlugins($type, $raw=false)
52
+    private function filterPlugins($type, $raw = false)
53 53
     {
54 54
         $plugins = $this->getPlugins();
55 55
         $plugins = $this->sortPlugins($plugins);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                         $ret[$name] = $files[$type];
63 63
                     } else {
64 64
                         foreach ($files[$type] as $file) {
65
-                            array_push($ret[$name], 'plugins/' . $name . '/' . $file);
65
+                            array_push($ret[$name], 'plugins/'.$name.'/'.$file);
66 66
                         }
67 67
                     }
68 68
                 }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      * @param array $names the plugin name strings (foldernames) in an array
95 95
      * @return array
96 96
      */
97
-    public function getPluginsJS($names=null)
97
+    public function getPluginsJS($names = null)
98 98
     {
99 99
         if ($names) {
100 100
             $names = array_merge($this->requestedPlugins, $names);
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      * @param array $names the plugin name strings (foldernames) in an array
109 109
      * @return array
110 110
      */
111
-    public function getPluginsCSS($names=null)
111
+    public function getPluginsCSS($names = null)
112 112
     {
113 113
         if ($names) {
114 114
             $names = array_merge($this->requestedPlugins, $names);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      * @param array $names the plugin name strings (foldernames) in an array
123 123
      * @return array
124 124
      */
125
-    public function getPluginsTemplates($names=null)
125
+    public function getPluginsTemplates($names = null)
126 126
     {
127 127
         if ($names) {
128 128
             $names = array_merge($this->requestedPlugins, $names);
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      * @param array $names the plugin name strings (foldernames) in an array
137 137
      * @return array
138 138
      */
139
-    public function getTemplates($names=null)
139
+    public function getTemplates($names = null)
140 140
     {
141 141
         $templateStrings = array();
142 142
         $plugins = $this->getPluginsTemplates($names);
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
             foreach ($templates as $path) {
145 145
                 if (file_exists($path)) {
146 146
                     $filename = explode('/', $path);
147
-                    $filename = $filename[sizeof($filename)-1];
148
-                    $id = $folder . '-' . substr($filename, 0, (strrpos($filename, ".")));
147
+                    $filename = $filename[sizeof($filename) - 1];
148
+                    $id = $folder.'-'.substr($filename, 0, (strrpos($filename, ".")));
149 149
                     $templateStrings[$id] = file_get_contents($path);
150 150
                 }
151 151
             }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      * @param array $names the plugin name strings (foldernames) in an array
159 159
      * @return array
160 160
      */
161
-    public function getPluginCallbacks($names=null)
161
+    public function getPluginCallbacks($names = null)
162 162
     {
163 163
         if ($names) {
164 164
             $names = array_merge($this->requestedPlugins, $names);
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     protected function flatten($array)
200 200
     {
201 201
         $return = array();
202
-        array_walk_recursive($array, function ($a) use (&$return) { $return[] = $a; });
202
+        array_walk_recursive($array, function($a) use (&$return) { $return[] = $a; });
203 203
         return $return;
204 204
     }
205 205
 
Please login to merge, or discard this patch.
src/model/Cache.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
     /**
20 20
      * Wraps apc_store() and apcu_store()
21 21
      */
22
-    public function store($key, $value, $ttl=3600)
22
+    public function store($key, $value, $ttl = 3600)
23 23
     {
24 24
         if (function_exists('apcu_store')) {
25 25
             return apcu_store($key, $value, $ttl);
Please login to merge, or discard this patch.
src/index.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
     }
10 10
     require_once '../vendor/autoload.php';
11 11
 } catch (Exception $e) {
12
-    echo "Error: " . $e->getMessage();
12
+    echo "Error: ".$e->getMessage();
13 13
     return;
14 14
 }
15 15
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     // if language code missing, redirect to guessed language
28 28
     // in any case, redirect to <lang>/
29 29
     $lang = sizeof($parts) == 2 && $parts[1] !== '' ? $parts[1] : $controller->guessLanguage($request);
30
-    header("Location: " . $lang . "/");
30
+    header("Location: ".$lang."/");
31 31
 } else {
32 32
     if (array_key_exists($parts[1], $config->getLanguages())) { // global pages
33 33
         $request->setLang($parts[1]);
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
         }
58 58
         if (sizeof($parts) == 3) { // language code missing
59 59
             $lang = $controller->guessLanguage($request);
60
-            $newurl = $controller->getBaseHref() . $vocab . "/" . $lang . "/";
61
-            header("Location: " . $newurl);
60
+            $newurl = $controller->getBaseHref().$vocab."/".$lang."/";
61
+            header("Location: ".$newurl);
62 62
         } else {
63 63
             if (array_key_exists($parts[2], $config->getLanguages())) {
64 64
                 $lang = $parts[2];
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
                 }
100 100
             } else { // language code missing, redirect to some language version
101 101
                 $lang = $controller->guessLanguage($request, $vocab);
102
-                $newurl = $controller->getBaseHref() . $vocab . "/" . $lang . "/" . implode('/', array_slice($parts, 2));
102
+                $newurl = $controller->getBaseHref().$vocab."/".$lang."/".implode('/', array_slice($parts, 2));
103 103
                 $qs = $request->getServerConstant('QUERY_STRING');
104 104
                 if ($qs) {
105
-                    $newurl .= "?" . $qs;
105
+                    $newurl .= "?".$qs;
106 106
                 }
107 107
                 header("Location: $newurl");
108 108
             }
Please login to merge, or discard this patch.