Passed
Pull Request — master (#1352)
by Osma
04:22
created
model/sparql/GenericSparql.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
     protected function query($query) {
89 89
         $queryId = sprintf("%05d", rand(0, 99999));
90 90
         $logger = $this->model->getLogger();
91
-        $logger->info("[qid $queryId] SPARQL query:\n" . $this->generateQueryPrefixes($query) . "\n$query\n");
91
+        $logger->info("[qid $queryId] SPARQL query:\n".$this->generateQueryPrefixes($query)."\n$query\n");
92 92
         $starttime = microtime(true);
93 93
         $result = $this->client->query($query);
94 94
         $elapsed = intval(round((microtime(true) - $starttime) * 1000));
95
-        if(method_exists($result, 'numRows')) {
95
+        if (method_exists($result, 'numRows')) {
96 96
             $numRows = $result->numRows();
97 97
             $logger->info("[qid $queryId] result: $numRows rows returned in $elapsed ms");
98 98
         } else { // graph result
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      * @param Vocabulary[]|null $vocabs
109 109
      * @return string
110 110
      */
111
-    protected function generateFromClause($vocabs=null) {
111
+    protected function generateFromClause($vocabs = null) {
112 112
         $clause = '';
113 113
         if (!$vocabs) {
114 114
             return $this->graph !== '?graph' && $this->graph !== NULL ? "FROM <$this->graph>" : '';
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 
250 250
 	$quote_string = function($val) { return "'$val'"; };
251 251
 	$quoted_values = array_map($quote_string, $langs);
252
-	$langFilter = "FILTER(?lang IN (" . implode(',', $quoted_values) . "))";
252
+	$langFilter = "FILTER(?lang IN (".implode(',', $quoted_values)."))";
253 253
 
254 254
         $values = $this->formatValues('?type', $classes, 'uri');
255 255
         $valuesProp = $this->formatValues('?prop', $props, null);
@@ -693,9 +693,9 @@  discard block
 block discarded – undo
693 693
                 $conceptscheme['title'] = $row->title->getValue();
694 694
             }
695 695
             // add dct:subject and their labels in the result
696
-            if(isset($row->domain) && isset($row->domainLabel)){
697
-                $conceptscheme['subject']['uri']=$row->domain->getURI();
698
-                $conceptscheme['subject']['prefLabel']=$row->domainLabel->getValue();
696
+            if (isset($row->domain) && isset($row->domainLabel)) {
697
+                $conceptscheme['subject']['uri'] = $row->domain->getURI();
698
+                $conceptscheme['subject']['prefLabel'] = $row->domainLabel->getValue();
699 699
             }
700 700
 
701 701
             $ret[$row->cs->getURI()] = $conceptscheme;
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
           $values[] = "<$graph>";
763 763
         }
764 764
         if (count($values)) {
765
-          return "FILTER (?graph IN (" . implode(',', $values) . "))";
765
+          return "FILTER (?graph IN (".implode(',', $values)."))";
766 766
         }
767 767
     }
768 768
 
@@ -773,16 +773,16 @@  discard block
 block discarded – undo
773 773
      * @return string sparql query clauses
774 774
      */
775 775
     protected function formatLimitAndOffset($limit, $offset) {
776
-        $limit = ($limit) ? 'LIMIT ' . $limit : '';
777
-        $offset = ($offset) ? 'OFFSET ' . $offset : '';
776
+        $limit = ($limit) ? 'LIMIT '.$limit : '';
777
+        $offset = ($offset) ? 'OFFSET '.$offset : '';
778 778
         // eliminating whitespace and line changes when the conditions aren't needed.
779 779
         $limitandoffset = '';
780 780
         if ($limit && $offset) {
781
-            $limitandoffset = "\n" . $limit . "\n" . $offset;
781
+            $limitandoffset = "\n".$limit."\n".$offset;
782 782
         } elseif ($limit) {
783
-            $limitandoffset = "\n" . $limit;
783
+            $limitandoffset = "\n".$limit;
784 784
         } elseif ($offset) {
785
-            $limitandoffset = "\n" . $offset;
785
+            $limitandoffset = "\n".$offset;
786 786
         }
787 787
 
788 788
         return $limitandoffset;
@@ -934,14 +934,14 @@  discard block
 block discarded – undo
934 934
         // if search language and UI/display language differ, must also consider case where there is no prefLabel in
935 935
         // the display language; in that case, should use the label with the same language as the matched label
936 936
         $labelcondFallback = ($searchLang != $lang) ?
937
-          "OPTIONAL { # in case previous OPTIONAL block gives no labels\n" .
937
+          "OPTIONAL { # in case previous OPTIONAL block gives no labels\n".
938 938
           "?s skos:prefLabel ?label . FILTER (LANGMATCHES(LANG(?label), LANG(?match))) }" : "";
939 939
 
940 940
         //  Including the labels if there is no query term given.
941 941
         if ($rawterm === '') {
942 942
           $labelClause = "?s skos:prefLabel ?label .";
943
-          $labelClause = ($lang) ? $labelClause . " FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause . "";
944
-          return $labelClause . " BIND(?label AS ?match)";
943
+          $labelClause = ($lang) ? $labelClause." FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause."";
944
+          return $labelClause." BIND(?label AS ?match)";
945 945
         }
946 946
 
947 947
         /*
@@ -1013,20 +1013,20 @@  discard block
 block discarded – undo
1013 1013
         $schemecond = '';
1014 1014
         if (!empty($schemes)) {
1015 1015
             $conditions = array();
1016
-            foreach($schemes as $scheme) {
1016
+            foreach ($schemes as $scheme) {
1017 1017
                 $conditions[] = "{?s skos:inScheme <$scheme>}";
1018 1018
             }
1019
-            $schemecond = '{'.implode(" UNION ",$conditions).'}';
1019
+            $schemecond = '{'.implode(" UNION ", $conditions).'}';
1020 1020
         }
1021
-        $filterDeprecated="";
1021
+        $filterDeprecated = "";
1022 1022
         //show or hide deprecated concepts
1023
-        if(!$showDeprecated){
1024
-            $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }";
1023
+        if (!$showDeprecated) {
1024
+            $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }";
1025 1025
         }
1026 1026
         // extra conditions for parent and group, if specified
1027
-        $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <" . $params->getParentLimit() . "> ." : "";
1028
-        $groupcond = ($params->getGroupLimit()) ? "<" . $params->getGroupLimit() . "> skos:member ?s ." : "";
1029
-        $pgcond = $parentcond . $groupcond;
1027
+        $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <".$params->getParentLimit()."> ." : "";
1028
+        $groupcond = ($params->getGroupLimit()) ? "<".$params->getGroupLimit()."> skos:member ?s ." : "";
1029
+        $pgcond = $parentcond.$groupcond;
1030 1030
 
1031 1031
         $orderextra = $this->isDefaultEndpoint() ? $this->graph : '';
1032 1032
 
@@ -1112,9 +1112,9 @@  discard block
 block discarded – undo
1112 1112
             $hit['type'][] = $this->shortenUri($typeuri);
1113 1113
         }
1114 1114
 
1115
-        if(!empty($fields)) {
1115
+        if (!empty($fields)) {
1116 1116
             foreach ($fields as $prop) {
1117
-                $propname = $prop . 's';
1117
+                $propname = $prop.'s';
1118 1118
                 if (isset($row->$propname)) {
1119 1119
                     foreach (explode("\n", $row->$propname->getValue()) as $line) {
1120 1120
                         $rdata = str_getcsv($line, ',', '"', '"');
@@ -1129,7 +1129,7 @@  discard block
 block discarded – undo
1129 1129
                             $propvals = $rdata[2];
1130 1130
                         }
1131 1131
 
1132
-                        $hit['skos:' . $prop][] = $propvals;
1132
+                        $hit['skos:'.$prop][] = $propvals;
1133 1133
                     }
1134 1134
                 }
1135 1135
             }
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
      * @return array query result object
1206 1206
      */
1207 1207
     public function queryConcepts($vocabs, $fields, $unique, $params, $showDeprecated = false) {
1208
-        $query = $this->generateConceptSearchQuery($fields, $unique, $params,$showDeprecated);
1208
+        $query = $this->generateConceptSearchQuery($fields, $unique, $params, $showDeprecated);
1209 1209
         $results = $this->query($query);
1210 1210
         return $this->transformConceptSearchResults($results, $vocabs, $fields);
1211 1211
     }
@@ -1260,10 +1260,10 @@  discard block
 block discarded – undo
1260 1260
         $conditions = $this->formatFilterConditions($letter, $lang);
1261 1261
         $filtercondLabel = $conditions['filterpref'];
1262 1262
         $filtercondALabel = $conditions['filteralt'];
1263
-        $qualifierClause = $qualifier ? "OPTIONAL { ?s <" . $qualifier->getURI() . "> ?qualifier }" : "";
1264
-        $filterDeprecated="";
1265
-        if(!$showDeprecated){
1266
-            $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }";
1263
+        $qualifierClause = $qualifier ? "OPTIONAL { ?s <".$qualifier->getURI()."> ?qualifier }" : "";
1264
+        $filterDeprecated = "";
1265
+        if (!$showDeprecated) {
1266
+            $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }";
1267 1267
         }
1268 1268
         $query = <<<EOQ
1269 1269
 SELECT DISTINCT ?s ?label ?alabel ?qualifier
@@ -1740,7 +1740,7 @@  discard block
 block discarded – undo
1740 1740
                 if (!isset($row->label) || $row->label->getLang() === $lang) {
1741 1741
                     $ret[$row->object->getUri()] = $val;
1742 1742
                 } elseif ($row->label->getLang() === $fallbacklang) {
1743
-                    $val['label'] .= ' (' . $row->label->getLang() . ')';
1743
+                    $val['label'] .= ' ('.$row->label->getLang().')';
1744 1744
                     $ret[$row->object->getUri()] = $val;
1745 1745
                 }
1746 1746
             }
@@ -1836,10 +1836,10 @@  discard block
 block discarded – undo
1836 1836
 
1837 1837
             $label = null;
1838 1838
             if (isset($row->label)) {
1839
-                if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) {
1839
+                if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) {
1840 1840
                     $label = $row->label->getValue();
1841 1841
                 } else {
1842
-                    $label = $row->label->getValue() . " (" . $row->label->getLang() . ")";
1842
+                    $label = $row->label->getValue()." (".$row->label->getLang().")";
1843 1843
                 }
1844 1844
 
1845 1845
             }
@@ -1915,8 +1915,8 @@  discard block
 block discarded – undo
1915 1915
         foreach ($result as $row) {
1916 1916
             if (isset($row->top) && isset($row->label)) {
1917 1917
                 $label = $row->label->getValue();
1918
-                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) {
1919
-                    $label .= ' (' . $row->label->getLang() . ')';
1918
+                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) {
1919
+                    $label .= ' ('.$row->label->getLang().')';
1920 1920
                 }
1921 1921
                 $top = array('uri' => $row->top->getUri(), 'topConceptOf' => $row->topuri->getUri(), 'label' => $label, 'hasChildren' => filter_var($row->children->getValue(), FILTER_VALIDATE_BOOLEAN));
1922 1922
                 if (isset($row->notation)) {
@@ -2009,7 +2009,7 @@  discard block
 block discarded – undo
2009 2009
                 $ret[$uri]['exact'] = $row->exact->getUri();
2010 2010
             }
2011 2011
             if (isset($row->tops)) {
2012
-               $topConceptsList=explode(" ", $row->tops->getValue());
2012
+               $topConceptsList = explode(" ", $row->tops->getValue());
2013 2013
                // sort to guarantee an alphabetical ordering of the URI
2014 2014
                sort($topConceptsList);
2015 2015
                $ret[$uri]['tops'] = $topConceptsList;
@@ -2022,8 +2022,8 @@  discard block
 block discarded – undo
2022 2022
                 $label = null;
2023 2023
                 if (isset($row->childlabel)) {
2024 2024
                     $label = $row->childlabel->getValue();
2025
-                    if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang . "-") !== 0) {
2026
-                        $label .= " (" . $row->childlabel->getLang() . ")";
2025
+                    if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang."-") !== 0) {
2026
+                        $label .= " (".$row->childlabel->getLang().")";
2027 2027
                     }
2028 2028
 
2029 2029
                 }
@@ -2044,8 +2044,8 @@  discard block
 block discarded – undo
2044 2044
             }
2045 2045
             if (isset($row->label)) {
2046 2046
                 $preflabel = $row->label->getValue();
2047
-                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) {
2048
-                    $preflabel .= ' (' . $row->label->getLang() . ')';
2047
+                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) {
2048
+                    $preflabel .= ' ('.$row->label->getLang().')';
2049 2049
                 }
2050 2050
 
2051 2051
                 $ret[$uri]['prefLabel'] = $preflabel;
@@ -2166,9 +2166,9 @@  discard block
 block discarded – undo
2166 2166
      */
2167 2167
     private function generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated = false) {
2168 2168
         $fcl = $this->generateFromClause();
2169
-        $filterDeprecated="";
2170
-        if(!$showDeprecated){
2171
-            $filterDeprecated="  FILTER NOT EXISTS { ?conc owl:deprecated true }";
2169
+        $filterDeprecated = "";
2170
+        if (!$showDeprecated) {
2171
+            $filterDeprecated = "  FILTER NOT EXISTS { ?conc owl:deprecated true }";
2172 2172
         }
2173 2173
         $query = <<<EOQ
2174 2174
 SELECT ?conc ?super ?label ?members ?type ?notation $fcl
@@ -2207,10 +2207,10 @@  discard block
 block discarded – undo
2207 2207
                     'type' => array($row->type->shorten()),
2208 2208
                 );
2209 2209
                 if (isset($row->label)) {
2210
-                    if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) {
2210
+                    if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) {
2211 2211
                         $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue();
2212 2212
                     } else {
2213
-                        $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue() . " (" . $row->label->getLang() . ")";
2213
+                        $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue()." (".$row->label->getLang().")";
2214 2214
                     }
2215 2215
 
2216 2216
                 }
