Completed
Pull Request — 3.4 (#46)
by David
13:58
created
src/Mouf/Database/TDBM/Controllers/TdbmInstallController.php 1 patch
Unused Use Statements   -4 removed lines patch added patch discarded remove patch
@@ -2,12 +2,8 @@
 block discarded – undo
2 2
 namespace Mouf\Database\TDBM\Controllers;
3 3
 
4 4
 use Mouf\Composer\ClassNameMapper;
5
-use Mouf\MoufUtils;
6
-
7 5
 use Mouf\Actions\InstallUtils;
8
-
9 6
 use Mouf\MoufManager;
10
-
11 7
 use Mouf\Html\HtmlElement\HtmlBlock;
12 8
 use Mouf\Mvc\Splash\Controllers\Controller;
13 9
 
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/Filters/OrderBySQLString.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -1,8 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Mouf\Database\TDBM\Filters;
3 3
 
4
-use Doctrine\DBAL\Driver\Connection;
5
-
6 4
 /*
7 5
  Copyright (C) 2006-2011 David Négrier - THE CODING MACHINE
8 6
 
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/InnerResultIterator.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Mouf\Database\TDBM;
3 3
 
4
-use Doctrine\DBAL\Driver\Connection;
5 4
 use Doctrine\DBAL\Statement;
6 5
 use Mouf\Database\MagicQuery;
7 6
 
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/PageIterator.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Mouf\Database\TDBM;
3 3
 
4
-use Doctrine\DBAL\Driver\Connection;
5 4
 use Doctrine\DBAL\Statement;
6 5
 use Mouf\Database\MagicQuery;
7 6
 use Porpaginas\Page;
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/ResultIterator.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Mouf\Database\TDBM;
3 3
 
4
-use Doctrine\DBAL\Driver\Connection;
5 4
 use Doctrine\DBAL\Statement;
6 5
 use Mouf\Database\MagicQuery;
7 6
 use Porpaginas\Result;
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/TDBMObject.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,6 @@
 block discarded – undo
18 18
  along with this program; if not, write to the Free Software
19 19
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20 20
  */
21
-use Doctrine\DBAL\Driver\Connection;
22 21
 
23 22
 
24 23
 /**
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/TDBMService.php 2 patches
Unused Use Statements   -4 removed lines patch added patch discarded remove patch
@@ -22,16 +22,12 @@
 block discarded – undo
22 22
 use Doctrine\Common\Cache\Cache;
23 23
 use Doctrine\Common\Cache\VoidCache;
24 24
 use Doctrine\DBAL\Connection;
25
-use Doctrine\DBAL\DBALException;
26
-use Doctrine\DBAL\Schema\Column;
27 25
 use Doctrine\DBAL\Schema\ForeignKeyConstraint;
28
-use Doctrine\DBAL\Schema\Schema;
29 26
 use Mouf\Database\MagicQuery;
30 27
 use Mouf\Database\SchemaAnalyzer\SchemaAnalyzer;
31 28
 use Mouf\Database\TDBM\Filters\OrderBySQLString;
32 29
 use Mouf\Database\TDBM\Utils\TDBMDaoGenerator;
33 30
 use Mouf\Utils\Cache\CacheInterface;
34
-use SQLParser\Node\ColRef;
35 31
 
36 32
 /**
37 33
  * The TDBMService class is the main TDBM class. It provides methods to retrieve TDBMObject instances
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -441,10 +441,11 @@  discard block
 block discarded – undo
441 441
 			/*$data =*/ $this->connection->getTableInfo($table_name);
442 442
 		} catch (TDBMException $exception) {
443 443
 			$probable_table_name = $this->connection->checkTableExist($table_name);
444
-			if ($probable_table_name == null)
445
-			throw new TDBMException("Error while calling TDBMObject::getNewObject(): The table named '$table_name' does not exist.");
446
-			else
447
-			throw new TDBMException("Error while calling TDBMObject::getNewObject(): The table named '$table_name' does not exist. Maybe you meant the table '$probable_table_name'.");
444
+			if ($probable_table_name == null) {
445
+						throw new TDBMException("Error while calling TDBMObject::getNewObject(): The table named '$table_name' does not exist.");
446
+			} else {
447
+						throw new TDBMException("Error while calling TDBMObject::getNewObject(): The table named '$table_name' does not exist. Maybe you meant the table '$probable_table_name'.");
448
+			}
448 449
 		}
449 450
 
450 451
 		if ($className === null) {
@@ -886,8 +887,9 @@  discard block
 block discarded – undo
886 887
 		// Fourth, let's apply the same steps to the orderby_bag
887 888
 		// 4-1 orderby_bag should be an array, if it is a singleton, let's put it in an array.
888 889
 
889
-		if (!is_array($orderby_bag))
890
-		$orderby_bag = array($orderby_bag);
890
+		if (!is_array($orderby_bag)) {
891
+				$orderby_bag = array($orderby_bag);
892
+		}
891 893
 
892 894
 		// 4-2, let's take all the objects out of the orderby bag, and let's make objects from them
893 895
 		$orderby_bag2 = array();
Please login to merge, or discard this patch.
src/Mouf/Database/TDBM/Utils/TDBMDaoGenerator.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,6 @@
 block discarded – undo
2 2
 namespace Mouf\Database\TDBM\Utils;
3 3
 
4 4
 use Doctrine\DBAL\Driver\Connection;
5
-use Doctrine\DBAL\Schema\Column;
6
-use Doctrine\DBAL\Schema\ForeignKeyConstraint;
7 5
 use Doctrine\DBAL\Schema\Schema;
8 6
 use Doctrine\DBAL\Schema\Table;
9 7
 use Doctrine\DBAL\Types\Type;
Please login to merge, or discard this 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/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.