Completed
Push — master ( e0dd35...f294bb )
by Markus
08:06 queued 57s
created
lib/CustomColumnTypeText.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
         while ($post = $result->fetchObject())
71 71
         {
72 72
             $entryPContent = str_format(localize("bookword", $post->count), $post->count);
73
-            $entryPLinkArray = array(new LinkNavigation ($this->getUri($post->id)));
73
+            $entryPLinkArray = array(new LinkNavigation($this->getUri($post->id)));
74 74
 
75 75
             $entry = new Entry($post->name, $this->getEntryId($post->id), $entryPContent, $this->datatype, $entryPLinkArray, "", $post->count);
76 76
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,8 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
         $result = $this->getDb()->query($query);
69 69
         $entryArray = array();
70
-        while ($post = $result->fetchObject())
71
-        {
70
+        while ($post = $result->fetchObject()) {
72 71
             $entryPContent = str_format(localize("bookword", $post->count), $post->count);
73 72
             $entryPLinkArray = array(new LinkNavigation ($this->getUri($post->id)));
74 73
 
@@ -82,7 +81,9 @@  discard block
 block discarded – undo
82 81
     public function getDescription()
83 82
     {
84 83
         $desc = $this->getDatabaseDescription();
85
-        if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle());
84
+        if ($desc === NULL || empty($desc)) {
85
+            $desc = str_format(localize("customcolumn.description"), $this->getTitle());
86
+        }
86 87
         return $desc;
87 88
     }
88 89
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         if ($post = $result->fetchObject()) {
58 58
             return new CustomColumn($id, $post->name, $this);
59 59
         }
60
-        return NULL;
60
+        return null;
61 61
     }
62 62
 
63 63
     protected function getAllCustomValuesFromDatabase()
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     public function getDescription()
83 83
     {
84 84
         $desc = $this->getDatabaseDescription();
85
-        if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle());
85
+        if ($desc === null || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle());
86 86
         return $desc;
87 87
     }
88 88
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         if ($post = $result->fetchObject()) {
96 96
             return new CustomColumn($post->id, $post->name, $this);
97 97
         }
98
-        return new CustomColumn(NULL, "", $this);
98
+        return new CustomColumn(null, "", $this);
99 99
     }
100 100
 
101 101
     public function isSearchable()
Please login to merge, or discard this patch.
lib/CustomColumnType.php 3 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,18 +11,18 @@  discard block
 block discarded – undo
11 11
  */
12 12
 abstract class CustomColumnType extends Base
13 13
 {
14
-    const ALL_CUSTOMS_ID       = "cops:custom";
14
+    const ALL_CUSTOMS_ID = "cops:custom";
15 15
 
16
-    const CUSTOM_TYPE_TEXT      = "text";        // type 1 + 2
17
-    const CUSTOM_TYPE_COMMENT   = "comments";    // type 3
18
-    const CUSTOM_TYPE_SERIES    = "series";      // type 4
16
+    const CUSTOM_TYPE_TEXT      = "text"; // type 1 + 2
17
+    const CUSTOM_TYPE_COMMENT   = "comments"; // type 3
18
+    const CUSTOM_TYPE_SERIES    = "series"; // type 4
19 19
     const CUSTOM_TYPE_ENUM      = "enumeration"; // type 5
20
-    const CUSTOM_TYPE_DATE      = "datetime";    // type 6
21
-    const CUSTOM_TYPE_FLOAT     = "float";       // type 7
22
-    const CUSTOM_TYPE_INT       = "int";         // type 8
23
-    const CUSTOM_TYPE_RATING    = "rating";      // type 9
24
-    const CUSTOM_TYPE_BOOL      = "bool";        // type 10
25
-    const CUSTOM_TYPE_COMPOSITE = "composite";   // type 11 + 12
20
+    const CUSTOM_TYPE_DATE      = "datetime"; // type 6
21
+    const CUSTOM_TYPE_FLOAT     = "float"; // type 7
22
+    const CUSTOM_TYPE_INT       = "int"; // type 8
23
+    const CUSTOM_TYPE_RATING    = "rating"; // type 9
24
+    const CUSTOM_TYPE_BOOL      = "bool"; // type 10
25
+    const CUSTOM_TYPE_COMPOSITE = "composite"; // type 11 + 12
26 26
 
27 27
     /** @var array[integer]CustomColumnType  */
28 28
     private static $customColumnCacheID = array();
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         $result->execute(array($this->customId));
111 111
         if ($post = $result->fetchObject()) {
112 112
             $json = json_decode($post->display);
113
-            return (isset($json->description) && !empty($json->description)) ? $json->description : NULL;
113
+            return (isset($json->description) && !empty($json->description))?$json->description:NULL;
114 114
         }
115 115
         return NULL;
116 116
     }
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -181,8 +181,9 @@  discard block
 block discarded – undo
