Completed
Pull Request — master (#221)
by Maximilian
10:25 queued 07:13
created
includes/DataObjects/Request.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -271,7 +271,9 @@
 block discarded – undo
271 271
 			return true;
272 272
 		}
273 273
 
274
-		if (is_null(self::$commentsQuery)) self::$commentsQuery = $this->dbObject->prepare("SELECT COUNT(*) as num FROM comment where request = :id;");
274
+		if (is_null(self::$commentsQuery)) {
275
+			self::$commentsQuery = $this->dbObject->prepare("SELECT COUNT(*) as num FROM comment where request = :id;");
276
+		}
275 277
 		self::$commentsQuery->bindValue(":id", $this->id);
276 278
 
277 279
 		self::$commentsQuery->execute();
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -261,8 +261,8 @@
 block discarded – undo
261 261
 		}
262 262
         
263 263
 		if (isset(self::$commentsResults[$this->id])) {
264
-		    $this->hasCommentsResolved = true;
265
-		    return $this->hasComments = self::$commentsResults[$this->id];
264
+			$this->hasCommentsResolved = true;
265
+			return $this->hasComments = self::$commentsResults[$this->id];
266 266
 		}
267 267
 
268 268
 		if ($this->comment != "") {
Please login to merge, or discard this patch.
includes/DataObject.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,8 +44,8 @@
 block discarded – undo
44 44
 	 */
45 45
 	public static function getById($id, PdoDatabase $database)
46 46
 	{
47
-		if( isset( self::$getByIdResults[strtolower(get_called_class())][$id] ) ) return self::$getByIdResults[strtolower(get_called_class())][$id];
48
-		if( !isset( self::$getByIdStatement[strtolower(get_called_class())] ) ) self::$getByIdStatement[strtolower(get_called_class())] = $database->prepare("SELECT * FROM `" . strtolower(get_called_class()) . "` WHERE id = :id LIMIT 1;");
47
+		if (isset(self::$getByIdResults[strtolower(get_called_class())][$id])) return self::$getByIdResults[strtolower(get_called_class())][$id];
48
+		if (!isset(self::$getByIdStatement[strtolower(get_called_class())])) self::$getByIdStatement[strtolower(get_called_class())] = $database->prepare("SELECT * FROM `" . strtolower(get_called_class()) . "` WHERE id = :id LIMIT 1;");
49 49
 		self::$getByIdStatement[strtolower(get_called_class())]->bindValue(":id", $id);
50 50
 
51 51
 		self::$getByIdStatement[strtolower(get_called_class())]->execute();
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,8 +44,12 @@
 block discarded – undo
44 44
 	 */
45 45
 	public static function getById($id, PdoDatabase $database)
46 46
 	{
47
-		if( isset( self::$getByIdResults[strtolower(get_called_class())][$id] ) ) return self::$getByIdResults[strtolower(get_called_class())][$id];
48
-		if( !isset( self::$getByIdStatement[strtolower(get_called_class())] ) ) self::$getByIdStatement[strtolower(get_called_class())] = $database->prepare("SELECT * FROM `" . strtolower(get_called_class()) . "` WHERE id = :id LIMIT 1;");
47
+		if( isset( self::$getByIdResults[strtolower(get_called_class())][$id] ) ) {
48
+			return self::$getByIdResults[strtolower(get_called_class())][$id];
49
+		}
50
+		if( !isset( self::$getByIdStatement[strtolower(get_called_class())] ) ) {
51
+			self::$getByIdStatement[strtolower(get_called_class())] = $database->prepare("SELECT * FROM `" . strtolower(get_called_class()) . "` WHERE id = :id LIMIT 1;");
52
+		}
49 53
 		self::$getByIdStatement[strtolower(get_called_class())]->bindValue(":id", $id);
50 54
 
51 55
 		self::$getByIdStatement[strtolower(get_called_class())]->execute();
Please login to merge, or discard this patch.