Completed
Push — master ( 3ad122...aab802 )
by Markus
04:20
created
lib/Base.php 3 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
     public static function isMultipleDatabaseEnabled()
41 41
     {
42 42
         global $config;
43
-        return is_array ($config['calibre_directory']);
43
+        return is_array($config['calibre_directory']);
44 44
     }
45 45
 
46 46
     public static function useAbsolutePath()
47 47
     {
48 48
         global $config;
49 49
         $path = self::getDbDirectory();
50
-        return preg_match ('/^\//', $path) || // Linux /
51
-               preg_match ('/^\w\:/', $path); // Windows X:
50
+        return preg_match('/^\//', $path) || // Linux /
51
+               preg_match('/^\w\:/', $path); // Windows X:
52 52
     }
53 53
 
54 54
     public static function noDatabaseSelected()
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
     {
71 71
         global $config;
72 72
         if (self::isMultipleDatabaseEnabled()) {
73
-            return array_keys ($config['calibre_directory']);
73
+            return array_keys($config['calibre_directory']);
74 74
         } else {
75
-            return array ('');
75
+            return array('');
76 76
         }
77 77
     }
78 78
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
     public static function getDbFileName($database = NULL)
108 108
     {
109
-        return self::getDbDirectory($database) .'metadata.db';
109
+        return self::getDbDirectory($database) . 'metadata.db';
110 110
     }
111 111
 
112 112
     private static function error($database)
@@ -117,12 +117,12 @@  discard block
 block discarded – undo
117 117
         throw new Exception('Database <' . $database . '> not found.');
118 118
     }
119 119
 
120
-    public static function getDb ($database = NULL)
120
+    public static function getDb($database = NULL)
121 121
     {
122
-        if (is_null (self::$db)) {
122
+        if (is_null(self::$db)) {
123 123
             try {
124
-                if (is_readable(self::getDbFileName ($database))) {
125
-                    self::$db = new PDO('sqlite:'. self::getDbFileName($database));
124
+                if (is_readable(self::getDbFileName($database))) {
125
+                    self::$db = new PDO('sqlite:' . self::getDbFileName($database));
126 126
                     if (useNormAndUp()) {
127 127
                         self::$db->sqliteCreateFunction('normAndUp', 'normAndUp', 1);
128 128
                     }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
         }
171 171
         $entry = new Entry(localize($table . '.title'), $id,
172 172
             str_format(localize($numberOfString, $count), $count), 'text',
173
-            array(new LinkNavigation('?page='.$pageId)), '', $count);
173
+            array(new LinkNavigation('?page=' . $pageId)), '', $count);
174 174
         return $entry;
175 175
     }
176 176
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -80,7 +80,9 @@  discard block
 block discarded – undo
80 80
     {
81 81
         global $config;
82 82
         if (self::isMultipleDatabaseEnabled()) {
83
-            if (is_null($database)) $database = GetUrlParam(DB, 0);
83
+            if (is_null($database)) {
84
+                $database = GetUrlParam(DB, 0);
85
+            }
84 86
             if (!is_null($database) && !preg_match('/^\d+$/', $database)) {
85 87
                 self::error($database);
86 88
             }
@@ -94,7 +96,9 @@  discard block
 block discarded – undo
94 96
     {
95 97
         global $config;
96 98
         if (self::isMultipleDatabaseEnabled()) {
97
-            if (is_null($database)) $database = GetUrlParam(DB, 0);
99
+            if (is_null($database)) {
100
+                $database = GetUrlParam(DB, 0);
101
+            }
98 102
             if (!is_null($database) && !preg_match('/^\d+$/', $database)) {
99 103
                 self::error($database);
100 104
             }
@@ -180,8 +184,7 @@  discard block
 block discarded – undo
180 184
 
181 185
         list (, $result) = self::executeQuery($query, $columns, '', $params, -1);
182 186
         $entryArray = array();
183
-        while ($post = $result->fetchObject())
184
-        {
187
+        while ($post = $result->fetchObject()) {
185 188
             /* @var $instance Author|Tag|Serie|Publisher */
186 189
 
187 190
             $instance = new $category($post);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 
36 36
     const COMPATIBILITY_XML_ALDIKO = 'aldiko';
37 37
 
38
-    private static $db = NULL;
38
+    private static $db = null;
39 39
 
40 40
     public static function isMultipleDatabaseEnabled()
41 41
     {
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         }
77 77
     }
78 78
 
79
-    public static function getDbName($database = NULL)
79
+    public static function getDbName($database = null)
80 80
     {
81 81
         global $config;
82 82
         if (self::isMultipleDatabaseEnabled()) {
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         return '';
91 91
     }
92 92
 
93
-    public static function getDbDirectory($database = NULL)
93
+    public static function getDbDirectory($database = null)
94 94
     {
95 95
         global $config;
96 96
         if (self::isMultipleDatabaseEnabled()) {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         return $config['calibre_directory'];
105 105
     }
106 106
 
107
-    public static function getDbFileName($database = NULL)
107
+    public static function getDbFileName($database = null)
108 108
     {
109 109
         return self::getDbDirectory($database) .'metadata.db';
110 110
     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         throw new Exception('Database <' . $database . '> not found.');
118 118
     }
119 119
 
120
-    public static function getDb ($database = NULL)
120
+    public static function getDb ($database = null)
121 121
     {
122 122
         if (is_null (self::$db)) {
123 123
             try {
@@ -151,22 +151,22 @@  discard block
 block discarded – undo
151 151
 
152 152
     public static function clearDb()
153 153
     {
154
-        self::$db = NULL;
154
+        self::$db = null;
155 155
     }
156 156
 
157
-    public static function executeQuerySingle($query, $database = NULL)
157
+    public static function executeQuerySingle($query, $database = null)
158 158
     {
159 159
         return self::getDb($database)->query($query)->fetchColumn();
160 160
     }
161 161
 
162
-    public static function getCountGeneric($table, $id, $pageId, $numberOfString = NULL)
162
+    public static function getCountGeneric($table, $id, $pageId, $numberOfString = null)
163 163
     {
164 164
         if (!$numberOfString) {
165 165
             $numberOfString = $table . '.alphabetical';
166 166
         }
167 167
         $count = self::executeQuerySingle('select count(*) from ' . $table);
168 168
         if ($count == 0) {
169
-            return NULL;
169
+            return null;
170 170
         }
171 171
         $entry = new Entry(localize($table . '.title'), $id,
172 172
             str_format(localize($numberOfString, $count), $count), 'text',
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         return $entryArray;
198 198
     }
199 199
 
200
-    public static function executeQuery($query, $columns, $filter, $params, $n, $database = NULL, $numberPerPage = NULL)
200
+    public static function executeQuery($query, $columns, $filter, $params, $n, $database = null, $numberPerPage = null)
201 201
     {
202 202
         $totalResult = -1;
203 203
 
Please login to merge, or discard this patch.