Completed
Pull Request — 3.3 (#155)
by Thibault
04:23
created
src/Mouf/Database/TDBM/Filters/OrderBySQLString.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -133,14 +133,14 @@
 block discarded – undo
133 133
 		$work_table = explode("'", $work_str);
134 134
 
135 135
 		if (count($work_table) == 0)
136
-		    return '';
136
+			return '';
137 137
 
138 138
 		// if we start with a ', let's remove the first text
139 139
 		if (strstr($work_str,"'") === 0)
140
-		    array_shift($work_table);
140
+			array_shift($work_table);
141 141
 			
142 142
 		if (count($work_table) == 0)
143
-		    return '';
143
+			return '';
144 144
 
145 145
 		// Now, let's take only the stuff outside the quotes.
146 146
 		$work_str2 = '';
Please login to merge, or discard this patch.
Braces   +19 added lines, -14 removed lines patch added patch discarded remove patch
@@ -87,8 +87,9 @@  discard block
 block discarded – undo
87 87
 			while (true) {
88 88
 				$result = strrpos($phrase, "'", $result+1);
89 89
 				if ($result===false) {
90
-					if ($sentence!='')
91
-					$sentence .= ',';
90
+					if ($sentence!='') {
91
+										$sentence .= ',';
92
+					}
92 93
 					$sentence .= $phrase;
93 94
 
94 95
 					if ($is_inside_quotes) {
@@ -98,15 +99,15 @@  discard block
 block discarded – undo
98 99
 						$sentence = '';
99 100
 						break;
100 101
 					}
101
-				}
102
-				else
102
+				} else
103 103
 				{
104 104
 					$valid_result = true;
105 105
 					if ($result>0 && $phrase{$result-1}=='\\') {
106 106
 						$valid_result = false;
107 107
 					}
108
-					if ($valid_result)
109
-					$is_inside_quotes = !$is_inside_quotes;
108
+					if ($valid_result) {
109
+										$is_inside_quotes = !$is_inside_quotes;
110
+					}
110 111
 				}
111 112
 			}
112 113
 
@@ -132,23 +133,27 @@  discard block
 block discarded – undo
132 133
 		// Now, let's split the string using '
133 134
 		$work_table = explode("'", $work_str);
134 135
 
135
-		if (count($work_table) == 0)
136
-		    return '';
136
+		if (count($work_table) == 0) {
137
+				    return '';
138
+		}
137 139
 
138 140
 		// if we start with a ', let's remove the first text
139
-		if (strstr($work_str,"'") === 0)
140
-		    array_shift($work_table);
141
+		if (strstr($work_str,"'") === 0) {
142
+				    array_shift($work_table);
143
+		}
141 144
 			
142
-		if (count($work_table) == 0)
143
-		    return '';
145
+		if (count($work_table) == 0) {
146
+				    return '';
147
+		}
144 148
 
145 149
 		// Now, let's take only the stuff outside the quotes.
146 150
 		$work_str2 = '';
147 151
 
148 152
 		$i = 0;
149 153
 		foreach ($work_table as $str_fragment) {
150
-			if (($i % 2) == 0)
151
-			$work_str2 .= $str_fragment.' ';
154
+			if (($i % 2) == 0) {
155
+						$work_str2 .= $str_fragment.' ';
156
+			}
152 157
 			$i++;
153 158
 		}
154 159
 
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/Filters/SqlStringFilter.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -99,23 +99,27 @@
 block discarded – undo
99 99
 		// Now, let's split the string using '
100 100
 		$work_table = explode("'", $work_str);
101 101
 
102
-		if (count($work_table)==0)
103
-		return '';
102
+		if (count($work_table)==0) {
103
+				return '';
104
+		}
104 105
 
105 106
 		// if we start with a ', let's remove the first text
106
-		if (strstr($work_str,"'")===0)
107
-		array_shift($work_table);
107
+		if (strstr($work_str,"'")===0) {
108
+				array_shift($work_table);
109
+		}
108 110
 			
109
-		if (count($work_table)==0)
110
-		return '';
111
+		if (count($work_table)==0) {
112
+				return '';
113
+		}
111 114
 
112 115
 		// Now, let's take only the stuff outside the quotes.
113 116
 		$work_str2 = '';
114 117
 
115 118
 		$i=0;
