Passed
Push — concept-property-label-overrid... ( 235ebc )
by
unknown
05:19
created
src/rest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     } elseif ($parts[1] == 'data') {
38 38
         $controller->data($request);
39 39
     } elseif (sizeof($parts) == 2) {
40
-        header("Location: " . $parts[1] . "/");
40
+        header("Location: ".$parts[1]."/");
41 41
     } else {
42 42
         $vocab = $parts[1];
43 43
         try {
@@ -93,5 +93,5 @@  discard block
 block discarded – undo
93 93
     }
94 94
 } catch (Exception $e) {
95 95
     header("HTTP/1.0 500 Internal Server Error");
96
-    echo('ERROR: ' . $e->getMessage());
96
+    echo('ERROR: '.$e->getMessage());
97 97
 }
Please login to merge, or discard this patch.
src/model/sparql/GenericSparql.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      *
65 65
      * @param string $query
66 66
      * @return string
67
-    */
67
+     */
68 68
     protected function generateQueryPrefixes($query)
69 69
     {
70 70
         // Check for undefined prefixes
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
         return $query;
1017 1017
     }
1018 1018
     /**
1019
-    *  This function can be overwritten in other SPARQL dialects for the possibility of handling the different language clauses
1019
+     *  This function can be overwritten in other SPARQL dialects for the possibility of handling the different language clauses
1020 1020
      * @param string $lang
1021 1021
      * @return string formatted language clause
1022 1022
      */
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
     {
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
     {
113 113
         $clause = '';
114 114
         if (!$vocabs) {
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
         $gcl = $this->graphClause;
258 258
         $classes = ($classes) ? $classes : array('http://www.w3.org/2004/02/skos/core#Concept');
259 259
 
260
-        $quote_string = function ($val) { return "'$val'"; };
260
+        $quote_string = function($val) { return "'$val'"; };
261 261
         $quoted_values = array_map($quote_string, $langs);
262
-        $langFilter = "FILTER(?lang IN (" . implode(',', $quoted_values) . "))";
262
+        $langFilter = "FILTER(?lang IN (".implode(',', $quoted_values)."))";
263 263
 
264 264
         $values = $this->formatValues('?type', $classes, 'uri');
265 265
         $valuesProp = $this->formatValues('?prop', $props, null);
@@ -718,9 +718,9 @@  discard block
 block discarded – undo
718 718
                 $conceptscheme['title'] = $row->title->getValue();
719 719
             }
720 720
             // add dct:subject and their labels in the result
721
-            if(isset($row->domain) && isset($row->domainLabel)) {
722
-                $conceptscheme['subject']['uri']=$row->domain->getURI();
723
-                $conceptscheme['subject']['prefLabel']=$row->domainLabel->getValue();
721
+            if (isset($row->domain) && isset($row->domainLabel)) {
722
+                $conceptscheme['subject']['uri'] = $row->domain->getURI();
723
+                $conceptscheme['subject']['prefLabel'] = $row->domainLabel->getValue();
724 724
             }
725 725
 
726 726
             $ret[$row->cs->getURI()] = $conceptscheme;
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
             $values[] = "<$graph>";
792 792
         }
793 793
         if (count($values)) {
794
-            return "FILTER (?graph IN (" . implode(',', $values) . "))";
794
+            return "FILTER (?graph IN (".implode(',', $values)."))";
795 795
         }
796 796
     }
797 797
 
@@ -803,16 +803,16 @@  discard block
 block discarded – undo
803 803
      */
804 804
     protected function formatLimitAndOffset($limit, $offset)
805 805
     {
806
-        $limit = ($limit) ? 'LIMIT ' . $limit : '';
807
-        $offset = ($offset) ? 'OFFSET ' . $offset : '';
806
+        $limit = ($limit) ? 'LIMIT '.$limit : '';
807
+        $offset = ($offset) ? 'OFFSET '.$offset : '';
808 808
         // eliminating whitespace and line changes when the conditions aren't needed.
809 809
         $limitandoffset = '';
810 810
         if ($limit && $offset) {
811
-            $limitandoffset = "\n" . $limit . "\n" . $offset;
811
+            $limitandoffset = "\n".$limit."\n".$offset;
812 812
         } elseif ($limit) {
813
-            $limitandoffset = "\n" . $limit;
813
+            $limitandoffset = "\n".$limit;
814 814
         } elseif ($offset) {
815
-            $limitandoffset = "\n" . $offset;
815
+            $limitandoffset = "\n".$offset;
816 816
         }
817 817
 
818 818
         return $limitandoffset;
@@ -968,14 +968,14 @@  discard block
 block discarded – undo
968 968
         // if search language and UI/display language differ, must also consider case where there is no prefLabel in
969 969
         // the display language; in that case, should use the label with the same language as the matched label
970 970
         $labelcondFallback = ($searchLang != $lang) ?
971
-          "OPTIONAL { # in case previous OPTIONAL block gives no labels\n" .
971
+          "OPTIONAL { # in case previous OPTIONAL block gives no labels\n".
972 972
           "?s skos:prefLabel ?label . FILTER (LANGMATCHES(LANG(?label), LANG(?match))) }" : "";
973 973
 
974 974
         //  Including the labels if there is no query term given.
975 975
         if ($rawterm === '') {
976 976
             $labelClause = "?s skos:prefLabel ?label .";
977
-            $labelClause = ($lang) ? $labelClause . " FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause . "";
978
-            return $labelClause . " BIND(?label AS ?match)";
977
+            $labelClause = ($lang) ? $labelClause." FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause."";
978
+            return $labelClause." BIND(?label AS ?match)";
979 979
         }
980 980
 
981 981
         /*
@@ -1048,20 +1048,20 @@  discard block
 block discarded – undo
1048 1048
         $schemecond = '';
1049 1049
         if (!empty($schemes)) {
1050 1050
             $conditions = array();
1051
-            foreach($schemes as $scheme) {
1051
+            foreach ($schemes as $scheme) {
1052 1052
                 $conditions[] = "{?s skos:inScheme <$scheme>}";
1053 1053
             }
1054 1054
             $schemecond = '{'.implode(" UNION ", $conditions).'}';
1055 1055
         }
1056
-        $filterDeprecated="";
1056
+        $filterDeprecated = "";
1057 1057
         //show or hide deprecated concepts
1058
-        if(!$showDeprecated) {
1059
-            $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }";
1058
+        if (!$showDeprecated) {
1059
+            $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }";
1060 1060
         }
1061 1061
         // extra conditions for parent and group, if specified
1062
-        $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <" . $params->getParentLimit() . "> ." : "";
1063
-        $groupcond = ($params->getGroupLimit()) ? "<" . $params->getGroupLimit() . "> skos:member ?s ." : "";
1064
-        $pgcond = $parentcond . $groupcond;
1062
+        $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <".$params->getParentLimit()."> ." : "";
1063
+        $groupcond = ($params->getGroupLimit()) ? "<".$params->getGroupLimit()."> skos:member ?s ." : "";
1064
+        $pgcond = $parentcond.$groupcond;
1065 1065
 
1066 1066
         $orderextra = $this->isDefaultEndpoint() ? $this->graph : '';
1067 1067
 
@@ -1147,9 +1147,9 @@  discard block
 block discarded – undo
1147 1147
             $hit['type'][] = $this->shortenUri($typeuri);
1148 1148
         }
1149 1149
 
1150
-        if(!empty($fields)) {
1150
+        if (!empty($fields)) {
1151 1151
             foreach ($fields as $prop) {
1152
-                $propname = $prop . 's';
1152
+                $propname = $prop.'s';
1153 1153
                 if (isset($row->$propname)) {
1154 1154
                     foreach (explode("\n", $row->$propname->getValue()) as $line) {
1155 1155
                         $rdata = str_getcsv($line, ',', '"', '"');
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
                             $propvals = $rdata[2];
1165 1165
                         }
1166 1166
 
1167
-                        $hit['skos:' . $prop][] = $propvals;
1167
+                        $hit['skos:'.$prop][] = $propvals;
1168 1168
                     }
1169 1169
                 }
1170 1170
             }
@@ -1299,10 +1299,10 @@  discard block
 block discarded – undo
1299 1299
         $conditions = $this->formatFilterConditions($letter, $lang);
1300 1300
         $filtercondLabel = $conditions['filterpref'];
1301 1301
         $filtercondALabel = $conditions['filteralt'];
1302
-        $qualifierClause = $qualifier ? "OPTIONAL { ?s <" . $qualifier->getURI() . "> ?qualifier }" : "";
1303
-        $filterDeprecated="";
1304
-        if(!$showDeprecated) {
1305
-            $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }";
1302
+        $qualifierClause = $qualifier ? "OPTIONAL { ?s <".$qualifier->getURI()."> ?qualifier }" : "";
1303
+        $filterDeprecated = "";
1304
+        if (!$showDeprecated) {
1305
+            $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }";
1306 1306
         }
1307 1307
         $query = <<<EOQ
1308 1308
 SELECT DISTINCT ?s ?label ?alabel ?qualifier
@@ -1796,7 +1796,7 @@  discard block
 block discarded – undo
1796 1796
                 if (!isset($row->label) || $row->label->getLang() === $lang) {
1797 1797
                     $ret[$row->object->getUri()] = $val;
1798 1798
                 } elseif ($row->label->getLang() === $fallbacklang) {
1799
-                    $val['label'] .= ' (' . $row->label->getLang() . ')';
1799
+                    $val['label'] .= ' ('.$row->label->getLang().')';
1800 1800
                     $ret[$row->object->getUri()] = $val;
1801 1801
                 }
1802 1802
             }
@@ -1895,10 +1895,10 @@  discard block
 block discarded – undo
1895 1895
 
1896 1896
             $label = null;
1897 1897
             if (isset($row->label)) {
1898
-                if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) {
1898
+                if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) {
1899 1899
                     $label = $row->label->getValue();
1900 1900
                 } else {
1901
-                    $label = $row->label->getValue() . " (" . $row->label->getLang() . ")";
1901
+                    $label = $row->label->getValue()." (".$row->label->getLang().")";
1902 1902
                 }
1903 1903
 
1904 1904
             }
@@ -1976,8 +1976,8 @@  discard block
 block discarded – undo
1976 1976
         foreach ($result as $row) {
1977 1977
             if (isset($row->top) && isset($row->label)) {
1978 1978
                 $label = $row->label->getValue();
1979
-                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) {
1980
-                    $label .= ' (' . $row->label->getLang() . ')';
1979
+                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) {
1980
+                    $label .= ' ('.$row->label->getLang().')';
1981 1981
                 }
1982 1982
                 $top = array('uri' => $row->top->getUri(), 'topConceptOf' => $row->topuri->getUri(), 'label' => $label, 'hasChildren' => filter_var($row->children->getValue(), FILTER_VALIDATE_BOOLEAN));
1983 1983
                 if (isset($row->notation)) {
@@ -2071,7 +2071,7 @@  discard block
 block discarded – undo
2071 2071
                 $ret[$uri]['exact'] = $row->exact->getUri();
2072 2072
             }
2073 2073
             if (isset($row->tops)) {
2074
-                $topConceptsList=explode(" ", $row->tops->getValue());
2074
+                $topConceptsList = explode(" ", $row->tops->getValue());
2075 2075
                 // sort to guarantee an alphabetical ordering of the URI
2076 2076
                 sort($topConceptsList);
2077 2077
                 $ret[$uri]['tops'] = $topConceptsList;
@@ -2084,8 +2084,8 @@  discard block
 block discarded – undo
2084 2084
                 $label = null;
2085 2085
                 if (isset($row->childlabel)) {
2086 2086
                     $label = $row->childlabel->getValue();
2087
-                    if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang . "-") !== 0) {
2088
-                        $label .= " (" . $row->childlabel->getLang() . ")";
2087
+                    if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang."-") !== 0) {
2088
+                        $label .= " (".$row->childlabel->getLang().")";
2089 2089
                     }
2090 2090
 
2091 2091
                 }
@@ -2106,8 +2106,8 @@  discard block
 block discarded – undo
2106 2106
             }
2107 2107
             if (isset($row->label)) {
2108 2108
                 $preflabel = $row->label->getValue();
2109
-                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) {
2110
-                    $preflabel .= ' (' . $row->label->getLang() . ')';
2109
+                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) {
2110
+                    $preflabel .= ' ('.$row->label->getLang().')';
2111 2111
                 }
2112 2112
 
2113 2113
                 $ret[$uri]['prefLabel'] = $preflabel;
@@ -2232,9 +2232,9 @@  discard block
 block discarded – undo
2232 2232
     private function generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated = false)
2233 2233
     {
2234 2234
         $fcl = $this->generateFromClause();
2235
-        $filterDeprecated="";
2236
-        if(!$showDeprecated) {
2237
-            $filterDeprecated="  FILTER NOT EXISTS { ?conc owl:deprecated true }";
2235
+        $filterDeprecated = "";
2236
+        if (!$showDeprecated) {
2237
+            $filterDeprecated = "  FILTER NOT EXISTS { ?conc owl:deprecated true }";
2238 2238
         }
2239 2239
         $query = <<<EOQ
2240 2240
 SELECT ?conc ?super ?label ?members ?type ?notation $fcl
@@ -2274,10 +2274,10 @@  discard block
 block discarded – undo
2274 2274
                     'type' => array($row->type->shorten()),
2275 2275
                 );
2276 2276
                 if (isset($row->label)) {
2277
-                    if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) {
2277
+                    if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) {
2278 2278
                         $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue();
2279 2279
                     } else {
2280
-                        $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue() . " (" . $row->label->getLang() . ")";
2280
+                        $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue()." (".$row->label->getLang().")";
2281 2281
                     }
2282 2282
 
2283 2283
                 }
@@ -2321,10 +2321,10 @@  discard block
 block discarded – undo
2321 2321
      * @param boolean $showDeprecated whether to include deprecated concepts in the change list
2322 2322
      * @return string sparql query
2323 2323
      */
2324
-    private function generateChangeListQuery($prop, $lang, $offset, $limit=200, $showDeprecated=false)
2324
+    private function generateChangeListQuery($prop, $lang, $offset, $limit = 200, $showDeprecated = false)
2325 2325
     {
2326 2326
         $fcl = $this->generateFromClause();
2327
-        $offset = ($offset) ? 'OFFSET ' . $offset : '';
2327
+        $offset = ($offset) ? 'OFFSET '.$offset : '';
2328 2328
 
2329 2329
         //Additional clauses when deprecated concepts need to be included in the results
2330 2330
         $deprecatedOptions = '';
@@ -2415,7 +2415,7 @@  discard block
 block discarded – undo
2415 2415
      * @param boolean $showDeprecated whether to include deprecated concepts in the change list
2416 2416
      * @return array Result array
2417 2417
      */
2418
-    public function queryChangeList($prop, $lang, $offset, $limit, $showDeprecated=false)
2418
+    public function queryChangeList($prop, $lang, $offset, $limit, $showDeprecated = false)
2419 2419
     {
2420 2420
         $query = $this->generateChangeListQuery($prop, $lang, $offset, $limit, $showDeprecated);
2421 2421
 
Please login to merge, or discard this patch.
src/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
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      */
95 95
     private function formatOrderBy($expression, $lang)
96 96
     {
97
-        if(!$this->model->getConfig()->getCollationEnabled()) {
97
+        if (!$this->model->getConfig()->getCollationEnabled()) {
98 98
             return $expression;
99 99
         }
100 100
         $orderby = sprintf('arq:collation(\'%2$s\', %1$s)', $expression, $lang);
@@ -128,15 +128,15 @@  discard block
 block discarded – undo
128 128
         # make text query clause
129 129
         $lcletter = mb_strtolower($letter, 'UTF-8'); // convert to lower case, UTF-8 safe
130 130
         $langClause = $this->generateLangClause($lang);
131
-        $textcondPref = $this->createTextQueryCondition($letter . '*', 'skos:prefLabel', $langClause);
132
-        $textcondAlt = $this->createTextQueryCondition($letter . '*', 'skos:altLabel', $langClause);
133
-        $orderbyclause = $this->formatOrderBy("LCASE(?match)", $lang) . " STR(?s) LCASE(STR(?qualifier))";
131
+        $textcondPref = $this->createTextQueryCondition($letter.'*', 'skos:prefLabel', $langClause);
132
+        $textcondAlt = $this->createTextQueryCondition($letter.'*', 'skos:altLabel', $langClause);
133
+        $orderbyclause = $this->formatOrderBy("LCASE(?match)", $lang)." STR(?s) LCASE(STR(?qualifier))";
134 134
 
135
-        $qualifierClause = $qualifier ? "OPTIONAL { ?s <" . $qualifier->getURI() . "> ?qualifier }" : "";
135
+        $qualifierClause = $qualifier ? "OPTIONAL { ?s <".$qualifier->getURI()."> ?qualifier }" : "";
136 136
 
137
-        $filterDeprecated="";
138
-        if(!$showDeprecated) {
139
-            $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }";
137
+        $filterDeprecated = "";
138
+        if (!$showDeprecated) {
139
+            $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }";
140 140
         }
141 141
 
142 142
         $query = <<<EOQ
Please login to merge, or discard this patch.
src/model/Vocabulary.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             return $lname;
105 105
         }
106 106
         // already a full URI
107
-        return $this->getUriSpace() . $lname;
107
+        return $this->getUriSpace().$lname;
108 108
     }
109 109
 
110 110
     /**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
             $result = $sparql->queryConceptScheme($defaultcs);
167 167
         } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) {
168 168
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
169
-                error_log('Caught exception: ' . $e->getMessage());
169
+                error_log('Caught exception: '.$e->getMessage());
170 170
             }
171 171
             return null;
172 172
         }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
                 foreach ($conceptscheme->allLiterals($prop, null) as $val) {
200 200
                     $prop = (substr($prop, 0, 5) == 'dc11:') ? str_replace('dc11:', 'dc:', $prop) : $prop;
201 201
                     if ($val->getValue() instanceof DateTime) {
202
-                        $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang) . ' ' . Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang);
202
+                        $val = Punic\Calendar::formatDate($val->getValue(), 'full', $lang).' '.Punic\Calendar::format($val->getValue(), 'HH:mm:ss', $lang);
203 203
                     }
204 204
                     $ret[$prop][] = $val;
205 205
                 }
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
             $conceptSchemes = $this->getSparql()->queryConceptSchemes($lang);
257 257
         } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) {
258 258
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
259
-                error_log('Caught exception: ' . $e->getMessage());
259
+                error_log('Caught exception: '.$e->getMessage());
260 260
             }
261 261
         }
262 262
         return $conceptSchemes;
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
         }
328 328
         // don't know how to parse
329 329
         $rev = $parts[2];
330
-        $datestr = $parts[3] . ' ' . $parts[4];
330
+        $datestr = $parts[3].' '.$parts[4];
331 331
 
332 332
         return "$datestr (r$rev)";
333 333
     }
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
      * @param string $array the uri of the concept array class, eg. isothes:ThesaurusArray
339 339
      * @param string $group the uri of the  concept group class, eg. isothes:ConceptGroup
340 340
      */
341
-    public function getStatistics($lang = '', $array=null, $group=null)
341
+    public function getStatistics($lang = '', $array = null, $group = null)
342 342
     {
343 343
         $sparql = $this->getSparql();
344 344
         // find the number of concepts
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
             $conceptInfo = $sparql->queryConceptInfo([$uri], $this->config->getArrayClassURI(), array($this), $clang);
458 458
         } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) {
459 459
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
460
-                error_log('Caught exception: ' . $e->getMessage());
460
+                error_log('Caught exception: '.$e->getMessage());
461 461
             }
462 462
         }
463 463
         return $conceptInfo[0];
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
         return $this->getSparql()->queryChangeList($prop, $clang, $offset, $limit, $showDeprecated);
669 669
     }