@@ -2238,8 +2238,8 @@  discard block
 block discarded – undo
2238 2238
      * @param boolean $showDeprecated whether to include deprecated concepts in search results
2239 2239
      * @return array Result array with concept URI as key and concept label as value
2240 2240
      */
2241
-    public function listConceptGroupContents($groupClass, $group, $lang,$showDeprecated = false) {
2242
-        $query = $this->generateConceptGroupContentsQuery($groupClass, $group, $lang,$showDeprecated);
2241
+    public function listConceptGroupContents($groupClass, $group, $lang, $showDeprecated = false) {
2242
+        $query = $this->generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated);
2243 2243
         $result = $this->query($query);
2244 2244
         return $this->transformConceptGroupContentsResults($result, $lang);
2245 2245
     }
@@ -2253,9 +2253,9 @@  discard block
 block discarded – undo
2253 2253
      * @param boolean $showDeprecated whether to include deprecated concepts in the change list
2254 2254
      * @return string sparql query
2255 2255
      */
2256
-    private function generateChangeListQuery($prop, $lang, $offset, $limit=200, $showDeprecated=false) {
2256
+    private function generateChangeListQuery($prop, $lang, $offset, $limit = 200, $showDeprecated = false) {
2257 2257
         $fcl = $this->generateFromClause();
2258
-        $offset = ($offset) ? 'OFFSET ' . $offset : '';
2258
+        $offset = ($offset) ? 'OFFSET '.$offset : '';
2259 2259
 
2260 2260
         //Additional clauses when deprecated concepts need to be included in the results
2261 2261
         $deprecatedOptions = '';
@@ -2333,7 +2333,7 @@  discard block
 block discarded – undo
2333 2333
      * @param boolean $showDeprecated whether to include deprecated concepts in the change list
2334 2334
      * @return array Result array
2335 2335
      */
2336
-    public function queryChangeList($prop, $lang, $offset, $limit, $showDeprecated=false) {
2336
+    public function queryChangeList($prop, $lang, $offset, $limit, $showDeprecated = false) {
2337 2337
         $query = $this->generateChangeListQuery($prop, $lang, $offset, $limit, $showDeprecated);
2338 2338
 
2339 2339
         $result = $this->query($query);
Please login to merge, or discard this patch.
model/ConceptSearchParameters.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,11 +71,11 @@
 block discarded – undo
71 71
         if ((!isset($term) || strlen(trim($term)) === 0) && $this->rest)
72 72
             $term = $this->request->getQueryParamRaw('label');
73 73
         $term = trim($term); // surrounding whitespace is not considered significant
74
-        $term = Normalizer::normalize( $term, Normalizer::FORM_C ); //Normalize decomposed unicode characters #1184
74
+        $term = Normalizer::normalize($term, Normalizer::FORM_C); //Normalize decomposed unicode characters #1184
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.
model/PluginRegister.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 class PluginRegister {
4 4
     private $requestedPlugins;
5 5
 
6
-    public function __construct($requestedPlugins=array()) {
6
+    public function __construct($requestedPlugins = array()) {
7 7
         $this->requestedPlugins = $requestedPlugins;
8 8
         $this->pluginOrder = array();
9 9
         foreach ($this->requestedPlugins as $index => $value) {
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      * @param boolean $raw interpret $type values as raw text instead of files
46 46
      * @return array
47 47
      */
48
-    private function filterPlugins($type, $raw=false) {
48
+    private function filterPlugins($type, $raw = false) {
49 49
         $plugins = $this->getPlugins();
50 50
         $plugins = $this->sortPlugins($plugins);
51 51
         $ret = array();
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
                     }
59 59
                     else {
60 60
                         foreach ($files[$type] as $file) {
61
-                            array_push($ret[$name], 'plugins/' . $name . '/' . $file);
61
+                            array_push($ret[$name], 'plugins/'.$name.'/'.$file);
62 62
                         }
63 63
                     }
64 64
                 }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      * @param array $names the plugin name strings (foldernames) in an array
90 90
      * @return array
91 91
      */
92
-    public function getPluginsJS($names=null) {
92
+    public function getPluginsJS($names = null) {
93 93
         if ($names) {
94 94
             $names = array_merge($this->requestedPlugins, $names);
95 95
             return $this->filterPluginsByName('js', $names);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      * @param array $names the plugin name strings (foldernames) in an array
103 103
      * @return array
104 104
      */
105
-    public function getPluginsCSS($names=null) {
105
+    public function getPluginsCSS($names = null) {
106 106
         if ($names) {
107 107
             $names = array_merge($this->requestedPlugins, $names);
108 108
             return $this->filterPluginsByName('css', $names);
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      * @param array $names the plugin name strings (foldernames) in an array
116 116
      * @return array
117 117
      */
118
-    public function getPluginsTemplates($names=null) {
118
+    public function getPluginsTemplates($names = null) {
119 119
         if ($names) {
120 120
             $names = array_merge($this->requestedPlugins, $names);
121 121
             return $this->filterPluginsByName('templates', $names);
@@ -128,15 +128,15 @@  discard block
 block discarded – undo
128 128
      * @param array $names the plugin name strings (foldernames) in an array
129 129
      * @return array
130 130
      */
131
-    public function getTemplates($names=null) {
131
+    public function getTemplates($names = null) {
132 132
         $templateStrings = array();
133 133
         $plugins = $this->getPluginsTemplates($names);
134 134
         foreach ($plugins as $folder => $templates) {
135 135
             foreach ($templates as $path) {
136 136
                 if (file_exists($path)) {
137 137
                     $filename = explode('/', $path);
138
-                    $filename = $filename[sizeof($filename)-1];
139
-                    $id = $folder . '-' . substr($filename, 0 , (strrpos($filename, ".")));
138
+                    $filename = $filename[sizeof($filename) - 1];
139
+                    $id = $folder.'-'.substr($filename, 0, (strrpos($filename, ".")));
140 140
                     $templateStrings[$id] = file_get_contents($path);
141 141
                 }
142 142
             }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
      * @param array $names the plugin name strings (foldernames) in an array
150 150
      * @return array
151 151
      */
152
-    public function getPluginCallbacks($names=null) {
152
+    public function getPluginCallbacks($names = null) {
153 153
         if ($names) {
154 154
             $names = array_merge($this->requestedPlugins, $names);
155 155
             return $this->filterPluginsByName('callback', $names);
Please login to merge, or discard this patch.
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, '', $this->getServerConstant('REQUEST_URI')), 1);
Please login to merge, or discard this patch.
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.
model/Concept.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
                 return $this->resource->label($fallback);
143 143
             }
144 144
             // We need to check all the labels in case one of them matches a subtag of the current language
145
-            foreach($this->resource->allLiterals('skos:prefLabel') as $label) {
145
+            foreach ($this->resource->allLiterals('skos:prefLabel') as $label) {
146 146
                 // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language
147
-                if ($label !== null && strpos($label->getLang(), $fallback . '-') === 0) {
147
+                if ($label !== null && strpos($label->getLang(), $fallback.'-') === 0) {
148 148
                     return EasyRdf\Literal::create($label, $fallback);
149 149
                 }
150 150
             }
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
     public function getXlLabel()
173 173
     {
174 174
         $labels = $this->resource->allResources('skosxl:prefLabel');
175
-        foreach($labels as $labres) {
175
+        foreach ($labels as $labres) {
176 176
             $label = $labres->getLiteral('skosxl:literalForm');
177 177
             if ($label !== null && $label->getLang() == $this->clang) {
178 178
                 return new LabelSkosXL($this->model, $labres);
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
         // catch external subjects that have $res as object
280 280
         $extSubjects = $exGraph->resourcesMatching("schema:about", $res);
281 281
 
282
-        $propList =  array_unique(array_merge(
282
+        $propList = array_unique(array_merge(
283 283
             $this->DEFAULT_EXT_PROPERTIES,
284 284
             $this->getVocab()->getConfig()->getExtProperties(),
285 285
             $this->getVocab()->getConfig()->getPluginRegister()->getExtProperties()
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
      * @param string[] $seen Processed resources so far
305 305
      * @param string[] $props (optional) limit to these property URIs
306 306
      */
307
-    private function addExternalTriplesToGraph($res, &$seen, $props=null)
307
+    private function addExternalTriplesToGraph($res, &$seen, $props = null)
308 308
     {
309 309
         if (array_key_exists($res->getUri(), $seen) && $seen[$res->getUri()] === 0) {
310 310
             return;
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
      */
335 335
     private function addPropertyValues($res, $prop, &$seen)
336 336
     {
337
-        $resList = $res->allResources('<' . $prop . '>');
337
+        $resList = $res->allResources('<'.$prop.'>');
338 338
 
339 339
         foreach ($resList as $res2) {
340 340
             if ($res2->isBNode()) {
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
             $this->addResourceReifications($res, $prop, $res2, $seen);
345 345
         }
346 346
 
347
-        $litList = $res->allLiterals('<' . $prop . '>');
347
+        $litList = $res->allLiterals('<'.$prop.'>');
348 348
 
349 349
         foreach ($litList as $lit) {
350 350
             $this->graph->addLiteral($res, $prop, $lit);
@@ -532,15 +532,15 @@  discard block
 block discarded – undo
532 532
                 // if not found in current vocabulary, look up in the default graph to be able
533 533
                 // to read an ontology loaded in a separate graph
534 534
                 // note that this imply that the property has an rdf:type declared for the query to work
535
-                if(!$is_well_known && !$proplabel) {
535
+                if (!$is_well_known && !$proplabel) {
536 536
                     $envLangLabels = $this->model->getDefaultSparql()->queryLabel($longUri, $this->getEnvLang());
537 537
                     
538 538
                     $defaultPropLabel = $this->model->getDefaultSparql()->queryLabel($longUri, '');
539 539
 
540
-					if($envLangLabels) {
540
+					if ($envLangLabels) {
541 541
 						$proplabel = $envLangLabels[$this->getEnvLang()];
542 542
                     } else {
543
-						if($defaultPropLabel) {
543
+						if ($defaultPropLabel) {
544 544
 							$proplabel = $defaultPropLabel[''];
545 545
 						}
546 546
 					}
@@ -553,12 +553,12 @@  discard block
 block discarded – undo
553 553
                 }
554 554
 
555 555
                 // also look up superprops in the default graph if not found in current vocabulary
556
-                if(!$is_well_known && (!$superprops || empty($superprops))) {
556
+                if (!$is_well_known && (!$superprops || empty($superprops))) {
557 557
                     $superprops = $this->model->getDefaultSparql()->querySuperProperties($longUri);
558 558
                 }
559 559
 
560 560
                 // we're reading only one super property, even if there are multiple ones
561
-                $superprop = ($superprops)?$superprops[0]:null;
561
+                $superprop = ($superprops) ? $superprops[0] : null;
562 562
                 if ($superprop) {
563 563
                     $superprop = EasyRdf\RdfNamespace::shorten($superprop) ? EasyRdf\RdfNamespace::shorten($superprop) : $superprop;
564 564
                 }
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
                 }
572 572
 
573 573
                 // searching for subproperties of literals too
574
-                if($superprops) {
574
+                if ($superprops) {
575 575
                     foreach ($superprops as $subi) {
576 576
                         $suburi = EasyRdf\RdfNamespace::shorten($subi) ? EasyRdf\RdfNamespace::shorten($subi) : $subi;
577 577
                         $duplicates[$suburi] = $prop;
@@ -732,14 +732,14 @@  discard block
 block discarded – undo
732 732
 
733 733
             // making a human readable string from the timestamps
734 734
             if ($created != '') {
735
-                $ret = gettext('skosmos:created') . ' ' . (Punic\Calendar::formatDate($created, 'short', $this->getEnvLang()));
735
+                $ret = gettext('skosmos:created').' '.(Punic\Calendar::formatDate($created, 'short', $this->getEnvLang()));
736 736
             }
737 737
 
738 738
             if ($modified != '') {
739 739
                 if ($created != '') {
740
-                    $ret .= ', ' . gettext('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang()));
740
+                    $ret .= ', '.gettext('skosmos:modified').' '.(Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang()));
741 741
                 } else {
742
-                    $ret .= ' ' . ucfirst(gettext('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang()));
742
+                    $ret .= ' '.ucfirst(gettext('skosmos:modified')).' '.(Punic\Calendar::formatDate($modified, 'short', $this->getEnvLang()));
743 743
                 }
744 744
 
745 745
             }
@@ -747,12 +747,12 @@  discard block
 block discarded – undo
747 747
             trigger_error($e->getMessage(), E_USER_WARNING);
748 748
             $ret = '';
749 749
             if ($this->resource->get('dc:modified')) {
750
-                $modified = (string) $this->resource->get('dc:modified');
751
-                $ret = gettext('skosmos:modified') . ' ' . $modified;
750
+                $modified = (string)$this->resource->get('dc:modified');
751
+                $ret = gettext('skosmos:modified').' '.$modified;
752 752
             }
753 753
             if ($this->resource->get('dc:created')) {
754
-                $created .= (string) $this->resource->get('dc:created');
755
-                $ret .= ' ' . gettext('skosmos:created') . ' ' . $created;
754
+                $created .= (string)$this->resource->get('dc:created');
755
+                $ret .= ' '.gettext('skosmos:created').' '.$created;
756 756
             }
757 757
         }
758 758
         return $ret;
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
                     $groups[$collLabel] = array($group);
825 825
 
826 826
                     $res = $collection;
827
-                    while($super = $this->graph->resourcesMatching('skos:member', $res)) {
827
+                    while ($super = $this->graph->resourcesMatching('skos:member', $res)) {
828 828
                         foreach ($super as $res) {
829 829
                             $superprop = new ConceptPropertyValue($this->model, $this->vocab, $res, 'skosmos:memberOfSuper', $this->clang);
830 830
                             array_unshift($groups[$collLabel], $superprop);
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
 
870 870
         foreach ($labels as $lit) {
871 871
             // filtering away subsets of the current language eg. en vs en-GB
872
-            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang() . '-') !== 0) {
872
+            if ($lit->getLang() != $this->clang && strpos($lit->getLang(), $this->getEnvLang().'-') !== 0) {
873 873
                 $langCode = $lit->getLang() ? $lit->getLang() : '';
874 874
                 $ret[$langCode][$key][] = new ConceptPropertyValueLiteral($this->model, $this->vocab, $this->resource, $lit, $prop);
875 875
             }
@@ -961,10 +961,10 @@  discard block
 block discarded – undo
961 961
             }
962 962
             else if ($context[$vocabPrefix] !== $vocabUriSpace) {
963 963
                 $i = 2;
964
-                while (isset($context[$vocabPrefix . $i]) && $context[$vocabPrefix . $i] !== $vocabUriSpace) {
964
+                while (isset($context[$vocabPrefix.$i]) && $context[$vocabPrefix.$i] !== $vocabUriSpace) {
965 965
                     $i += 1;
966 966
                 }
967
-                $context[$vocabPrefix . $i] = $vocabUriSpace;
967
+                $context[$vocabPrefix.$i] = $vocabUriSpace;
968 968
             }
969 969
         }
970 970
         $compactJsonLD = \ML\JsonLD\JsonLD::compact($this->graph->serialise('jsonld'), json_encode($context));
Please login to merge, or discard this patch.
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
     public function getPrefLabel() {
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;
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     public function getProperties() {
24 24
         $ret = array();
25 25
         $props = $this->resource->properties();
26
-        foreach($props as $prop) {
26
+        foreach ($props as $prop) {
27 27
             if ($prop !== 'rdf:type' && $prop !== 'skosxl:literalForm') {
28 28
                 // make sure to use the correct gettext keys for DC namespace
29 29
                 $propkey = str_starts_with($prop, 'dc11:') ?
Please login to merge, or discard this patch.
model/ConceptPropertyValue.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
                 }
54 54
                 // We need to check all the labels in case one of them matches a subtag of the current language
55 55
                 if ($this->resource->allLiterals('skos:prefLabel')) {
56
-                    foreach($this->resource->allLiterals('skos:prefLabel') as $label) {
56
+                    foreach ($this->resource->allLiterals('skos:prefLabel') as $label) {
57 57
                         // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language
58
-                        if ($label !== null && strpos($label->getLang(), $fallback . '-') === 0) {
58
+                        if ($label !== null && strpos($label->getLang(), $fallback.'-') === 0) {
59 59
                             return EasyRdf\Literal::create($label, $fallback);
60 60
                         }
61 61
                     }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     public function getReifiedPropertyValues() {
157 157
         $ret = array();
158 158
         $props = $this->resource->propertyUris();
159
-        foreach($props as $prop) {
159
+        foreach ($props as $prop) {
160 160
             $prop = (EasyRdf\RdfNamespace::shorten($prop) !== null) ? EasyRdf\RdfNamespace::shorten($prop) : $prop;
161 161
             $propkey = str_starts_with($prop, 'dc11:') ?
162 162
                 str_replace('dc11:', 'dc:', $prop) : $prop;
Please login to merge, or discard this patch.