116 119
 		foreach ($work_table as $str_fragment) {
117
-			if (($i % 2) == 0)
118
-			$work_str2 .= $str_fragment.' ';
120
+			if (($i % 2) == 0) {
121
+						$work_str2 .= $str_fragment.' ';
122
+			}
119 123
 			$i++;
120 124
 		}
121 125
 
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/AmbiguityException.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 	}
46 46
 
47 47
 	private function getAllPossiblePaths() {
48
-        return AmbiguityException::getAllPossiblePathsRec($this->paths);
48
+		return AmbiguityException::getAllPossiblePathsRec($this->paths);
49 49
 	}
50 50
 
51 51
 	private static function getAllPossiblePathsRec($sub_table_paths)
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,8 +50,9 @@  discard block
 block discarded – undo
50 50
 
51 51
 	private static function getAllPossiblePathsRec($sub_table_paths)
52 52
 	{
53
-		if (count($sub_table_paths)==0)
54
-		return array();
53
+		if (count($sub_table_paths)==0) {
54
+				return array();
55
+		}
55 56
 
56 57
 		$table_path = array_shift($sub_table_paths);
57 58
 		$possible_sub_paths =  AmbiguityException::getAllPossiblePathsRec($sub_table_paths);
@@ -63,9 +64,9 @@  discard block
 block discarded – undo
63 64
 				{
64 65
 					$return_table_paths[] = array_merge(array(array('paths'=>array($path))), $possible_sub_path);
65 66
 				}
67
+			} else {
68
+						$return_table_paths[] = array(array('paths'=>array($path)));
66 69
 			}
67
-			else
68
-			$return_table_paths[] = array(array('paths'=>array($path)));
69 70
 		}
70 71
 		return $return_table_paths;
71 72
 	}
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/TDBMObjectArray.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,9 +65,9 @@
 block discarded – undo
65 65
 	 * @param string $func_name
66 66
 	 * @param $values
67 67
 	 * @return array|void
68
-     * @throws TDBMException
68
+	 * @throws TDBMException
69 69
 	 */
70
-    public function __call($func_name, $values) {
70
+	public function __call($func_name, $values) {
71 71
 
72 72
 		if (strpos($func_name,"getarray_") === 0) {
73 73
 			$column = substr($func_name, 9);
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -31,12 +31,10 @@  discard block
 block discarded – undo
31 31
 		if ($cnt==1)
32 32
 		{
33 33
 			return $this[0]->__get($var);
34
-		}
35
-		elseif ($cnt>1)
34
+		} elseif ($cnt>1)
36 35
 		{
37 36
 			throw new TDBMException('Array contains many objects! Use getarray_'.$var.' to retrieve an array of '.$var);
38
-		}
39
-		else
37
+		} else
40 38
 		{
41 39
 			throw new TDBMException('Array contains no objects');
42 40
 		}
@@ -47,12 +45,10 @@  discard block
 block discarded – undo
47 45
 		if ($cnt==1)
48 46
 		{
49 47
 			return $this[0]->__set($var, $value);
50
-		}
51
-		elseif ($cnt>1)
48
+		} elseif ($cnt>1)
52 49
 		{
53 50
 			throw new TDBMException('Array contains many objects! Use setarray_'.$var.' to set the array of '.$var);
54
-		}
55
-		else
51
+		} else
56 52
 		{
57 53
 			throw new TDBMException('Array contains no objects');
58 54
 		}
@@ -77,8 +73,7 @@  discard block
 block discarded – undo
77 73
 			return $this->setarray($column, $values[0]);
78 74
 		} elseif (count($this)==1) {
79 75
 			$this[0]->__call($func_name, $values);
80
-		}
81
-		else
76
+		} else
82 77
 		{
83 78
 			throw new TDBMException("Method ".$func_name." not found");
84 79
 		}
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/DisplayNode.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,8 +67,7 @@
 block discarded – undo
67 67
 			if ($this->link_type == "*1")
68 68
 			{
69 69
 				echo "Table $this->table_name points to table ".$this->parent_node->table_name." through its foreign key on column $this->keyNode that points to column $this->keyParent<br />";
70
-			}
71
-			else if ($this->link_type == "1*")
70
+			} else if ($this->link_type == "1*")
72 71
 			{
73 72
 				echo "Table $this->table_name is pointed by table ".$this->parent_node->table_name." by its foreign key on column $this->keyParent that points to column $this->keyNode<br />";
74 73
 			}
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/Filters/BetweenFilter.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 	 * 
99 99
 	 * @param string $tableName