670 670
 
671
-    public function getTitle($lang=null)
671
+    public function getTitle($lang = null)
672 672
     {
673 673
         return $this->config->getTitle($lang);
674 674
     }
Please login to merge, or discard this patch.
src/model/BaseConfig.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
      * @param string $lang preferred language for the literal
44 44
      * @return string string value for the given property, or the default value if not found
45 45
      */
46
-    protected function getLiteral($property, $default=null, $lang=null)
46
+    protected function getLiteral($property, $default = null, $lang = null)
47 47
     {
48 48
         if (!isset($lang)) {
49 49
             $lang = $this->getLang();
Please login to merge, or discard this patch.
src/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
                     }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     {
160 160
         $ret = array();
161 161
         $props = $this->resource->propertyUris();
162
-        foreach($props as $prop) {
162
+        foreach ($props as $prop) {
163 163
             $prop = (EasyRdf\RdfNamespace::shorten($prop) !== null) ? EasyRdf\RdfNamespace::shorten($prop) : $prop;
164 164
             $propkey = str_starts_with($prop, 'dc11:') ?
165 165
                 str_replace('dc11:', 'dc:', $prop) : $prop;
Please login to merge, or discard this patch.
src/model/DataObject.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
                 return isset($results[$lang]) ? $results[$lang] : null;
53 53
             } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) {
54 54
                 if ($this->model->getConfig()->getLogCaughtExceptions()) {
55
-                    error_log('Caught exception: ' . $e->getMessage());
55
+                    error_log('Caught exception: '.$e->getMessage());
56 56
                 }
57 57
             }
58 58
         }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
                 return isset($results) ? $results : null;
75 75
             } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) {
76 76
                 if ($this->model->getConfig()->getLogCaughtExceptions()) {
77
-                    error_log('Caught exception: ' . $e->getMessage());
77
+                    error_log('Caught exception: '.$e->getMessage());
78 78
                 }
79 79
             }
