Passed
Pull Request — skosmos-2 (#1798)
by Osma
20:00 queued 13:24
created
model/resolver/LOCResource.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
             $opts = array('http' => array('method'=>'HEAD',
14 14
                                           'user_agent' => 'Skosmos',
15 15
                                           'timeout' => $timeout));
16
-            $context  = stream_context_create($opts);
16
+            $context = stream_context_create($opts);
17 17
             $fd = fopen($this->uri, 'rb', false, $context);
18 18
             $headers = stream_get_meta_data($fd)['wrapper_data'];
19 19
             foreach ($headers as $header) {
Please login to merge, or discard this patch.
model/sparql/GenericSparql.php 3 patches
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -47,12 +47,16 @@  discard block
 block discarded – undo
47 47
         $this->client = new EasyRdf\Sparql\Client($endpoint);
48 48
 
49 49
         // set graphClause so that it can be used by all queries
50
-        if ($this->isDefaultEndpoint()) // default endpoint; query any graph (and catch it in a variable)
50
+        if ($this->isDefaultEndpoint()) {
51
+          // default endpoint; query any graph (and catch it in a variable)
51 52
         {
52 53
             $this->graphClause = "GRAPH $graph";
53
-        } elseif ($graph !== null) // query a specific graph
54
+        }
55
+        } elseif ($graph !== null) {
56
+          // query a specific graph
54 57
         {
55 58
             $this->graphClause = "GRAPH <$graph>";
59
+        }
56 60
         } else // query the default graph
57 61
         {
58 62
             $this->graphClause = "";
@@ -1274,8 +1278,7 @@  discard block
 block discarded – undo
1274 1278
             if (isset($row->qualifier)) {
1275 1279
                 if ($row->qualifier instanceof EasyRdf\Literal) {
1276 1280
                     $hit['qualifier'] = $row->qualifier->getValue();
1277
-                }
1278
-                else {
1281
+                } else {
1279 1282
                     $hit['qualifier'] = $row->qualifier->localName();
1280 1283
                 }
1281 1284
             }
@@ -1955,8 +1958,7 @@  discard block
 block discarded – undo
1955 1958
         if (sizeof($ret) > 0) {
1956 1959
             // existing concept, with children
1957 1960
             return $ret;
1958
-        }
1959
-        else {
1961
+        } else {
1960 1962
             // nonexistent concept
1961 1963
             return null;
1962 1964
         }
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      *
66 66
      * @param string $query
67 67
      * @return string
68
-    */
68
+     */
69 69
     protected function generateQueryPrefixes($query)
70 70
     {
71 71
         // Check for undefined prefixes
@@ -233,9 +233,9 @@  discard block
 block discarded – undo
233 233
         $gcl = $this->graphClause;
234 234
         $classes = ($classes) ? $classes : array('http://www.w3.org/2004/02/skos/core#Concept');
235 235
 
236
-	$quote_string = function($val) { return "'$val'"; };
237
-	$quoted_values = array_map($quote_string, $langs);
238
-	$langFilter = "FILTER(?lang IN (" . implode(',', $quoted_values) . "))";
236
+  $quote_string = function($val) { return "'$val'"; };
237
+  $quoted_values = array_map($quote_string, $langs);
238
+  $langFilter = "FILTER(?lang IN (" . implode(',', $quoted_values) . "))";
239 239
 
240 240
         $values = $this->formatValues('?type', $classes, 'uri');
241 241
         $valuesProp = $this->formatValues('?prop', $props, null);
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
         return $query;
963 963
     }
964 964
     /**
965
-    *  This function can be overwritten in other SPARQL dialects for the possibility of handling the different language clauses
965
+     *  This function can be overwritten in other SPARQL dialects for the possibility of handling the different language clauses
966 966
      * @param string $lang
967 967
      * @return string formatted language clause
968 968
      */
@@ -1911,7 +1911,7 @@  discard block
 block discarded – undo
1911 1911
 
1912 1912
     /**
1913 1913
      * Generates a sparql query for finding the hierarchy for a concept.
1914
-	 * A concept may be a top concept in multiple schemes, returned as a single whitespace-separated literal.
1914
+     * A concept may be a top concept in multiple schemes, returned as a single whitespace-separated literal.
1915 1915
      * @param string $uri concept uri.
1916 1916
      * @param string $lang
1917 1917
      * @param string $fallback language to use if label is not available in the preferred language
@@ -1988,10 +1988,10 @@  discard block
 block discarded – undo
1988 1988
                 $ret[$uri]['exact'] = $row->exact->getUri();
1989 1989
             }
1990 1990
             if (isset($row->tops)) {
1991
-               $topConceptsList=explode(" ", $row->tops->getValue());
1992
-               // sort to guarantee an alphabetical ordering of the URI
1993
-               sort($topConceptsList);
1994
-               $ret[$uri]['tops'] = $topConceptsList;
1991
+                $topConceptsList=explode(" ", $row->tops->getValue());
1992
+                // sort to guarantee an alphabetical ordering of the URI
1993
+                sort($topConceptsList);
1994
+                $ret[$uri]['tops'] = $topConceptsList;
1995 1995
             }
1996 1996
             if (isset($row->children)) {
1997 1997
                 if (!isset($ret[$uri]['narrower'])) {
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
     {
105 105
         $queryId = sprintf("%05d", rand(0, 99999));
106 106
         $logger = $this->model->getLogger();
107
-        $logger->info("[qid $queryId] SPARQL query:\n" . $this->generateQueryPrefixes($query) . "\n$query\n");
107
+        $logger->info("[qid $queryId] SPARQL query:\n".$this->generateQueryPrefixes($query)."\n$query\n");
108 108
         $starttime = microtime(true);
109 109
         $result = $this->client->query($query);
110 110
         $elapsed = intval(round((microtime(true) - $starttime) * 1000));
111
-        if(method_exists($result, 'numRows')) {
111
+        if (method_exists($result, 'numRows')) {
112 112
             $numRows = $result->numRows();
113 113
             $logger->info("[qid $queryId] result: $numRows rows returned in $elapsed ms");
114 114
         } else { // graph result
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      */
127 127
     protected function query($query)
128 128
     {
129
-        $key = $this->endpoint . " " . $query;
129
+        $key = $this->endpoint." ".$query;
130 130
         if (!array_key_exists($key, self::$querycache)) {
131 131
             self::$querycache[$key] = $this->doQuery($query);
132 132
         }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      * @param Vocabulary[]|null $vocabs
140 140
      * @return string
141 141
      */
142
-    protected function generateFromClause($vocabs=null) {
142
+    protected function generateFromClause($vocabs = null) {
143 143
         $clause = '';
144 144
         if (!$vocabs) {
145 145
             return $this->graph !== '?graph' && $this->graph !== NULL ? "FROM <$this->graph>" : '';
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 
282 282
 	$quote_string = function($val) { return "'$val'"; };
283 283
 	$quoted_values = array_map($quote_string, $langs);
284
-	$langFilter = "FILTER(?lang IN (" . implode(',', $quoted_values) . "))";
284
+	$langFilter = "FILTER(?lang IN (".implode(',', $quoted_values)."))";
285 285
 
286 286
         $values = $this->formatValues('?type', $classes, 'uri');
287 287
         $valuesProp = $this->formatValues('?prop', $props, null);
@@ -725,9 +725,9 @@  discard block
 block discarded – undo
725 725
                 $conceptscheme['title'] = $row->title->getValue();
726 726
             }
727 727
             // add dct:subject and their labels in the result
728
-            if(isset($row->domain) && isset($row->domainLabel)){
729
-                $conceptscheme['subject']['uri']=$row->domain->getURI();
730
-                $conceptscheme['subject']['prefLabel']=$row->domainLabel->getValue();
728
+            if (isset($row->domain) && isset($row->domainLabel)) {
729
+                $conceptscheme['subject']['uri'] = $row->domain->getURI();
730
+                $conceptscheme['subject']['prefLabel'] = $row->domainLabel->getValue();
731 731
             }
732 732
 
733 733
             $ret[$row->cs->getURI()] = $conceptscheme;
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
           $values[] = "<$graph>";
795 795
         }
796 796
         if (count($values)) {
797
-          return "FILTER (?graph IN (" . implode(',', $values) . "))";
797
+          return "FILTER (?graph IN (".implode(',', $values)."))";
798 798
         }
799 799
     }
800 800
 
@@ -805,16 +805,16 @@  discard block
 block discarded – undo
805 805
      * @return string sparql query clauses
806 806
      */
807 807
     protected function formatLimitAndOffset($limit, $offset) {
808
-        $limit = ($limit) ? 'LIMIT ' . $limit : '';
809
-        $offset = ($offset) ? 'OFFSET ' . $offset : '';
808
+        $limit = ($limit) ? 'LIMIT '.$limit : '';
809
+        $offset = ($offset) ? 'OFFSET '.$offset : '';
810 810
         // eliminating whitespace and line changes when the conditions aren't needed.
811 811
         $limitandoffset = '';
812 812
         if ($limit && $offset) {
813
-            $limitandoffset = "\n" . $limit . "\n" . $offset;
813
+            $limitandoffset = "\n".$limit."\n".$offset;
814 814
         } elseif ($limit) {
815
-            $limitandoffset = "\n" . $limit;
815
+            $limitandoffset = "\n".$limit;
816 816
         } elseif ($offset) {
817
-            $limitandoffset = "\n" . $offset;
817
+            $limitandoffset = "\n".$offset;
818 818
         }
819 819
 
820 820
         return $limitandoffset;
@@ -953,7 +953,7 @@  discard block
 block discarded – undo
953 953
      * @param string|null $distinguisher SPARQL property path from concept to distinguisher object in case of shared prefLabels
954 954
      * @return string sparql query
955 955
      */
956
-    protected function generateConceptSearchQueryInner($term, $lang, $searchLang, $props, $unique, $filterGraph, $distinguisher=null)
956
+    protected function generateConceptSearchQueryInner($term, $lang, $searchLang, $props, $unique, $filterGraph, $distinguisher = null)
957 957
     {
958 958
         $valuesProp = $this->formatValues('?prop', $props);
959 959
         $textcond = $this->generateConceptSearchQueryCondition($term, $searchLang);
@@ -967,31 +967,31 @@  discard block
 block discarded – undo
967 967
         // if search language and UI/display language differ, must also consider case where there is no prefLabel in
968 968
         // the display language; in that case, should use the label with the same language as the matched label
969 969
         $labelcondFallback = ($searchLang != $lang) ?
970
-          "OPTIONAL { # in case previous OPTIONAL block gives no labels\n" .
970
+          "OPTIONAL { # in case previous OPTIONAL block gives no labels\n".
971 971
           "?s skos:prefLabel ?label . FILTER (LANGMATCHES(LANG(?label), LANG(?match))) }" : "";
972 972
 
973 973
         //  Including the labels if there is no query term given.
974 974
         if ($rawterm === '') {
975 975
           $labelClause = "?s skos:prefLabel ?label .";
976
-          $labelClause = ($lang) ? $labelClause . " FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause . "";
977
-          return $labelClause . " BIND(?label AS ?match)";
976
+          $labelClause = ($lang) ? $labelClause." FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause."";
977
+          return $labelClause." BIND(?label AS ?match)";
978 978
         }
979 979
 
980 980
         $distinguishercondLabel = "FILTER (LANG(?distLabel) = LANG(?label))";
981 981
         // Only include distinguisher labels in case of a shared prefLabel
982 982
         $distinguisherClause = $distinguisher ?
983
-            "OPTIONAL {\n" .
984
-            "  ?s skos:prefLabel ?label . ?s2 skos:prefLabel ?label . FILTER(?s2 != ?s)\n" .
985
-            "  ?s $distinguisher ?distinguisher.\n" .
986
-            "  FILTER (!isLiteral(?distinguisher) || (LANG(?distinguisher) = LANG(?label)))" .
987
-            "  OPTIONAL {\n" .
988
-            "    ?distinguisher skos:prefLabel ?distLabel .\n" .
989
-            "    $distinguishercondLabel\n" .
990
-            "  }\n" .
991
-            "  OPTIONAL {\n" .
992
-            "    ?distinguisher rdfs:label ?distLabel .\n" .
993
-            "    $distinguishercondLabel\n" .
994
-            "  }\n" .
983
+            "OPTIONAL {\n".
984
+            "  ?s skos:prefLabel ?label . ?s2 skos:prefLabel ?label . FILTER(?s2 != ?s)\n".
985
+            "  ?s $distinguisher ?distinguisher.\n".
986
+            "  FILTER (!isLiteral(?distinguisher) || (LANG(?distinguisher) = LANG(?label)))".
987
+            "  OPTIONAL {\n".
988
+            "    ?distinguisher skos:prefLabel ?distLabel .\n".
989
+            "    $distinguishercondLabel\n".
990
+            "  }\n".
991
+            "  OPTIONAL {\n".
992
+            "    ?distinguisher rdfs:label ?distLabel .\n".
993
+            "    $distinguishercondLabel\n".
994
+            "  }\n".
995 995
             "} BIND(COALESCE(?distLabel,STR(?distinguisher)) AS ?distcoal) " : "";
996 996
 
997 997
         /*
@@ -1064,20 +1064,20 @@  discard block
 block discarded – undo
1064 1064
         $schemecond = '';
1065 1065
         if (!empty($schemes)) {
1066 1066
             $conditions = array();
1067
-            foreach($schemes as $scheme) {
1067
+            foreach ($schemes as $scheme) {
1068 1068
                 $conditions[] = "{?s skos:inScheme <$scheme>}";
1069 1069
             }
1070
-            $schemecond = '{'.implode(" UNION ",$conditions).'}';
1070
+            $schemecond = '{'.implode(" UNION ", $conditions).'}';
1071 1071
         }
1072
-        $filterDeprecated="";
1072
+        $filterDeprecated = "";
1073 1073
         //show or hide deprecated concepts
1074
-        if(!$showDeprecated){
1075
-            $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }";
1074
+        if (!$showDeprecated) {
1075
+            $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }";
1076 1076
         }
1077 1077
         // extra conditions for parent and group, if specified
1078
-        $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <" . $params->getParentLimit() . "> ." : "";
1079
-        $groupcond = ($params->getGroupLimit()) ? "<" . $params->getGroupLimit() . "> skos:member ?s ." : "";
1080
-        $pgcond = $parentcond . $groupcond;
1078
+        $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <".$params->getParentLimit()."> ." : "";
1079
+        $groupcond = ($params->getGroupLimit()) ? "<".$params->getGroupLimit()."> skos:member ?s ." : "";
1080
+        $pgcond = $parentcond.$groupcond;
1081 1081
 
1082 1082
         $orderextra = $this->isDefaultEndpoint() ? $this->graph : '';
1083 1083
 
@@ -1166,9 +1166,9 @@  discard block
 block discarded – undo
1166 1166
             $hit['type'][] = $this->shortenUri($typeuri);
1167 1167
         }
1168 1168
 
1169
-        if(!empty($fields)) {
1169
+        if (!empty($fields)) {
1170 1170
             foreach ($fields as $prop) {
1171
-                $propname = $prop . 's';
1171
+                $propname = $prop.'s';
1172 1172
                 if (isset($row->$propname)) {
1173 1173
                     foreach (explode("\n", $row->$propname->getValue()) as $line) {
1174 1174
                         $rdata = str_getcsv($line, ',', '"', '"');
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
                             $propvals = $rdata[2];
1184 1184
                         }
1185 1185
 
1186
-                        $hit['skos:' . $prop][] = $propvals;
1186
+                        $hit['skos:'.$prop][] = $propvals;
1187 1187
                     }
1188 1188
                 }
1189 1189
             }
@@ -1263,7 +1263,7 @@  discard block
 block discarded – undo
1263 1263
      * @return array query result object
1264 1264
      */
1265 1265
     public function queryConcepts($vocabs, $fields, $unique, $params, $showDeprecated = false) {
1266
-        $query = $this->generateConceptSearchQuery($fields, $unique, $params,$showDeprecated);
1266
+        $query = $this->generateConceptSearchQuery($fields, $unique, $params, $showDeprecated);
1267 1267
         $results = $this->query($query);
1268 1268
         return $this->transformConceptSearchResults($results, $vocabs, $fields);
1269 1269
     }
@@ -1318,10 +1318,10 @@  discard block
 block discarded – undo
1318 1318
         $conditions = $this->formatFilterConditions($letter, $lang);
1319 1319
         $filtercondLabel = $conditions['filterpref'];
1320 1320
         $filtercondALabel = $conditions['filteralt'];
1321
-        $qualifierClause = $qualifier ? "OPTIONAL { ?s <" . $qualifier->getURI() . "> ?qualifier }" : "";
1322
-        $filterDeprecated="";
1323
-        if(!$showDeprecated){
1324
-            $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }";
1321
+        $qualifierClause = $qualifier ? "OPTIONAL { ?s <".$qualifier->getURI()."> ?qualifier }" : "";
1322
+        $filterDeprecated = "";
1323
+        if (!$showDeprecated) {
1324
+            $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }";
1325 1325
         }
1326 1326
         $query = <<<EOQ
1327 1327
 SELECT DISTINCT ?s ?label ?alabel ?qualifier
@@ -1798,7 +1798,7 @@  discard block
 block discarded – undo
1798 1798
                 if (!isset($row->label) || $row->label->getLang() === $lang) {
1799 1799
                     $ret[$row->object->getUri()] = $val;
1800 1800
                 } elseif ($row->label->getLang() === $fallbacklang) {
1801
-                    $val['label'] .= ' (' . $row->label->getLang() . ')';
1801
+                    $val['label'] .= ' ('.$row->label->getLang().')';
1802 1802
                     $ret[$row->object->getUri()] = $val;
1803 1803
                 }
1804 1804
             }
@@ -1894,10 +1894,10 @@  discard block
 block discarded – undo
1894 1894
 
1895 1895
             $label = null;
1896 1896
             if (isset($row->label)) {
1897
-                if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) {
1897
+                if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) {
1898 1898
                     $label = $row->label->getValue();
1899 1899
                 } else {
1900
-                    $label = $row->label->getValue() . " (" . $row->label->getLang() . ")";
1900
+                    $label = $row->label->getValue()." (".$row->label->getLang().")";
1901 1901
                 }
1902 1902
 
1903 1903
             }
@@ -1973,8 +1973,8 @@  discard block
 block discarded – undo
1973 1973
         foreach ($result as $row) {
1974 1974
             if (isset($row->top) && isset($row->label)) {
1975 1975
                 $label = $row->label->getValue();
1976
-                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) {
1977
-                    $label .= ' (' . $row->label->getLang() . ')';
1976
+                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) {
1977
+                    $label .= ' ('.$row->label->getLang().')';
1978 1978
                 }
1979 1979
                 $top = array('uri' => $row->top->getUri(), 'topConceptOf' => $row->topuri->getUri(), 'label' => $label, 'hasChildren' => filter_var($row->children->getValue(), FILTER_VALIDATE_BOOLEAN));
1980 1980
                 if (isset($row->notation)) {
@@ -2067,7 +2067,7 @@  discard block
 block discarded – undo
2067 2067
                 $ret[$uri]['exact'] = $row->exact->getUri();
2068 2068
             }
2069 2069
             if (isset($row->tops)) {
2070
-               $topConceptsList=explode(" ", $row->tops->getValue());
2070
+               $topConceptsList = explode(" ", $row->tops->getValue());
2071 2071
                // sort to guarantee an alphabetical ordering of the URI
2072 2072
                sort($topConceptsList);
2073 2073
                $ret[$uri]['tops'] = $topConceptsList;
@@ -2080,8 +2080,8 @@  discard block
 block discarded – undo
2080 2080
                 $label = null;
2081 2081
                 if (isset($row->childlabel)) {
2082 2082
                     $label = $row->childlabel->getValue();
2083
-                    if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang . "-") !== 0) {
2084
-                        $label .= " (" . $row->childlabel->getLang() . ")";
2083
+                    if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang."-") !== 0) {
2084
+                        $label .= " (".$row->childlabel->getLang().")";
2085 2085
                     }
2086 2086
 
2087 2087
                 }
@@ -2102,8 +2102,8 @@  discard block
 block discarded – undo
2102 2102
             }
2103 2103
             if (isset($row->label)) {
2104 2104
                 $preflabel = $row->label->getValue();
2105
-                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) {
2106
-                    $preflabel .= ' (' . $row->label->getLang() . ')';
2105
+                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) {
2106
+                    $preflabel .= ' ('.$row->label->getLang().')';
2107 2107
                 }
2108 2108
 
2109 2109
                 $ret[$uri]['prefLabel'] = $preflabel;
@@ -2224,9 +2224,9 @@  discard block
 block discarded – undo
2224 2224
      */
2225 2225
     private function generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated = false) {
2226 2226
         $fcl = $this->generateFromClause();
2227
-        $filterDeprecated="";
2228
-        if(!$showDeprecated){
2229
-            $filterDeprecated="  FILTER NOT EXISTS { ?conc owl:deprecated true }";
2227
+        $filterDeprecated = "";
2228
+        if (!$showDeprecated) {
2229
+            $filterDeprecated = "  FILTER NOT EXISTS { ?conc owl:deprecated true }";
2230 2230
         }
2231 2231
         $query = <<<EOQ
2232 2232
 SELECT ?conc ?super ?label ?members ?type ?notation $fcl
@@ -2265,10 +2265,10 @@  discard block
 block discarded – undo
2265 2265
                     'type' => array($row->type->shorten()),
2266 2266
                 );
2267 2267
                 if (isset($row->label)) {
2268
-                    if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) {
2268
+                    if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) {
2269 2269
                         $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue();
2270 2270
                     } else {
2271
-                        $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue() . " (" . $row->label->getLang() . ")";
2271
+                        $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue()." (".$row->label->getLang().")";
2272 2272
                     }
2273 2273
 
2274 2274
                 }