100 100
 	 * @param string $columnName
101
-     * @param string $value1
102
-     * @param string $value2
101
+	 * @param string $value1
102
+	 * @param string $value2
103 103
 	 */
104 104
 	public function __construct($tableName=null, $columnName=null, $value1=null, $value2=null) {
105 105
 		$this->tableName = $tableName;
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @param ConnectionInterface $dbConnection
115 115
 	 * @return string
116
-     * @throws \Mouf\Database\TDBM\TDBMException
116
+	 * @throws \Mouf\Database\TDBM\TDBMException
117 117
 	 */
118
-    public function toSql(ConnectionInterface $dbConnection) {
118
+	public function toSql(ConnectionInterface $dbConnection) {
119 119
 		if ($this->enableCondition != null && !$this->enableCondition->isOk()) {
120 120
 			return "";
121 121
 		}
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/Filters/OrFilter.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 	 *
69 69
 	 * @param ConnectionInterface $dbConnection
70 70
 	 * @return string
71
-     * @throws TDBMException
71
+	 * @throws TDBMException
72 72
 	 */
73
-    public function toSql(ConnectionInterface $dbConnection) {
73
+	public function toSql(ConnectionInterface $dbConnection) {
74 74
 		if ($this->enableCondition != null && !$this->enableCondition->isOk()) {
75 75
 			return "";
76 76
 		}
@@ -102,22 +102,22 @@  discard block
 block discarded – undo
102 102
 	 *
103 103
 	 * @return array<string>
104 104
 	 */
105
-    public function getUsedTables() {
106
-        if ($this->enableCondition != null && !$this->enableCondition->isOk()) {
107
-            return array();
108
-        }
109
-
110
-        $tables = array();
111
-        foreach ($this->filters as $filter) {
112
-
113
-            if (!$filter instanceof FilterInterface) {
114
-                throw new TDBMException("Error in OrFilter: One of the parameters is not a filter.");
115
-            }
116
-
117
-            $tables = array_merge($tables,$filter->getUsedTables());
118
-        }
119
-        // Remove tables in double.
120
-        $tables = array_flip(array_flip($tables));
121
-        return $tables;
122
-    }
105
+	public function getUsedTables() {
106
+		if ($this->enableCondition != null && !$this->enableCondition->isOk()) {
107
+			return array();
108
+		}
109
+
110
+		$tables = array();
111
+		foreach ($this->filters as $filter) {
112
+
113
+			if (!$filter instanceof FilterInterface) {
114
+				throw new TDBMException("Error in OrFilter: One of the parameters is not a filter.");
115
+			}
116
+
117
+			$tables = array_merge($tables,$filter->getUsedTables());
118
+		}
119
+		// Remove tables in double.
120
+		$tables = array_flip(array_flip($tables));
121
+		return $tables;
122
+	}
123 123
 }
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/TDBMObject.php 2 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -170,26 +170,26 @@  discard block
 block discarded – undo
170 170
 		$this->TDBMObject_state = $state;	
171 171
 	}
172 172
 
173
-    /**
174
-     * Internal TDBM method, you should not use this.
175
-     * Loads the db_row property of the object from the $row array.
176
-     * Any row having a key starting with 'tdbm_reserved_col_' is ignored.
177
-     *
178
-     * @param array $row
179
-     * @param array|null $colsArray A big optimization to avoid calling strpos to many times. This array should
180
-     *                              contain as keys the list of interesting columns. If null, this list will be initialized.
181
-     */
173
+	/**
174
+	 * Internal TDBM method, you should not use this.
175
+	 * Loads the db_row property of the object from the $row array.
176
+	 * Any row having a key starting with 'tdbm_reserved_col_' is ignored.
177
+	 *
178
+	 * @param array $row
179
+	 * @param array|null $colsArray A big optimization to avoid calling strpos to many times. This array should
180
+	 *                              contain as keys the list of interesting columns. If null, this list will be initialized.
181
+	 */
182 182
 	public function loadFromRow($row, &$colsArray) {
183
-        if ($colsArray === null) {
184
-            foreach ($row as $key=>$value) {
185
-                if (strpos($key, 'tdbm_reserved_col_')!==0) {
186
-                    $colsArray[$key] = true;
187
-                }
188
-            }
189
-        }
190
-
191
-        $this->db_row = array_intersect_key($row, $colsArray);
192
-        $this->TDBMObject_state = "loaded";
183
+		if ($colsArray === null) {
184
+			foreach ($row as $key=>$value) {
185
+				if (strpos($key, 'tdbm_reserved_col_')!==0) {
186
+					$colsArray[$key] = true;
187
+				}
188
+			}
189
+		}
190
+
191
+		$this->db_row = array_intersect_key($row, $colsArray);
192
+		$this->TDBMObject_state = "loaded";
193 193
 	}
194 194
 
195 195
 	/**
@@ -507,10 +507,10 @@  discard block
 block discarded – undo
507 507
 	 *
508 508
 	 * @param string $func_name
509 509
 	 * @param $values
510
-     * @return TDBMObjectArray A TDBMObjectArray containing the resulting objects of the query.
511
-     * @throws TDBMException
510
+	 * @return TDBMObjectArray A TDBMObjectArray containing the resulting objects of the query.
511
+	 * @throws TDBMException
512 512
 	 */
513
-    public function __call($func_name, $values) {
513
+	public function __call($func_name, $values) {
514 514
 
515 515
 		if (strpos($func_name,"get_") === 0) {
516 516
 			$table = substr($func_name,4);
@@ -545,48 +545,48 @@  discard block
 block discarded – undo
545 545
 	}
546 546
 	
547 547
 		/**
548
-	 * Implements array behaviour for our object.
549
-	 * 
550
-	 * @param string $offset
551
-	 * @param string $value
552
-	 */
548
+		 * Implements array behaviour for our object.
549
+		 * 
550
+		 * @param string $offset
551
+		 * @param string $value
552
+		 */
553 553
 	public function offsetSet($offset, $value) {
554 554
 		$this->__set($offset, $value);
555
-    }
555
+	}
556 556
 	/**
557 557
 	 * Implements array behaviour for our object.
558 558
 	 * 
559 559
 	 * @param string $offset
560
-     * @return bool
560
+	 * @return bool
561 561
 	 */
562
-    public function offsetExists($offset) {
563
-    	$this->_dbLoadIfNotLoaded();
564
-        return isset($this->db_row[$offset]);
565
-    }
562
+	public function offsetExists($offset) {
563
+		$this->_dbLoadIfNotLoaded();
564
+		return isset($this->db_row[$offset]);
565
+	}
566 566
 	/**
567 567
 	 * Implements array behaviour for our object.
568 568
 	 * 
569 569
 	 * @param string $offset
570 570
 	 */
571
-    public function offsetUnset($offset) {
571
+	public function offsetUnset($offset) {
572 572
 		$this->__set($offset, null);
573
-    }
573
+	}
574 574
 	/**
575 575
 	 * Implements array behaviour for our object.
576 576
 	 * 
577 577
 	 * @param string $offset
578
-     * @return mixed|null
578
+	 * @return mixed|null
579 579
 	 */
580
-    public function offsetGet($offset) {
581
-        return $this->__get($offset);
582
-    }
580
+	public function offsetGet($offset) {
581
+		return $this->__get($offset);
582
+	}
583 583
 	
584 584
 	private $_validIterator = false;
585 585
 	/**
586 586
 	 * Implements iterator behaviour for our object (so we can each column).
587 587
 	 */
588 588
 	public function rewind() {
589
-    	$this->_dbLoadIfNotLoaded();
589
+		$this->_dbLoadIfNotLoaded();
590 590
 		if (count($this->db_row)>0) {
591 591
 			$this->_validIterator = true;
592 592
 		} else {
@@ -674,21 +674,21 @@  discard block
 block discarded – undo
674 674
 		return $sql_where;
675 675
 	}
676 676
 
677
-    /**
678
-     * Override the native php clone function for TDBMObjects
679
-     */
680
-    public function __clone(){
681
-        $this->_dbLoadIfNotLoaded();
682
-        //First lets set the status to new (to enter the save function)
683
-        $this->TDBMObject_state = "new";
684
-
685
-        // Add the current TDBMObject to the save object list
686
-        $this->tdbmService->_addToToSaveObjectList($this);
687
-
688
-        //Now unset the PK from the row
689
-        $pk_array = $this->getPrimaryKey();
690
-        foreach ($pk_array as $pk) {
691
-            $this->db_row[$pk] = null;
692
-        }
693
-    }
677
+	/**
678
+	 * Override the native php clone function for TDBMObjects
679
+	 */
680
+	public function __clone(){
681
+		$this->_dbLoadIfNotLoaded();
682
+		//First lets set the status to new (to enter the save function)
683
+		$this->TDBMObject_state = "new";
684
+
685
+		// Add the current TDBMObject to the save object list
686
+		$this->tdbmService->_addToToSaveObjectList($this);
687
+
688
+		//Now unset the PK from the row
689
+		$pk_array = $this->getPrimaryKey();
690
+		foreach ($pk_array as $pk) {
691
+			$this->db_row[$pk] = null;
692
+		}
693
+	}
694 694
 }
695 695
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +30 added lines, -23 removed lines patch added patch discarded remove patch
@@ -263,10 +263,11 @@  discard block
 block discarded – undo
263 263
 				// Let's try to be accurate in error reporting. The checkColumnExist returns an array of closest matches.
264 264
 				$result_array = $column_exist;
265 265
 				
266
-				if (count($result_array)==1)
267
-				$str = "Could not find column \"$var\" in table \"$this->db_table_name\". Maybe you meant this column: '".$result_array[0]."'";
268
-				else
269
-				$str = "Could not find column \"$var\" in table \"$this->db_table_name\". Maybe you meant one of those columns: '".implode("', '",$result_array)."'";
266
+				if (count($result_array)==1) {
267
+								$str = "Could not find column \"$var\" in table \"$this->db_table_name\". Maybe you meant this column: '".$result_array[0]."'";
268
+				} else {
269
+								$str = "Could not find column \"$var\" in table \"$this->db_table_name\". Maybe you meant one of those columns: '".implode("', '",$result_array)."'";
270
+				}
270 271
 	
271 272
 	
272 273
 				throw new TDBMException($str);
@@ -348,10 +349,11 @@  discard block
 block discarded – undo
348 349
 			if (count($pk_array)>1 && !$pk_set) {
349 350
 				$msg = "Error! You did not set the primary keys for the new object of type '$this->db_table_name'. TDBM usually assumes that the primary key is automatically set by the DB engine to the maximum value in the database. However, in this case, the '$this->db_table_name' table has a primary key on multiple columns. TDBM would be unable to find back this record after save. Please specify the primary keys for all new objects of kind '$this->db_table_name'.";
350 351
 
351
-				if (!$this->tdbmService->isProgramExiting())
352
-				throw new TDBMException($msg);
353
-				else
354
-				trigger_error($msg, E_USER_ERROR);
352
+				if (!$this->tdbmService->isProgramExiting()) {
353
+								throw new TDBMException($msg);
354
+				} else {
355
+								trigger_error($msg, E_USER_ERROR);
356
+				}
355 357
 			}
356 358
 			
357 359
 			$sql = 'INSERT INTO '.$this->db_connection->escapeDBItem($this->db_table_name).
@@ -360,8 +362,9 @@  discard block
 block discarded – undo
360 362
 
361 363
 			$first = true;
362 364
 			foreach ($this->db_row as $key=>$value) {
363
-				if (!$first)
364
-				$sql .= ',';
365
+				if (!$first) {
366
+								$sql .= ',';
367
+				}
365 368
 				$sql .= $this->db_connection->quoteSmart($value);
366 369
 				$first=false;
367 370
 			}
@@ -378,9 +381,9 @@  discard block
 block discarded – undo
378 381
 				//	trigger_error("program exiting");
379 382
 				trigger_error($e->getMessage(), E_USER_ERROR);
380 383
 
381
-				if (!$this->tdbmService->isProgramExiting())
382
-				throw $e;
383
-				else
384
+				if (!$this->tdbmService->isProgramExiting()) {
385
+								throw $e;
386
+				} else
384 387
 				{
385 388
 					trigger_error($e->getMessage(), E_USER_ERROR);
386 389
 				}
@@ -447,8 +450,9 @@  discard block
 block discarded – undo
447 450
 
448 451
 			$first = true;
449 452
 			foreach ($this->db_row as $key=>$value) {
450
-				if (!$first)
451
-				$sql .= ',';
453
+				if (!$first) {
454
+								$sql .= ',';
455
+				}
452 456
 				$sql .= $this->db_connection->escapeDBItem($key)." = ".$this->db_connection->quoteSmart($value);
453 457
 				$first=false;
454 458
 			}
@@ -456,10 +460,11 @@  discard block
 block discarded – undo
456 460
 			try {
457 461
 				$this->db_connection->exec($sql);
458 462
 			} catch (TDBMException $e) {
459
-				if (!$this->tdbmService->isProgramExiting())
460
-				throw $e;
461
-				else
462
-				trigger_error($e->getMessage(), E_USER_ERROR);
463
+				if (!$this->tdbmService->isProgramExiting()) {
464
+								throw $e;
465
+				} else {
466
+								trigger_error($e->getMessage(), E_USER_ERROR);
467
+				}
463 468
 			}
464 469
 
465 470
 			// Let's remove this object from the $new_objects static table.
@@ -490,11 +495,13 @@  discard block
 block discarded – undo
490 495
 	 *
491 496
 	 */
492 497
 	public function discardChanges() {
493
-		if ($this->TDBMObject_state == "new")
494
-		throw new TDBMException("You cannot call discardChanges() on an object that has been created with getNewObject and that has not yet been saved.");
498
+		if ($this->TDBMObject_state == "new") {
499
+				throw new TDBMException("You cannot call discardChanges() on an object that has been created with getNewObject and that has not yet been saved.");
500
+		}
495 501
 
496
-		if ($this->TDBMObject_state == "deleted")
497
-		throw new TDBMException("You cannot call discardChanges() on an object that has been deleted.");
502
+		if ($this->TDBMObject_state == "deleted") {
503
+				throw new TDBMException("You cannot call discardChanges() on an object that has been deleted.");
504
+		}
498 505
 			
499 506
 		$this->db_modified_state = false;
500 507
 		$this->TDBMObject_state = "not loaded";
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/TDBMObjectArrayCursorIterator.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 */
56 56
 	protected $current = false;
57 57
 
58
-    private $colsArray = null;
58
+	private $colsArray = null;
59 59
 	
60 60
 	public function __construct(\PDOStatement $pdoStatement, ConnectionInterface $dbConnection, $primary_keys, $table_name, $objectStorage, $className, TDBMService $tdbmService, $sql)
61 61
 	{
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
 	 * Casts a document to a new instance specified in the $recordClass
74 74
 	 * @param array $fullCaseRow
75 75
 	 * @return Record_Abstract|false
76
-     * @throws TDBMException
76
+	 * @throws TDBMException
77 77
 	 */
78
-    protected function cast($fullCaseRow)
78
+	protected function cast($fullCaseRow)
79 79
 	{
80 80
 		if (!is_array($fullCaseRow)) {
81 81
 			return false;
Please login to merge, or discard this patch.
Braces   +14 added lines, -12 removed lines patch added patch discarded remove patch
@@ -101,8 +101,7 @@  discard block
 block discarded – undo
101 101
 				throw new TDBMException("Bad SQL request passed to getObjectsFromSQL. The SQL request should return all the rows from the '".$this->table_name."' table. Could not find primary key in this set of rows. SQL request passed: ".$this->sql);
102 102
 			}
103 103
 			$id = $row[$this->keysStandardCased[$this->primary_keys[0]]];
104
-		}
105
-		else
104
+		} else
106 105
 		{
107 106
 			// Let's generate the serialized primary key from the columns!
108 107
 			$ids = array();
@@ -181,12 +180,14 @@  discard block
 block discarded – undo
181 180
 		if ($this->hasNext()) {
182 181
 			$this->cursor++;
183 182
 			$this->current = $this->pdoStatement->fetch(\PDO::FETCH_ASSOC);
184
-			if (empty($this->current))
185
-				$this->current = false;
186
-			else
187
-				return true;
188
-		}else
189
-			$this->current = false;
183
+			if (empty($this->current)) {
184
+							$this->current = false;
185
+			} else {
186
+							return true;
187
+			}
188
+		} else {
189
+					$this->current = false;
190
+		}
190 191
 		return false;
191 192
 	}
192 193
 	
@@ -259,10 +260,11 @@  discard block
 block discarded – undo
259 260
 		$all = array();
260 261
 		$this->rewind();
261 262
 		foreach ($this->pdoStatement as $id => $doc) {
262
-			if ($asRecords)
263
-				$all[$id] = $this->cast($doc);
264
-			else
265
-				$all[$id] = $doc;
263
+			if ($asRecords) {
264
+							$all[$id] = $this->cast($doc);
265
+			} else {
266
+							$all[$id] = $doc;
267
+			}
266 268
 		}
267 269
 		return $all;
268 270
 	}
Please login to merge, or discard this patch.