Completed
Push — master ( 892b18...23f0c3 )
by Henri
03:13
created
model/sparql/GenericSparql.php 3 patches
Doc Comments   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
      * Returns information (as a graph) for one or more concept URIs
430 430
      * @param mixed $uris concept URI (string) or array of URIs
431 431
      * @param string|null $arrayClass the URI for thesaurus array class, or null if not used
432
-     * @param \Vocabulary[]|null $vocabs vocabularies to target
432
+     * @param Vocabulary[] $vocabs vocabularies to target
433 433
      * @return \Concept[]
434 434
      */
435 435
     public function queryConceptInfoGraph($uris, $arrayClass = null, $vocabs = array()) {
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
 
650 650
     /**
651 651
      * Generate a VALUES clause for limiting the targeted graphs.
652
-     * @param Vocabulary[]|null $vocabs array of Vocabulary objects to target
652
+     * @param Vocabulary[] $vocabs array of Vocabulary objects to target
653 653
      * @return string VALUES clause, or "" if not necessary to limit
654 654
      */
655 655
     protected function formatValuesGraph($vocabs) {
@@ -829,6 +829,7 @@  discard block
 block discarded – undo
829 829
      * @param string $searchLang language code used for matching labels (null means any language)
830 830
      * @param string[] $props properties to target e.g. array('skos:prefLabel','skos:altLabel')
831 831
      * @param boolean $unique restrict results to unique concepts (default: false)
832
+     * @param string $filterGraph
832 833
      * @return string sparql query
833 834
      */
834 835
     protected function generateConceptSearchQueryInner($term, $lang, $searchLang, $props, $unique, $filterGraph)
@@ -1094,6 +1095,7 @@  discard block
 block discarded – undo
1094 1095
     /**
1095 1096
      * Generates sparql query clauses used for creating the alphabetical index.
1096 1097
      * @param string $letter the letter (or special class) to search for
1098
+     * @param string $lang
1097 1099
      * @return array of sparql query clause strings
1098 1100
      */
1099 1101
     private function formatFilterConditions($letter, $lang) {
@@ -1406,7 +1408,7 @@  discard block
 block discarded – undo
1406 1408
     /**
1407 1409
      * Query a single transitive property of a concept.
1408 1410
      * @param string $uri
1409
-     * @param string $prop the name of the property eg. 'skos:broader'.
1411
+     * @param string $props the name of the property eg. 'skos:broader'.
1410 1412
      * @param string $lang
1411 1413
      * @param integer $limit
1412 1414
      * @param boolean $anylang if you want a label even when it isn't available in the language you requested.
Please login to merge, or discard this patch.
Braces   +10 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,12 +46,16 @@  discard block
 block discarded – undo
46 46
         $this->client = new EasyRdf_Sparql_Client($endpoint);
47 47
 
48 48
         // set graphClause so that it can be used by all queries
49
-        if ($this->isDefaultEndpoint()) // default endpoint; query any graph (and catch it in a variable)
49
+        if ($this->isDefaultEndpoint()) {
50
+          // default endpoint; query any graph (and catch it in a variable)
50 51
         {
51 52
             $this->graphClause = "GRAPH $graph";
52
-        } elseif ($graph) // query a specific graph
53
+        }
54
+        } elseif ($graph) {
55
+          // query a specific graph
53 56
         {
54 57
             $this->graphClause = "GRAPH <$graph>";
58
+        }
55 59
         } else // query the default graph
56 60
         {
57 61
             $this->graphClause = "";
@@ -78,8 +82,9 @@  discard block
 block discarded – undo
78 82
             }
79 83
         }
80 84
         foreach ($graphs as $graph) {
81
-            if($graph !== NULL)
82
-                $clause .= "FROM NAMED <$graph> "; 
85
+            if($graph !== NULL) {
86
+                            $clause .= "FROM NAMED <$graph> ";
87
+            }
83 88
         }
84 89
         return $clause;
85 90
     }
@@ -1776,8 +1781,7 @@  discard block
 block discarded – undo
1776 1781
         if (sizeof($ret) > 0) {
1777 1782
             // existing concept, with children
1778 1783
             return $ret;
1779
-        }
1780
-        else {
1784
+        } else {
1781 1785
             // nonexistent concept
1782 1786
             return null;
1783 1787
         }
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         $starttime = microtime();
72 72
         $result = $this->client->query($query);
73 73
         $elapsed = intval(round((microtime() - $starttime) * 1000));
74
-        if(method_exists($result, 'numRows')) {
74
+        if (method_exists($result, 'numRows')) {
75 75
             $numRows = $result->numRows();
76 76
             $logger->info("[qid $queryId] result: $numRows rows returned in $elapsed ms");
77 77
         } else { // graph result
@@ -87,20 +87,20 @@  discard block
 block discarded – undo
87 87
      * @param Vocabulary[]|null $vocabs
88 88
      * @return string
89 89
      */
90
-    protected function generateFromClause($vocabs=null) {
90
+    protected function generateFromClause($vocabs = null) {
91 91
         $graphs = array();
92 92
         $clause = '';
93 93
         if (!$vocabs) {
94 94
             return $this->graph !== '?graph' && $this->graph !== NULL ? "FROM <$this->graph>" : '';
95 95
         }
96
-        foreach($vocabs as $vocab) {
96
+        foreach ($vocabs as $vocab) {
97 97
             $graph = $vocab->getGraph();
98 98
             if (!in_array($graph, $graphs)) {
99 99
                 array_push($graphs, $graph);
100 100
             }
101 101
         }
102 102
         foreach ($graphs as $graph) {
103
-            if($graph !== NULL)
103
+            if ($graph !== NULL)
104 104
                 $clause .= "FROM NAMED <$graph> "; 
105 105
         }
106 106
         return $clause;
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
         foreach ($graphs as $graph) {
698 698
           $values[] = "<$graph>";
699 699
         }
700
-        return "FILTER (?graph IN (" . implode(',', $values) . "))";
700
+        return "FILTER (?graph IN (".implode(',', $values)."))";
701 701
     }
702 702
 
703 703
     /**
@@ -707,16 +707,16 @@  discard block
 block discarded – undo
707 707
      * @return string sparql query clauses
708 708
      */
709 709
     protected function formatLimitAndOffset($limit, $offset) {
710
-        $limit = ($limit) ? 'LIMIT ' . $limit : '';
711
-        $offset = ($offset) ? 'OFFSET ' . $offset : '';
710
+        $limit = ($limit) ? 'LIMIT '.$limit : '';
711
+        $offset = ($offset) ? 'OFFSET '.$offset : '';
712 712
         // eliminating whitespace and line changes when the conditions aren't needed.
713 713
         $limitandoffset = '';
714 714
         if ($limit && $offset) {
715
-            $limitandoffset = "\n" . $limit . "\n" . $offset;
715
+            $limitandoffset = "\n".$limit."\n".$offset;
716 716
         } elseif ($limit) {
717
-            $limitandoffset = "\n" . $limit;
717
+            $limitandoffset = "\n".$limit;
718 718
         } elseif ($offset) {
719
-            $limitandoffset = "\n" . $offset;
719
+            $limitandoffset = "\n".$offset;
720 720
         }
721 721
 
722 722
         return $limitandoffset;
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
             }
737 737
         }
738 738
 
739
-        return implode(' UNION ', $typePatterns);;
739
+        return implode(' UNION ', $typePatterns); ;
740 740
     }
741 741
 
742 742
     /**
@@ -868,14 +868,14 @@  discard block
 block discarded – undo
868 868
         // if search language and UI/display language differ, must also consider case where there is no prefLabel in
869 869
         // the display language; in that case, should use the label with the same language as the matched label
870 870
         $labelcondFallback = ($searchLang != $lang) ?
871
-          "OPTIONAL { # in case previous OPTIONAL block gives no labels\n" .
871
+          "OPTIONAL { # in case previous OPTIONAL block gives no labels\n".
872 872
           "?s skos:prefLabel ?label . FILTER (LANGMATCHES(LANG(?label), LANG(?match))) }" : "";
873 873
           
874 874
         //  Including the labels if there is no query term given.
875 875
         if ($rawterm === '') {
876 876
           $labelClause = "?s skos:prefLabel ?label .";
877
-          $labelClause = ($lang) ? $labelClause . " FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause . "";
878
-          return $labelClause . " BIND(?label AS ?match)";
877
+          $labelClause = ($lang) ? $labelClause." FILTER (LANGMATCHES(LANG(?label), '$lang'))" : $labelClause."";
878
+          return $labelClause." BIND(?label AS ?match)";
879 879
         }
880 880
 
881 881
         /*
@@ -936,15 +936,15 @@  discard block
 block discarded – undo
936 936
 
937 937
         $schemecond = '';
938 938
         if (!empty($schemes)) {
939
-            foreach($schemes as $scheme) {
939
+            foreach ($schemes as $scheme) {
940 940
                 $schemecond .= "?s skos:inScheme <$scheme> . ";
941 941
             }
942 942
         }
943 943
 
944 944
         // extra conditions for parent and group, if specified
945
-        $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <" . $params->getParentLimit() . "> ." : "";
946
-        $groupcond = ($params->getGroupLimit()) ? "<" . $params->getGroupLimit() . "> skos:member ?s ." : "";
947
-        $pgcond = $parentcond . $groupcond;
945
+        $parentcond = ($params->getParentLimit()) ? "?s skos:broader+ <".$params->getParentLimit()."> ." : "";
946
+        $groupcond = ($params->getGroupLimit()) ? "<".$params->getGroupLimit()."> skos:member ?s ." : "";
947
+        $pgcond = $parentcond.$groupcond;
948 948
 
949 949
         $orderextra = $this->isDefaultEndpoint() ? $this->graph : '';
950 950
 
@@ -1018,9 +1018,9 @@  discard block
 block discarded – undo
1018 1018
             $hit['type'][] = $this->shortenUri($typeuri);
1019 1019
         }
1020 1020
 
1021
-        if(!empty($fields)) {
1021
+        if (!empty($fields)) {
1022 1022
             foreach ($fields as $prop) {
1023
-                $propname = $prop . 's';
1023
+                $propname = $prop.'s';
1024 1024
                 if (isset($row->$propname)) {
1025 1025
                     foreach (explode("\n", $row->$propname->getValue()) as $line) {
1026 1026
                         $rdata = str_getcsv($line, ',', '"', '"');
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
                             $propvals = $rdata[2];
1036 1036
                         }
1037 1037
 
1038
-                        $hit['skos:' . $prop][] = $propvals;
1038
+                        $hit['skos:'.$prop][] = $propvals;
1039 1039
                     }
1040 1040
                 }
1041 1041
             }
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
                 if (!isset($row->label) || $row->label->getLang() === $lang) {
1495 1495
                     $ret[$row->object->getUri()] = $val;
1496 1496
                 } elseif ($row->label->getLang() === $fallbacklang) {
1497
-                    $val['label'] .= ' (' . $row->label->getLang() . ')';
1497
+                    $val['label'] .= ' ('.$row->label->getLang().')';
1498 1498
                     $ret[$row->object->getUri()] = $val;
1499 1499
                 }
1500 1500
             }
@@ -1590,10 +1590,10 @@  discard block
 block discarded – undo
1590 1590
 
1591 1591
             $label = null;
1592 1592
             if (isset($row->label)) {
1593
-                if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) {
1593
+                if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) {
1594 1594
                     $label = $row->label->getValue();
1595 1595
                 } else {
1596
-                    $label = $row->label->getValue() . " (" . $row->label->getLang() . ")";
1596
+                    $label = $row->label->getValue()." (".$row->label->getLang().")";
1597 1597
                 }
1598 1598
 
1599 1599
             }
@@ -1669,8 +1669,8 @@  discard block
 block discarded – undo
1669 1669
         foreach ($result as $row) {
1670 1670
             if (isset($row->top) && isset($row->label)) {
1671 1671
                 $label = $row->label->getValue();
1672
-                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) {
1673
-                    $label .= ' (' . $row->label->getLang() . ')';
1672
+                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) {
1673
+                    $label .= ' ('.$row->label->getLang().')';
1674 1674
                 }
1675 1675
                 $top = array('uri' => $row->top->getUri(), 'topConceptOf' => $row->topuri->getUri(), 'label' => $label, 'hasChildren' => filter_var($row->children->getValue(), FILTER_VALIDATE_BOOLEAN));
1676 1676
                 if (isset($row->notation)) {
@@ -1771,8 +1771,8 @@  discard block
 block discarded – undo
1771 1771
                 $label = null;
1772 1772
                 if (isset($row->childlabel)) {
1773 1773
                     $label = $row->childlabel->getValue();
1774
-                    if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang . "-") !== 0) {
1775
-                        $label .= " (" . $row->childlabel->getLang() . ")";
1774
+                    if ($row->childlabel->getLang() !== $lang && strpos($row->childlabel->getLang(), $lang."-") !== 0) {
1775
+                        $label .= " (".$row->childlabel->getLang().")";
1776 1776
                     }
1777 1777
 
1778 1778
                 }
@@ -1793,8 +1793,8 @@  discard block
 block discarded – undo
1793 1793
             }
1794 1794
             if (isset($row->label)) {
1795 1795
                 $preflabel = $row->label->getValue();
1796
-                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang . "-") !== 0) {
1797
-                    $preflabel .= ' (' . $row->label->getLang() . ')';
1796
+                if ($row->label->getLang() && $row->label->getLang() !== $lang && strpos($row->label->getLang(), $lang."-") !== 0) {
1797
+                    $preflabel .= ' ('.$row->label->getLang().')';
1798 1798
                 }
1799 1799
 
1800 1800
                 $ret[$uri]['prefLabel'] = $preflabel;
@@ -1951,10 +1951,10 @@  discard block
 block discarded – undo
1951 1951
                     'type' => array($row->type->shorten()),
1952 1952
                 );
1953 1953
                 if (isset($row->label)) {
1954
-                    if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang . "-") == 0) {
1954
+                    if ($row->label->getLang() == $lang || strpos($row->label->getLang(), $lang."-") == 0) {
1955 1955
                         $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue();
1956 1956
                     } else {
1957
-                        $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue() . " (" . $row->label->getLang() . ")";
1957
+                        $values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue()." (".$row->label->getLang().")";
1958 1958
                     }
1959 1959
 
1960 1960
                 }
@@ -1995,7 +1995,7 @@  discard block
 block discarded – undo
1995 1995
      */
1996 1996
     private function generateChangeListQuery($lang, $offset, $prop) {
1997 1997
         $fcl = $this->generateFromClause();
1998
-        $offset = ($offset) ? 'OFFSET ' . $offset : '';
1998
+        $offset = ($offset) ? 'OFFSET '.$offset : '';
1999 1999
 
2000 2000
         $query = <<<EOQ
2001 2001
 SELECT DISTINCT ?concept ?date ?label $fcl
Please login to merge, or discard this patch.
model/ConceptPropertyValue.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     {
25 25
         $label = is_string($this->getLabel()) ? $this->getLabel() : $this->getLabel()->getValue();
26 26
         if ($this->vocab->getConfig()->sortByNotation()) {
27
-            $label = $this->getNotation() . $label;
27
+            $label = $this->getNotation().$label;
28 28
         }
29 29
 
30 30
         return $label;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     public function getReifiedPropertyValues() {
121 121
         $ret = array();
122 122
         $props = $this->resource->propertyUris();
123
-        foreach($props as $prop) {
123
+        foreach ($props as $prop) {
124 124
             $prop = (EasyRdf_Namespace::shorten($prop) !== null) ? EasyRdf_Namespace::shorten($prop) : $prop;
125 125
             foreach ($this->resource->allLiterals($prop) as $val) {
126 126
                 if ($prop !== 'rdf:value' && $this->resource->get($prop)) { // shown elsewhere
Please login to merge, or discard this patch.
model/Cache.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
     /**
23 23
      * Wraps apc_store() and apcu_store()
24 24
      */
25
-    public function store($key, $value, $ttl=3600) {
25
+    public function store($key, $value, $ttl = 3600) {
26 26
         if (function_exists('apc_store')) {
27 27
             return apc_store($key, $value);
28 28
         } 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@
 block discarded – undo
25 25
     public function store($key, $value, $ttl=3600) {
26 26
         if (function_exists('apc_store')) {
27 27
             return apc_store($key, $value);
28
-        } 
29
-        else if (function_exists('apcu_store')) {
28
+        } else if (function_exists('apcu_store')) {
30 29
             return apcu_store($key, $value, $ttl);
31 30
         }
32 31
     }
Please login to merge, or discard this patch.
controller/Honeypot.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@
 block discarded – undo
39 39
         return $html;
40 40
     }
41 41
     /**
42
-    * Validate honeypot is empty
43
-    *
44
-    * @param  mixed $value
45
-    * @return boolean
46
-    */
42
+     * Validate honeypot is empty
43
+     *
44
+     * @param  mixed $value
45
+     * @return boolean
46
+     */
47 47
     public function validateHoneypot($value)
48 48
     {
49 49
         if ($this->disabled) {
Please login to merge, or discard this patch.
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
-        $html = '<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
+        $html = '<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
         return $html;
40 40
     }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         // Get the decrypted time
68 68
         $value = $this->decryptTime($value);
69 69
         // The current time should be greater than the time the form was built + the speed option
70
-        return ( is_numeric($value) && time() > ($value + $parameters[0]) );
70
+        return (is_numeric($value) && time() > ($value + $parameters[0]));
71 71
     }
72 72
     /**
73 73
      * Get encrypted time
Please login to merge, or discard this patch.
model/SkosmosTurtleParser.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -55,6 +55,7 @@
 block discarded – undo
55 55
 
56 56
     /**
57 57
      * Steps back, restoring the previous character or statement read() to the input buffer.
58
+     * @param string $chars
58 59
      */
59 60
     protected function unread($chars)
60 61
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     protected function peek()
23 23
     {
24
-        if(!$this->dataLength) { $this->dataLength = strlen($this->data); }
24
+        if (!$this->dataLength) { $this->dataLength = strlen($this->data); }
25 25
         if ($this->dataLength > $this->bytePos) {
26 26
             $slice = substr($this->data, $this->bytePos, 4);
27 27
             return mb_substr($slice, 0, 1, "UTF-8");
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     {
79 79
         if ($this->bytePos - 4 > 0) {
80 80
             $slice = substr($this->data, $this->bytePos - 4, 4);
81
-            while($slice != '') {
81
+            while ($slice != '') {
82 82
                 if (!self::isWhitespace(mb_substr($slice, -1, 1, "UTF-8"))) {
83 83
                     return;
84 84
                 }
Please login to merge, or discard this patch.