@@ -2296,8 +2296,8 @@  discard block
 block discarded – undo
2296 2296
      * @param boolean $showDeprecated whether to include deprecated concepts in search results
2297 2297
      * @return array Result array with concept URI as key and concept label as value
2298 2298
      */
2299
-    public function listConceptGroupContents($groupClass, $group, $lang,$showDeprecated = false) {
2300
-        $query = $this->generateConceptGroupContentsQuery($groupClass, $group, $lang,$showDeprecated);
2299
+    public function listConceptGroupContents($groupClass, $group, $lang, $showDeprecated = false) {
2300
+        $query = $this->generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated);
2301 2301
         $result = $this->query($query);
2302 2302
         return $this->transformConceptGroupContentsResults($result, $lang);
2303 2303
     }
@@ -2311,9 +2311,9 @@  discard block
 block discarded – undo
2311 2311
      * @param boolean $showDeprecated whether to include deprecated concepts in the change list
2312 2312
      * @return string sparql query
2313 2313
      */
2314
-    private function generateChangeListQuery($prop, $lang, $offset, $limit=200, $showDeprecated=false) {
2314
+    private function generateChangeListQuery($prop, $lang, $offset, $limit = 200, $showDeprecated = false) {
2315 2315
         $fcl = $this->generateFromClause();
2316
-        $offset = ($offset) ? 'OFFSET ' . $offset : '';
2316
+        $offset = ($offset) ? 'OFFSET '.$offset : '';
2317 2317
 
2318 2318
         //Additional clauses when deprecated concepts need to be included in the results
2319 2319
         $deprecatedOptions = '';
@@ -2403,7 +2403,7 @@  discard block
 block discarded – undo
2403 2403
      * @param boolean $showDeprecated whether to include deprecated concepts in the change list
2404 2404
      * @return array Result array
2405 2405
      */
2406
-    public function queryChangeList($prop, $lang, $offset, $limit, $showDeprecated=false) {
2406
+    public function queryChangeList($prop, $lang, $offset, $limit, $showDeprecated = false) {
2407 2407
         $query = $this->generateChangeListQuery($prop, $lang, $offset, $limit, $showDeprecated);
2408 2408
 
2409 2409
         $result = $this->query($query);
Please login to merge, or discard this patch.
model/sparql/JenaTextSparql.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         // 1. Ensure characters with special meaning in Lucene are escaped
42 42
         $lucenemap = array();
43 43
         foreach (str_split(self::LUCENE_ESCAPE_CHARS) as $char) {
44
-            $lucenemap[$char] = '\\' . $char; // escape with a backslash
44
+            $lucenemap[$char] = '\\'.$char; // escape with a backslash
45 45
         }
46 46
         $term = strtr($term, $lucenemap);
47 47
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      * @return string sparql order by clause
93 93
      */
94 94
     private function formatOrderBy($expression, $lang) {
95
-        if(!$this->model->getConfig()->getCollationEnabled()) {
95
+        if (!$this->model->getConfig()->getCollationEnabled()) {
96 96
             return $expression;
97 97
         }
98 98
         $orderby = sprintf('arq:collation(\'%2$s\', %1$s)', $expression, $lang);
@@ -126,15 +126,15 @@  discard block
 block discarded – undo
126 126
         # make text query clause
127 127
         $lcletter = mb_strtolower($letter, 'UTF-8'); // convert to lower case, UTF-8 safe
128 128
         $langClause = $this->generateLangClause($lang);
129
-        $textcondPref = $this->createTextQueryCondition($letter . '*', 'skos:prefLabel', $langClause);
130
-        $textcondAlt = $this->createTextQueryCondition($letter . '*', 'skos:altLabel', $langClause);
131
-        $orderbyclause = $this->formatOrderBy("LCASE(?match)", $lang) . " STR(?s) LCASE(STR(?qualifier))";
129
+        $textcondPref = $this->createTextQueryCondition($letter.'*', 'skos:prefLabel', $langClause);
130
+        $textcondAlt = $this->createTextQueryCondition($letter.'*', 'skos:altLabel', $langClause);
131
+        $orderbyclause = $this->formatOrderBy("LCASE(?match)", $lang)." STR(?s) LCASE(STR(?qualifier))";
132 132
 
133
-        $qualifierClause = $qualifier ? "OPTIONAL { ?s <" . $qualifier->getURI() . "> ?qualifier }" : "";
133
+        $qualifierClause = $qualifier ? "OPTIONAL { ?s <".$qualifier->getURI()."> ?qualifier }" : "";
134 134
 
135
-        $filterDeprecated="";
136
-        if(!$showDeprecated){
137
-            $filterDeprecated="FILTER NOT EXISTS { ?s owl:deprecated true }";
135
+        $filterDeprecated = "";
136
+        if (!$showDeprecated) {
137
+            $filterDeprecated = "FILTER NOT EXISTS { ?s owl:deprecated true }";
138 138
         }
139 139
 
140 140
         $query = <<<EOQ
Please login to merge, or discard this patch.
controller/Controller.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -156,18 +156,18 @@  discard block
 block discarded – undo
156 156
         $localname = $vocab->getLocalName($uri);
157 157
         if ($localname !== $uri && $localname === urlencode($localname)) {
158 158
             // check that the prefix stripping worked, and there are no problematic chars in localname
159
-            $paramstr = count($params) > 0 ? '?' . http_build_query($params) : '';
159
+            $paramstr = count($params) > 0 ? '?'.http_build_query($params) : '';
160 160
             if ($type && $type !== '' && $type !== 'vocab' && !($localname === '' && $type === 'page')) {
161
-                return "$vocid/$lang/$type/$localname" . $paramstr;
161
+                return "$vocid/$lang/$type/$localname".$paramstr;
162 162
             }
163 163
 
164
-            return "$vocid/$lang/$localname" . $paramstr;
164
+            return "$vocid/$lang/$localname".$paramstr;
165 165
         }
166 166
 
167 167
         // case 2: URI outside vocabulary namespace, or has problematic chars
168 168
         // pass the full URI as parameter instead
169 169
         $params['uri'] = $uri;
170
-        return "$vocid/$lang/$type/?" . http_build_query($params);
170
+        return "$vocid/$lang/$type/?".http_build_query($params);
171 171
     }
172 172
 
173 173
     /**
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
     {
294 294
         if ($modifiedDate) {
295 295
             $ifModifiedSince = $this->getIfModifiedSince();
296
-            $this->sendHeader("Last-Modified: " . $modifiedDate->format('D, d M Y H:i:s \G\M\T'));
296
+            $this->sendHeader("Last-Modified: ".$modifiedDate->format('D, d M Y H:i:s \G\M\T'));
297 297
             if ($ifModifiedSince !== null && $ifModifiedSince >= $modifiedDate) {
298 298
                 $this->sendHeader("HTTP/1.0 304 Not Modified");
299 299
                 return true;
Please login to merge, or discard this patch.
model/ConceptProperty.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
             return $help;
73 73
         }
74 74
 
75
-       // if not, see if there was a comment/definition for the property in the graph
75
+        // if not, see if there was a comment/definition for the property in the graph
76 76
         if ($this->tooltip !== null) {
77 77
             return $this->tooltip;
78 78
         }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      * @param string $super URI of superproperty
28 28
      * @param boolean $sort_by_notation whether to sort the property values by their notation code
29 29
      */
30
-    public function __construct($prop, $label, $tooltip=null, $super=null, $sort_by_notation=false)
30
+    public function __construct($prop, $label, $tooltip = null, $super = null, $sort_by_notation = false)
31 31
     {
32 32
         $this->prop = $prop;
33 33
         $this->label = $label;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function getDescription()
69 69
     {
70
-        $helpprop = $this->prop . "_help";
70
+        $helpprop = $this->prop."_help";
71 71
 
72 72
         // see if we have a translation with the help text
73 73
         $help = gettext($helpprop);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
     public function addValue($value)
100 100
     {
101
-        $this->values[ltrim($value->getNotation() . ' ') . $value->getLabel() . rtrim(' ' . $value->getUri())] = $value;
101
+        $this->values[ltrim($value->getNotation().' ').$value->getLabel().rtrim(' '.$value->getUri())] = $value;
102 102
         $this->is_sorted = false;
103 103
     }
104 104
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -125,11 +125,9 @@  discard block
 block discarded – undo
125 125
                             return strcoll(strtolower($a->getLabel()), strtolower($b->getLabel()));
126 126
                         }
127 127
                         return 1;
128
-                    }
129
-                    else if ($bnot == null) {
128
+                    } else if ($bnot == null) {
130 129
                         return -1;
131
-                    }
132
-                    else {
130
+                    } else {
133 131
                         // assume that notations are unique, choose strategy
134 132
                         if ($this->sort_by_notation == "lexical") {
135 133
                             return strcoll($anot, $bnot);
@@ -138,8 +136,7 @@  discard block
 block discarded – undo
138 136
                         }
139 137
                     }
140 138
                 });
141
-            }
142
-            else {
139
+            } else {
143 140
                 uasort($this->values, function($a, $b) {
144 141
                     // assume that labels are unique
145 142
                     return strcoll(strtolower($a->getLabel()), strtolower($b->getLabel()));
Please login to merge, or discard this patch.
model/ConceptMappingPropertyValue.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         $label = $this->getLabel();
38 38
         $notation = $this->getNotation();
39
-        return ltrim($notation . ' ') . $label;
39
+        return ltrim($notation.' ').$label;
40 40
     }
41 41
 
42 42
     public function getType()
@@ -180,25 +180,25 @@  discard block
 block discarded – undo
180 180
             'from' => [
181 181
                 'memberSet' => [
182 182
                     [
183
-                        'uri' => (string) $this->source->getUri(),
183
+                        'uri' => (string)$this->source->getUri(),
184 184
                     ]
185 185
                 ]
186 186
             ],
187 187
             'to' => [
188 188
                 'memberSet' => [
189 189
                     [
190
-                        'uri' => (string) $this->getUri()
190
+                        'uri' => (string)$this->getUri()
191 191
                     ]
192 192
                 ]
193 193
             ],
194 194
             // EXTRA
195 195
             'hrefLink' => $hrefLink, // link to resource as displayed in the UI
196 196
             'lang' => $propertyLang, // TBD: could it be part of the prefLabel?
197
-            'vocabName' => (string) $this->getVocabName(), // vocabulary as displayed in the UI
197
+            'vocabName' => (string)$this->getVocabName(), // vocabulary as displayed in the UI
198 198
             'typeLabel' => gettext($this->type), // a text used in the UI instead of, for example, skos:closeMatch
199 199
         ];
200 200
 
201
-        $helpprop = $this->type . "_help";
201
+        $helpprop = $this->type."_help";
202 202
         // see if we have a translation for the property help text
203 203
         $help = gettext($helpprop);
204 204
         if ($help != $helpprop) {
@@ -208,20 +208,20 @@  discard block
 block discarded – undo
208 208
         $fromScheme = $this->vocab->getDefaultConceptScheme();
209 209
         if (isset($fromScheme)) {
210 210
             $ret['fromScheme'] = [
211
-                'uri' => (string) $fromScheme,
211
+                'uri' => (string)$fromScheme,
212 212
             ];
213 213
         }
214 214
 
215 215
         $exvocab = $this->getExvocab();
216 216
         if (isset($exvocab)) {
217 217
             $ret['toScheme'] = [
218
-                'uri' => (string) $exvocab->getDefaultConceptScheme(),
218
+                'uri' => (string)$exvocab->getDefaultConceptScheme(),
219 219
             ];
220 220
         }
221 221
 
222 222
         $notation = $this->getNotation();
223 223
         if (isset($notation)) {
224
-            $ret['to']['memberSet'][0]['notation'] = (string) $notation;
224
+            $ret['to']['memberSet'][0]['notation'] = (string)$notation;
225 225
         }
226 226
 
227 227
         $label = $this->getLabel($lang, $queryExVocabs);
Please login to merge, or discard this patch.
model/Model.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -354,10 +354,12 @@
 block discarded – undo
354 354
                 // register vocabulary ids as RDF namespace prefixes
355 355
                 $prefix = preg_replace('/\W+/', '', $voc->getId()); // strip non-word characters
356 356
                 try {
357
-                    if ($prefix != '' && EasyRdf\RdfNamespace::get($prefix) === null) // if not already defined
357
+                    if ($prefix != '' && EasyRdf\RdfNamespace::get($prefix) === null) {
358
+                      // if not already defined
358 359
                     {
359 360
                         EasyRdf\RdfNamespace::set($prefix, $voc->getUriSpace());
360 361
                     }
362
+                    }
361 363
 
362 364
                 } catch (Exception $e) {
363 365
                     // not valid as namespace identifier, ignore
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -220,18 +220,18 @@  discard block
 block discarded – undo
220 220
         }
221 221
 
222 222
         $vocabs = $params->getVocabs();
223
-        $showDeprecated=false;
223
+        $showDeprecated = false;
224 224
         if (sizeof($vocabs) === 1) { // search within vocabulary
225 225
             $voc = $vocabs[0];
226 226
             $sparql = $voc->getSparql();
227
-            $showDeprecated=$voc->getConfig()->getShowDeprecated();
227
+            $showDeprecated = $voc->getConfig()->getShowDeprecated();
228 228
         } else { // multi-vocabulary or global search
229 229
             $voc = null;
230 230
             $sparql = $this->getDefaultSparql();
231 231
             // @TODO : in a global search showDeprecated will always be false and cannot be set globally
232 232
         }
233 233
 
234
-        $results = $sparql->queryConcepts($vocabs, $params->getAdditionalFields(), $params->getUnique(), $params,$showDeprecated);
234
+        $results = $sparql->queryConcepts($vocabs, $params->getAdditionalFields(), $params->getUnique(), $params, $showDeprecated);
235 235
         if ($params->getRest() && $results && $params->getSearchLimit() !== 0) {
236 236
           $results = array_slice($results, $params->getOffset(), $params->getSearchLimit());
237 237
         }
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
     public function getVocabularyCategories()
387 387
     {
388 388
         $cats = $this->globalConfig->getGraph()->allOfType('skos:Concept');
389
-        if(empty($cats)) {
389
+        if (empty($cats)) {
390 390
             return array(new VocabularyCategory($this, null));
391 391
         }
392 392
 
@@ -467,9 +467,9 @@  discard block
 block discarded – undo
467 467
         }
468 468
 
469 469
         // if there are multiple vocabularies and one is the preferred vocabulary, return it
470
-        if($preferredVocabId != null) {
470
+        if ($preferredVocabId != null) {
471 471
             foreach ($vocabs as $vocab) {
472
-                if($vocab->getId() == $preferredVocabId) {
472
+                if ($vocab->getId() == $preferredVocabId) {
473 473
                     try {
474 474
                         // double check that a label exists in the preferred vocabulary
475 475
                         if ($vocab->getConceptLabel($uri, null) !== null) {
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
                         }
481 481
                     } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) {
482 482
                         if ($this->getConfig()->getLogCaughtExceptions()) {
483
-                            error_log('Caught exception: ' . $e->getMessage());
483
+                            error_log('Caught exception: '.$e->getMessage());
484 484
                         }
485 485
                         break;
486 486
                     }
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
                 }
497 497
             } catch (EasyRdf\Http\Exception | EasyRdf\Exception | Throwable $e) {
498 498
                 if ($this->getConfig()->getLogCaughtExceptions()) {
499
-                    error_log('Caught exception: ' . $e->getMessage());
499
+                    error_log('Caught exception: '.$e->getMessage());
500 500
                 }
501 501
                 break;
502 502
             }
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
         // using apc cache for the resource if available
567 567
         if ($this->globalConfig->getCache()->isAvailable()) {
568 568
             // @codeCoverageIgnoreStart
569
-            $key = 'fetch: ' . $uri;
569
+            $key = 'fetch: '.$uri;
570 570
             $resource = $this->globalConfig->getCache()->fetch($key);
571 571
             if ($resource === null || $resource === false) { // was not found in cache, or previous request failed
572 572
                 $resource = $this->resolver->resolve($uri, $this->getConfig()->getHttpTimeout());
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
      */
588 588
     public function getSparqlImplementation($dialect, $endpoint, $graph)
589 589
     {
590
-        $classname = $dialect . "Sparql";
590
+        $classname = $dialect."Sparql";
591 591
 
592 592
         return new $classname($endpoint, $graph, $this);
593 593
     }
Please login to merge, or discard this patch.
controller/WebController.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -266,11 +266,17 @@
 block discarded – undo
266 266
         $envelopeSender = $this->model->getConfig()->getFeedbackEnvelopeSender();
267 267
         // determine the sender address of the message
268 268
         $sender = $this->model->getConfig()->getFeedbackSender();
269
-        if (empty($sender)) $sender = $envelopeSender;
270
-        if (empty($sender)) $sender = $this->model->getConfig()->getFeedbackAddress();
269
+        if (empty($sender)) {
270
+          $sender = $envelopeSender;
271
+        }
272
+        if (empty($sender)) {
273
+          $sender = $this->model->getConfig()->getFeedbackAddress();
274
+        }
271 275
 
272 276
         // determine sender name - default to "anonymous user" if not given by user
273
-        if (empty($fromName)) $fromName = "anonymous user";
277
+        if (empty($fromName)) {
278
+          $fromName = "anonymous user";
279
+        }
274 280
         $headers = $this->createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender);
275 281
         $params = empty($envelopeSender) ? '' : "-f $envelopeSender";
276 282
         // adding some information about the user for debugging purposes.
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         // specify where to look for templates and cache
38 38
         $loader = new Twig_Loader_Filesystem('view');
39 39
         // initialize Twig environment
40
-        $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir,'auto_reload' => true));
40
+        $this->twig = new Twig_Environment($loader, array('cache' => $tmpDir, 'auto_reload' => true));
41 41
         $this->twig->addExtension(new Twig_Extensions_Extension_I18n());
42 42
         // used for setting the base href for the relative urls
43 43
         $this->twig->addGlobal("BaseHref", $this->getBaseHref());
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $this->twig->addFilter(new Twig_SimpleFilter('link_url', array($this, 'linkUrlFilter')));
61 61
 
62 62
         // register a Twig filter for generating strings from language codes with CLDR
63
-        $langFilter = new Twig_SimpleFilter('lang_name', function ($langcode, $lang) {
63
+        $langFilter = new Twig_SimpleFilter('lang_name', function($langcode, $lang) {
64 64
             return Language::getName($langcode, $lang);
65 65
         });
66 66
         $this->twig->addFilter($langFilter);
@@ -234,16 +234,16 @@  discard block
 block discarded – undo
234 234
 
235 235
     private function createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender)
236 236
     {
237
-        $headers = "MIME-Version: 1.0" . "\r\n";
238
-        $headers .= "Content-type: text/html; charset=UTF-8" . "\r\n";
237
+        $headers = "MIME-Version: 1.0"."\r\n";
238
+        $headers .= "Content-type: text/html; charset=UTF-8"."\r\n";
239 239
         if (!empty($toMail)) {
240
-            $headers .= "Cc: " . $this->model->getConfig()->getFeedbackAddress() . "\r\n";
240
+            $headers .= "Cc: ".$this->model->getConfig()->getFeedbackAddress()."\r\n";
241 241
         }
242 242
         if (!empty($fromEmail)) {
243 243
             $headers .= "Reply-To: $fromName <$fromEmail>\r\n";
244 244
         }
245 245
         $service = $this->model->getConfig()->getServiceName();
246
-        return $headers . "From: $fromName via $service <$sender>";
246
+        return $headers."From: $fromName via $service <$sender>";
247 247
     }
248 248
 
249 249
     /**
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
     public function sendFeedback($request, $message, $messageSubject, $fromName = null, $fromEmail = null, $fromVocab = null, $toMail = null)
258 258
     {
259 259
         $toAddress = ($toMail) ? $toMail : $this->model->getConfig()->getFeedbackAddress();
260
-        $messageSubject = "[" . $this->model->getConfig()->getServiceName() . "] " . $messageSubject;
260
+        $messageSubject = "[".$this->model->getConfig()->getServiceName()."] ".$messageSubject;
261 261
         if ($fromVocab !== null && $fromVocab !== '') {
262
-            $message = 'Feedback from vocab: ' . strtoupper($fromVocab) . "<br />" . $message;
262
+            $message = 'Feedback from vocab: '.strtoupper($fromVocab)."<br />".$message;
263 263
         }
264 264
         $envelopeSender = $this->model->getConfig()->getFeedbackEnvelopeSender();
265 265
         // determine the sender address of the message
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
         $headers = $this->createFeedbackHeaders($fromName, $fromEmail, $toMail, $sender);
273 273
         $params = empty($envelopeSender) ? '' : "-f $envelopeSender";
274 274
         // adding some information about the user for debugging purposes.
275
-        $message = $message . "<br /><br /> Debugging information:"
276
-            . "<br />Timestamp: " . date(DATE_RFC2822)
277
-            . "<br />User agent: " . $request->getServerConstant('HTTP_USER_AGENT')
278
-            . "<br />Referer: " . $request->getServerConstant('HTTP_REFERER');
275
+        $message = $message."<br /><br /> Debugging information:"
276
+            . "<br />Timestamp: ".date(DATE_RFC2822)
277
+            . "<br />User agent: ".$request->getServerConstant('HTTP_USER_AGENT')
278
+            . "<br />Referer: ".$request->getServerConstant('HTTP_REFERER');
279 279
 
280 280
         try {
281 281
             mail($toAddress, $messageSubject, $message, $headers, $params);
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
             header("HTTP/1.0 404 Not Found");
284 284
             $template = $this->twig->loadTemplate('error-page.twig');
285 285
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
286
-                error_log('Caught exception: ' . $e->getMessage());
286
+                error_log('Caught exception: '.$e->getMessage());
287 287
             }
288 288
 
289 289
             echo $template->render(
@@ -328,13 +328,13 @@  discard block
 block discarded – undo
328 328
         $vocids = ($vocabs !== null && $vocabs !== '') ? explode(' ', $vocabs) : null;
329 329
         $vocabObjects = array();
330 330
         if ($vocids) {
331
-            foreach($vocids as $vocid) {
331
+            foreach ($vocids as $vocid) {
332 332
                 try {
333 333
                     $vocabObjects[] = $this->model->getVocabulary($vocid);
334 334
                 } catch (ValueError $e) {
335 335
                     // fail fast with an error page if the vocabulary cannot be found
336 336
                     if ($this->model->getConfig()->getLogCaughtExceptions()) {
337
-                        error_log('Caught exception: ' . $e->getMessage());
337
+                        error_log('Caught exception: '.$e->getMessage());
338 338
                     }
339 339
                     header("HTTP/1.0 400 Bad Request");
340 340
                     $this->invokeGenericErrorPage($request, $e->getMessage());
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
             $errored = true;
357 357
             header("HTTP/1.0 500 Internal Server Error");
358 358
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
359
-                error_log('Caught exception: ' . $e->getMessage());
359
+                error_log('Caught exception: '.$e->getMessage());
360 360
             }
361 361
         }
362 362
         $vocabList = $this->model->getVocabularyList();
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
                 'search_count' => $counts,
369 369
                 'languages' => $this->languages,
370 370
                 'search_results' => $searchResults,
371
-                'rest' => $parameters->getOffset()>0,
371
+                'rest' => $parameters->getOffset() > 0,
372 372
                 'global_search' => true,
373 373
                 'search_failed' => $errored,
374 374
                 'term' => $request->getQueryParamRaw('q'),
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
         } catch (Exception $e) {
396 396
             header("HTTP/1.0 500 Internal Server Error");
397 397
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
398
-                error_log('Caught exception: ' . $e->getMessage());
398
+                error_log('Caught exception: '.$e->getMessage());
399 399
             }
400 400
 
401 401
             echo $template->render(
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
         } catch (Exception $e) {
420 420
             header("HTTP/1.0 404 Not Found");
421 421
             if ($this->model->getConfig()->getLogCaughtExceptions()) {
422
-                error_log('Caught exception: ' . $e->getMessage());
422
+                error_log('Caught exception: '.$e->getMessage());
423 423
             }
424 424
 
425 425
             echo $template->render(
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
                 'vocab' => $vocab,
438 438
                 'search_results' => $searchResults,
439 439
                 'search_count' => $counts,
440
-                'rest' => $parameters->getOffset()>0,
440
+                'rest' => $parameters->getOffset() > 0,
441 441
                 'limit_parent' => $parameters->getParentLimit(),
442 442
                 'limit_type' =>  $request->getQueryParam('type') ? explode('+', $request->getQueryParam('type')) : null,
443 443
                 'limit_group' => $parameters->getGroupLimit(),
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
      * Loads and renders the view containing a list of recent changes in the vocabulary.
570 570
      * @param Request $request
571 571
      */
572
-    public function invokeChangeList($request, $prop='dc:created')
572
+    public function invokeChangeList($request, $prop = 'dc:created')
573 573
     {
574 574
         $offset = ($request->getQueryParam('offset') && is_numeric($request->getQueryParam('offset')) && $request->getQueryParam('offset') >= 0) ? $request->getQueryParam('offset') : 0;
575 575
         $limit = ($request->getQueryParam('limit') && is_numeric($request->getQueryParam('limit')) && $request->getQueryParam('limit') >= 0) ? $request->getQueryParam('limit') : 200;
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
      * @param int $limit maximum number of concepts to return
598 598
      * @return Array list of concepts
599 599
      */
600
-    public function getChangeList($request, $prop, $offset=0, $limit=200)
600
+    public function getChangeList($request, $prop, $offset = 0, $limit = 200)
601 601
     {
602 602
         // set language parameters for gettext
603 603
         $this->setLanguageProperties($request->getLang());
@@ -614,9 +614,9 @@  discard block
 block discarded – undo
614 614
     public function formatChangeList($changeList, $lang)
615 615
     {
616 616
         $formatByDate = array();
617
-        foreach($changeList as $concept) {
617
+        foreach ($changeList as $concept) {
618 618
             $concept['datestring'] = Punic\Calendar::formatDate($concept['date'], 'medium', $lang);
619
-            $formatByDate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true) . Punic\Calendar::format($concept['date'], ' y', $lang) ][strtolower($concept['prefLabel'])] = $concept;
619
+            $formatByDate[Punic\Calendar::getMonthName($concept['date'], 'wide', $lang, true).Punic\Calendar::format($concept['date'], ' y', $lang)][strtolower($concept['prefLabel'])] = $concept;
620 620
         }
621 621
         return $formatByDate;
622 622
     }
Please login to merge, or discard this patch.
controller/Honeypot.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
     {
33 33
         // Encrypt the current time
34 34
         $honey_time_encrypted = $this->getEncryptedTime();
35
-        return '<div id="' . $honey_name . '_wrap" style="display:none;">' . "\r\n" .
36
-               '<input name="' . $honey_name . '" type="text" value="" id="' . $honey_name . '"/>' . "\r\n" .
37
-               '<input name="' . $honey_time . '" type="text" value="' . $honey_time_encrypted . '"/>' . "\r\n" .
35
+        return '<div id="'.$honey_name.'_wrap" style="display:none;">'."\r\n".
36
+               '<input name="'.$honey_name.'" type="text" value="" id="'.$honey_name.'"/>'."\r\n".
37
+               '<input name="'.$honey_time.'" type="text" value="'.$honey_time_encrypted.'"/>'."\r\n".
38 38
                 '</div>';
39 39
     }
40 40
     /**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         // Get the decrypted time
67 67
         $value = $this->decryptTime($value);
68 68
         // The current time should be greater than the time the form was built + minimum
69
-        return ( is_numeric($value) && time() > ($value + $minDelta) );
69
+        return (is_numeric($value) && time() > ($value + $minDelta));
70 70
     }
71 71
     /**
72 72
      * Get encrypted time
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,16 +33,16 @@
 block discarded – undo
33 33
         // Encrypt the current time
34 34
         $honey_time_encrypted = $this->getEncryptedTime();
35 35
         return '<div id="' . $honey_name . '_wrap" style="display:none;">' . "\r\n" .
36
-               '<input name="' . $honey_name . '" type="text" value="" id="' . $honey_name . '"/>' . "\r\n" .
37
-               '<input name="' . $honey_time . '" type="text" value="' . $honey_time_encrypted . '"/>' . "\r\n" .
36
+                '<input name="' . $honey_name . '" type="text" value="" id="' . $honey_name . '"/>' . "\r\n" .
37
+                '<input name="' . $honey_time . '" type="text" value="' . $honey_time_encrypted . '"/>' . "\r\n" .
38 38
                 '</div>';
39 39
     }
40 40
     /**
41
-    * Validate honeypot is empty
42
-    *
43
-    * @param  mixed $value
44
-    * @return boolean
45
-    */
41
+     * Validate honeypot is empty
42
+     *
43
+     * @param  mixed $value
44
+     * @return boolean
45
+     */
46 46
     public function validateHoneypot($value) : bool
47 47
     {
48 48
         if ($this->disabled) {
Please login to merge, or discard this patch.