181 181
     public static function createByCustomID($customId)
182 182
     {
183 183
         // Reuse already created CustomColumns for performance
184
-        if (array_key_exists($customId, self::$customColumnCacheID))
185
-            return self::$customColumnCacheID[$customId];
184
+        if (array_key_exists($customId, self::$customColumnCacheID)) {
185
+                    return self::$customColumnCacheID[$customId];
186
+        }
186 187
 
187 188
         $datatype = self::getDatatypeByCustomID($customId);
188 189
 
@@ -221,8 +222,9 @@  discard block
 block discarded – undo
221 222
     public static function createByLookup($lookup)
222 223
     {
223 224
         // Reuse already created CustomColumns for performance
224
-        if (array_key_exists($lookup, self::$customColumnCacheLookup))
225
-            return self::$customColumnCacheLookup[$lookup];
225
+        if (array_key_exists($lookup, self::$customColumnCacheLookup)) {
226
+                    return self::$customColumnCacheLookup[$lookup];
227
+        }
226 228
 
227 229
         $result = parent::getDb()->prepare('SELECT id FROM custom_columns WHERE label = ?');
228 230
         $result->execute(array($lookup));
@@ -241,8 +243,9 @@  discard block
 block discarded – undo
241 243
     public function getAllCustomValues()
242 244
     {
243 245
         // lazy loading
244
-        if ($this->customValues == NULL)
245
-            $this->customValues = $this->getAllCustomValuesFromDatabase();
246
+        if ($this->customValues == NULL) {
247
+                    $this->customValues = $this->getAllCustomValuesFromDatabase();
248
+        }
246 249
 
247 250
         return $this->customValues;
248 251
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
     /** @var string the datatype of this column (one of the CUSTOM_TYPE_* constant values) */
38 38
     public $datatype;
39 39
     /** @var null|Entry[] */
40
-    private $customValues = NULL;
40
+    private $customValues = null;
41 41
 
42 42
     protected function __construct($pcustomId, $pdatatype)
43 43
     {
44 44
         $this->columnTitle = self::getTitleByCustomID($pcustomId);
45 45
         $this->customId = $pcustomId;
46 46
         $this->datatype = $pdatatype;
47
-        $this->customValues = NULL;
47
+        $this->customValues = null;
48 48
     }
49 49
 
50 50
     /**
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
         $result->execute(array($this->customId));
111 111
         if ($post = $result->fetchObject()) {
112 112
             $json = json_decode($post->display);
113
-            return (isset($json->description) && !empty($json->description)) ? $json->description : NULL;
113
+            return (isset($json->description) && !empty($json->description)) ? $json->description : null;
114 114
         }
115
-        return NULL;
115
+        return null;
116 116
     }
117 117
 
118 118
     /**
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         if ($post = $result->fetchObject()) {
169 169
             return $post->datatype;
170 170
         }
171
-        return NULL;
171
+        return null;
172 172
     }
173 173
 
174 174
     /**
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
             case self::CUSTOM_TYPE_BOOL:
207 207
                 return self::$customColumnCacheID[$customId] = new CustomColumnTypeBool($customId);
208 208
             case self::CUSTOM_TYPE_COMPOSITE:
209
-                return NULL; //TODO Currently not supported
209
+                return null; //TODO Currently not supported
210 210
             default:
211 211
                 throw new Exception("Unkown column type: " . $datatype);
212 212
         }
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
         if ($post = $result->fetchObject()) {
230 230
             return self::$customColumnCacheLookup[$lookup] = self::createByCustomID($post->id);
231 231
         }
232
-        return self::$customColumnCacheLookup[$lookup] = NULL;
232
+        return self::$customColumnCacheLookup[$lookup] = null;
233 233
     }
234 234
 
235 235
     /**
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
     public function getAllCustomValues()
242 242
     {
243 243
         // lazy loading
244
-        if ($this->customValues == NULL)
244
+        if ($this->customValues == null)
245 245
             $this->customValues = $this->getAllCustomValuesFromDatabase();
246 246
 
247 247
         return $this->customValues;
Please login to merge, or discard this patch.
lib/CustomColumnTypeBool.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
     // PHP pre 5.6 does not support const arrays
12 12
     private $BOOLEAN_NAMES = array(
13 13
         -1 => "customcolumn.boolean.unknown", // localize("customcolumn.boolean.unknown")
14
-        00 => "customcolumn.boolean.no",      // localize("customcolumn.boolean.no")
15
-        +1 => "customcolumn.boolean.yes",     // localize("customcolumn.boolean.yes")
14
+        00 => "customcolumn.boolean.no", // localize("customcolumn.boolean.no")
15
+        +1 => "customcolumn.boolean.yes", // localize("customcolumn.boolean.yes")
16 16
     );
17 17
 
18 18
     protected function __construct($pcustomId)
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $entryArray = array();
61 61
         while ($post = $result->fetchObject()) {
62 62
             $entryPContent = str_format(localize("bookword", $post->count), $post->count);
63
-            $entryPLinkArray = array(new LinkNavigation ($this->getUri($post->id)));
63
+            $entryPLinkArray = array(new LinkNavigation($this->getUri($post->id)));
64 64
 
65 65
             $entry = new Entry(localize($this->BOOLEAN_NAMES[$post->id]), $this->getEntryId($post->id), $entryPContent, $this->datatype, $entryPLinkArray, "", $post->count);
66 66
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
             $query = str_format(Book::SQL_BOOKS_BY_CUSTOM_BOOL_TRUE, "{0}", "{1}", $this->getTableName());
43 43
             return array($query, array());
44 44
         } else {
45
-            return NULL;
45
+            return null;
46 46
         }
47 47
     }
48 48
 
Please login to merge, or discard this patch.
lib/CustomColumnTypeDate.php 3 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
             $id = $date->format("Y-m-d");
50 50
 
51 51
             $entryPContent = str_format(localize("bookword", $post->count), $post->count);
52
-            $entryPLinkArray = array(new LinkNavigation ($this->getUri($id)));
52
+            $entryPLinkArray = array(new LinkNavigation($this->getUri($id)));
53 53
 
54 54
             $entry = new Entry($date->format(localize("customcolumn.date.format")), $this->getEntryId($id), $entryPContent, $this->datatype, $entryPLinkArray, "", $post->count);
55 55
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     public function getDescription()
63 63
     {
64 64
         $desc = $this->getDatabaseDescription();
65
-        if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle());
65
+        if ($desc === null || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle());
66 66
         return $desc;
67 67
     }
68 68
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
             return new CustomColumn($date->format("Y-m-d"), $date->format(localize("customcolumn.date.format")), $this);
79 79
         }
80
-        return new CustomColumn(NULL, localize("customcolumn.date.unknown"), $this);
80
+        return new CustomColumn(null, localize("customcolumn.date.unknown"), $this);
81 81
     }
82 82
 
83 83
     public function isSearchable()
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,9 @@
 block discarded – undo
55 55
     public function getDescription()
56 56
     {
57 57
         $desc = $this->getDatabaseDescription();
58
-        if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle());
58
+        if ($desc === NULL || empty($desc)) {
59
+            $desc = str_format(localize("customcolumn.description"), $this->getTitle());
60
+        }
59 61
         return $desc;
60 62
     }
61 63
 
Please login to merge, or discard this patch.
lib/CustomColumnTypeRating.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
 
58 58
     public function getCustom($id)
59 59
     {
60
-        return new CustomColumn ($id, str_format(localize("customcolumn.stars", $id / 2), $id / 2), $this);
60
+        return new CustomColumn($id, str_format(localize("customcolumn.stars", $id / 2), $id / 2), $this);
61 61
     }
62 62
 
63 63
     protected function getAllCustomValuesFromDatabase()
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
100 100
         if ($post = $result->fetchObject()) {
101 101
             return new CustomColumn($post->value, str_format(localize("customcolumn.stars", $post->value / 2), $post->value / 2), $this);
102 102
         }
103
-        return new CustomColumn(NULL, localize("customcolumn.rating.unknown"), $this);
103
+        return new CustomColumn(null, localize("customcolumn.rating.unknown"), $this);
104 104
     }
105 105
 
106 106
     public function isSearchable()
Please login to merge, or discard this patch.
lib/CustomColumnTypeFloat.php 2 patches
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     public function getDescription()
56 56
     {
57 57
         $desc = $this->getDatabaseDescription();
58
-        if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle());
58
+        if ($desc === null || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle());
59 59
         return $desc;
60 60
     }
61 61
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         if ($post = $result->fetchObject()) {
69 69
             return new CustomColumn($post->value, $post->value, $this);
70 70
         }
71
-        return new CustomColumn(NULL, localize("customcolumn.float.unknown"), $this);
71
+        return new CustomColumn(null, localize("customcolumn.float.unknown"), $this);
72 72
     }
73 73
 
74 74
     public function isSearchable()
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,9 @@
 block discarded – undo
55 55
     public function getDescription()
56 56
     {
57 57
         $desc = $this->getDatabaseDescription();
58
-        if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle());
58
+        if ($desc === NULL || empty($desc)) {
59
+            $desc = str_format(localize("customcolumn.description"), $this->getTitle());
60
+        }
59 61
         return $desc;
60 62
     }
61 63
 
Please login to merge, or discard this patch.
lib/CustomColumnTypeComment.php 2 patches
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
 
42 42
     protected function getAllCustomValuesFromDatabase()
43 43
     {
44
-        return NULL;
44
+        return null;
45 45
     }
46 46
 
47 47
     public function getDescription()
48 48
     {
49 49
         $desc = $this->getDatabaseDescription();
50
-        if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle());
50
+        if ($desc === null || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle());
51 51
         return $desc;
52 52
     }
53 53
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         if ($post = $result->fetchObject()) {
61 61
             return new CustomColumn($post->id, $post->value, $this);
62 62
         }
63
-        return new CustomColumn(NULL, localize("customcolumn.float.unknown"), $this);
63
+        return new CustomColumn(null, localize("customcolumn.float.unknown"), $this);
64 64
     }
65 65
 
66 66
     public function isSearchable()
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,9 @@
 block discarded – undo
55 55
     public function getDescription()
56 56
     {
57 57
         $desc = $this->getDatabaseDescription();
58
-        if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle());
58
+        if ($desc === NULL || empty($desc)) {
59
+            $desc = str_format(localize("customcolumn.description"), $this->getTitle());
60
+        }
59 61
         return $desc;
60 62
     }
61 63
 
Please login to merge, or discard this patch.
lib/CustomColumnTypeInteger.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,9 @@
 block discarded – undo
55 55
     public function getDescription()
56 56
     {
57 57
         $desc = $this->getDatabaseDescription();
58
-        if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle());
58
+        if ($desc === NULL || empty($desc)) {
59
+            $desc = str_format(localize("customcolumn.description"), $this->getTitle());
60
+        }
59 61
         return $desc;
60 62
     }
61 63
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     public function getDescription()
56 56
     {
57 57
         $desc = $this->getDatabaseDescription();
58
-        if ($desc === NULL || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle());
58
+        if ($desc === null || empty($desc)) $desc = str_format(localize("customcolumn.description"), $this->getTitle());
59 59
         return $desc;
60 60
     }
61 61
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         if ($post = $result->fetchObject()) {
69 69
             return new CustomColumn($post->value, $post->value, $this);
70 70
         }
71
-        return new CustomColumn(NULL, localize("customcolumn.int.unknown"), $this);
71
+        return new CustomColumn(null, localize("customcolumn.int.unknown"), $this);
72 72
     }
73 73
 
74 74
     public function isSearchable()
Please login to merge, or discard this patch.
lib/CustomColumnTypeSeries.php 1 patch
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         if ($post = $result->fetchObject()) {
58 58
             return new CustomColumn($id, $post->name, $this);
59 59
         }
60
-        return NULL;
60
+        return null;
61 61
     }
62 62
 
63 63
     protected function getAllCustomValuesFromDatabase()
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         if ($post = $result->fetchObject()) {
93 93
             return new CustomColumn($post->id, $post->name . " [" . $post->extra . "]", $this);
94 94
         }
95
-        return new CustomColumn(NULL, "", $this);
95
+        return new CustomColumn(null, "", $this);
96 96
     }
97 97
 
98 98
     public function isSearchable()
Please login to merge, or discard this patch.