80 80
         }
Please login to merge, or discard this patch.
src/model/Concept.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
                 return $this->resource->label($fallback);
144 144
             }
145 145
             // We need to check all the labels in case one of them matches a subtag of the current language
146
-            foreach($this->resource->allLiterals('skos:prefLabel') as $label) {
146
+            foreach ($this->resource->allLiterals('skos:prefLabel') as $label) {
147 147
                 // the label lang code is a subtag of the UI lang eg. en-GB - create a new literal with the main language
148
-                if ($label !== null && strpos($label->getLang(), $fallback . '-') === 0) {
148
+                if ($label !== null && strpos($label->getLang(), $fallback.'-') === 0) {
149 149
                     return EasyRdf\Literal::create($label, $fallback);
150 150
                 }
151 151
             }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
     public function getXlLabel()
174 174
     {
175 175
         $labels = $this->resource->allResources('skosxl:prefLabel');
176
-        foreach($labels as $labres) {
176
+        foreach ($labels as $labres) {
177 177
             $label = $labres->getLiteral('skosxl:literalForm');
178 178
             if ($label !== null && $label->getLang() == $this->clang) {
179 179
                 return new LabelSkosXL($this->model, $labres);
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
         // catch external subjects that have $res as object
281 281
         $extSubjects = $exGraph->resourcesMatching("schema:about", $res);
282 282
 
283
-        $propList =  array_unique(array_merge(
283
+        $propList = array_unique(array_merge(
284 284
             $this->DEFAULT_EXT_PROPERTIES,
285 285
             $this->getVocab()->getConfig()->getExtProperties(),
286 286
             $this->getVocab()->getConfig()->getPluginRegister()->getExtProperties()
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
      * @param string[] $seen Processed resources so far
306 306
      * @param string[] $props (optional) limit to these property URIs
307 307
      */
308
-    private function addExternalTriplesToGraph($res, &$seen, $props=null)
308
+    private function addExternalTriplesToGraph($res, &$seen, $props = null)
309 309
     {
310 310
         if (array_key_exists($res->getUri(), $seen) && $seen[$res->getUri()] === 0) {
311 311
             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);
@@ -530,15 +530,15 @@  discard block
 block discarded – undo
530 530
                 // if not found in current vocabulary, look up in the default graph to be able
531 531
                 // to read an ontology loaded in a separate graph
532 532
                 // note that this imply that the property has an rdf:type declared for the query to work
533
-                if(!$is_well_known && !$proplabel) {
533
+                if (!$is_well_known && !$proplabel) {
534 534
                     $envLangLabels = $this->model->getDefaultSparql()->queryLabel($longUri, $this->getLang());
535 535
 
536 536
                     $defaultPropLabel = $this->model->getDefaultSparql()->queryLabel($longUri, '');
537 537
 
538
-                    if($envLangLabels) {
538
+                    if ($envLangLabels) {
539 539
                         $proplabel = $envLangLabels[$this->getLang()];
540 540
                     } else {
541
-                        if($defaultPropLabel) {
541
+                        if ($defaultPropLabel) {
542 542
                             $proplabel = $defaultPropLabel[''];
543 543
                         }
544 544
                     }
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
                 }
552 552
 
553 553
                 // also look up superprops in the default graph if not found in current vocabulary
554
-                if(!$is_well_known && (!$superprops || empty($superprops))) {
554
+                if (!$is_well_known && (!$superprops || empty($superprops))) {
555 555
                     $superprops = $this->model->getDefaultSparql()->querySuperProperties($longUri);
556 556
                 }
557 557
 
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
                 }
570 570
 
571 571
                 // searching for subproperties of literals too
572
-                if($superprops) {
572
+                if ($superprops) {
573 573
                     foreach ($superprops as $subi) {
574 574
                         $suburi = EasyRdf\RdfNamespace::shorten($subi) ? EasyRdf\RdfNamespace::shorten($subi) : $subi;
575 575
                         $duplicates[$suburi] = $prop;
@@ -733,14 +733,14 @@  discard block
 block discarded – undo
733 733
 
734 734
             // making a human readable string from the timestamps
735 735
             if ($created != '') {
736
-                $ret = $this->model->getText('skosmos:created') . ' ' . (Punic\Calendar::formatDate($created, 'short', $this->getLang()));
736
+                $ret = $this->model->getText('skosmos:created').' '.(Punic\Calendar::formatDate($created, 'short', $this->getLang()));
737 737
             }
738 738
 
739 739
             if ($modified != '') {
740 740
                 if ($created != '') {
741
-                    $ret .= ', ' . $this->model->getText('skosmos:modified') . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getLang()));
741
+                    $ret .= ', '.$this->model->getText('skosmos:modified').' '.(Punic\Calendar::formatDate($modified, 'short', $this->getLang()));
742 742
                 } else {
743
-                    $ret .= ' ' . ucfirst($this->model->getText('skosmos:modified')) . ' ' . (Punic\Calendar::formatDate($modified, 'short', $this->getLang()));
743
+                    $ret .= ' '.ucfirst($this->model->getText('skosmos:modified')).' '.(Punic\Calendar::formatDate($modified, 'short', $this->getLang()));
744 744
                 }
745 745
 
746 746
             }
@@ -748,12 +748,12 @@  discard block
 block discarded – undo
748 748
             trigger_error($e->getMessage(), E_USER_WARNING);
749 749
             $ret = '';
750 750
             if ($this->resource->get('dc:modified')) {
751
-                $modified = (string) $this->resource->get('dc:modified');
752
-                $ret = $this->model->getText('skosmos:modified') . ' ' . $modified;
751
+                $modified = (string)$this->resource->get('dc:modified');
752
+                $ret = $this->model->getText('skosmos:modified').' '.$modified;
753 753
             }
754 754
             if ($this->resource->get('dc:created')) {
755
-                $created .= (string) $this->resource->get('dc:created');
756
-                $ret .= ' ' . $this->model->getText('skosmos:created') . ' ' . $created;
755
+                $created .= (string)$this->resource->get('dc:created');
756
+                $ret .= ' '.$this->model->getText('skosmos:created').' '.$created;
757 757
             }
758 758
         }
759 759
         return $ret;
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
             $arrayClassURI = $this->vocab !== null ? $this->vocab->getConfig()->getArrayClassURI() : null;
810 810
             $arrayClass = $arrayClassURI !== null ? EasyRdf\RdfNamespace::shorten($arrayClassURI) : null;
811 811
             $superGroups = $this->resource->all('isothes:superGroup');
812
-            $superGroupUris = array_map(function ($obj) { return $obj->getUri(); }, $superGroups);
812
+            $superGroupUris = array_map(function($obj) { return $obj->getUri(); }, $superGroups);
813 813
             foreach ($collections as $collection) {
814 814
                 if (in_array($arrayClass, $collection->types()) === $includeArrays) {
815 815
                     // not adding the memberOf if the reverse resource is already covered by isothes:superGroup see issue #433
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
                     $groups[$collLabel] = array($group);
827 827
 
828 828
                     $res = $collection;
829
-                    while($super = $this->graph->resourcesMatching('skos:member', $res)) {
829
+                    while ($super = $this->graph->resourcesMatching('skos:member', $res)) {
830 830
                         foreach ($super as $res) {
831 831
                             $superprop = new ConceptPropertyValue($this->model, $this->vocab, $res, 'skosmos:memberOfSuper', $this->clang);
832 832
                             array_unshift($groups[$collLabel], $superprop);
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
         foreach ($labels as $lit) {
876 876
             // filtering away subsets of the current language eg. en vs en-GB
877 877
             $langCode = strval($lit->getLang());
878
-            if ($langCode != $this->clang && strpos($langCode, $this->getLang() . '-') !== 0) {
878
+            if ($langCode != $this->clang && strpos($langCode, $this->getLang().'-') !== 0) {
879 879
                 $ret[$langCode][$key][] = new ConceptPropertyValueLiteral($this->model, $this->vocab, $this->resource, $lit, $prop);
880 880
             }
881 881
         }
@@ -964,10 +964,10 @@  discard block
 block discarded – undo
964 964
                 $context[$vocabPrefix] = $vocabUriSpace;
965 965
             } elseif ($context[$vocabPrefix] !== $vocabUriSpace) {
966 966
                 $i = 2;
967
-                while (isset($context[$vocabPrefix . $i]) && $context[$vocabPrefix . $i] !== $vocabUriSpace) {
967
+                while (isset($context[$vocabPrefix.$i]) && $context[$vocabPrefix.$i] !== $vocabUriSpace) {
968 968
                     $i += 1;
969 969
                 }
970
-                $context[$vocabPrefix . $i] = $vocabUriSpace;
970
+                $context[$vocabPrefix.$i] = $vocabUriSpace;
971 971
             }
972 972
         }
973 973
         $compactJsonLD = \ML\JsonLD\JsonLD::compact($this->graph->serialise('jsonld'), json_encode($context));
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.