Completed
Pull Request — 3.4 (#46)
by David
07:34 queued 01:29
created
src/Mouf/Database/TDBM/Filters/OrderBySQLString.php 1 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/Utils/TDBMDaoGenerator.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -230,7 +230,7 @@
 block discarded – undo
230 230
                 $defaultSort = $data['column_name'];
231 231
                 if (count($matches == 3)){
232 232
                     $defaultSortDirection = $matches[2];
233
-                }else{
233
+                } else{
234 234
                     $defaultSortDirection = 'ASC';
235 235
                 }
236 236
             }
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/AmbiguityException.php 1 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 1 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/MapIterator.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,12 +27,10 @@
 block discarded – undo
27 27
     public function __construct($iterator, callable $callable) {
28 28
         if (is_array($iterator)) {
29 29
             $this->iterator = new \ArrayIterator($iterator);
30
-        }
31
-        elseif (!($iterator instanceof Iterator))
30
+        } elseif (!($iterator instanceof Iterator))
32 31
         {
33 32
             throw new TDBMException("\$iterator parameter must be an instance of Iterator");
34
-        }
35
-        else
33
+        } else
36 34
         {
37 35
             $this->iterator = $iterator;
38 36
         }
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/TDBMService.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -693,8 +693,9 @@
 block discarded – undo
693 693
 		// Fourth, let's apply the same steps to the orderby_bag
694 694
 		// 4-1 orderby_bag should be an array, if it is a singleton, let's put it in an array.
695 695
 
696
-		if (!is_array($orderby_bag))
697
-		$orderby_bag = array($orderby_bag);
696
+		if (!is_array($orderby_bag)) {
697
+				$orderby_bag = array($orderby_bag);
698
+		}
698 699
 
699 700
 		// 4-2, let's take all the objects out of the orderby bag, and let's make objects from them
700 701
 		$orderby_bag2 = array();
Please login to merge, or discard this patch.