Passed
Push — master ( b679bb...8851e6 )
by Anthony
03:00
created
core/Database.class.php 3 patches
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 	namespace core;
3 3
 
4
-	use core\HTML\flashmessage\FlashMessage;
4
+	use core\HTML\flashmessage\FlashMessage;
5 5
 	use PDO;
6 6
 
7 7
 	class Database {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -170,6 +170,6 @@
 block discarded – undo
170 170
 		}
171 171
 
172 172
 		public function getQuery() {
173
-			return "SELECT ". implode(", ", $this->fiels) . " FROM " . implode(",", $this->from) . " WHERE " . implode(" AND ", $this->conditions);
173
+			return "SELECT ".implode(", ", $this->fiels)." FROM ".implode(",", $this->from)." WHERE ".implode(" AND ", $this->conditions);
174 174
 		}
175 175
 	}
176 176
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +9 added lines, -13 removed lines patch added patch discarded remove patch
@@ -51,8 +51,7 @@  discard block
 block discarded – undo
51 51
 			if ($query) {
52 52
 				$obj = $query->fetchAll(PDO::FETCH_OBJ);
53 53
 				return $obj;
54
-			}
55
-			else {
54
+			} else {
56 55
 				FlashMessage::setFlash("Une erreur est survenue en executant cette requette : ".$req);
57 56
 			}
58 57
 		}
@@ -71,8 +70,7 @@  discard block
 block discarded – undo
71 70
 						$err = true;
72 71
 					}
73 72
 				}
74
-			}
75
-			else {
73
+			} else {
76 74
 				if (!$query->execute($value)) {
77 75
 					$err = true;
78 76
 				}
@@ -94,8 +92,7 @@  discard block
 block discarded – undo
94 92
 		public function rechercherEgalite($table, $champ, $value, $id_table = null, $id = null) {
95 93
 			if ($id == null) {
96 94
 				$query = $this->getPdo()->query("SELECT COUNT($champ) as nb FROM $table WHERE $champ LIKE '$value'");
97
-			}
98
-			else {
95
+			} else {
99 96
 				$query = $this->getPdo()->query("SELECT COUNT($champ) as nb FROM $table WHERE $champ LIKE '$value' AND $id_table != $id");
100 97
 			}
101 98
 
@@ -104,9 +101,10 @@  discard block
 block discarded – undo
104 101
 					$nb = $obj["nb"];
105 102
 				}
106 103
 
107
-				if ((isset($nb)) && ($nb != 0)) return true;
108
-			}
109
-			else {
104
+				if ((isset($nb)) && ($nb != 0)) {
105
+					return true;
106
+				}
107
+			} else {
110 108
 				return false;
111 109
 			}
112 110
 		}
@@ -123,8 +121,7 @@  discard block
 block discarded – undo
123 121
 
124 122
 			if ($query->rowCount() > 0) {
125 123
 				return true;
126
-			}
127
-			else {
124
+			} else {
128 125
 				return false;
129 126
 			}
130 127
 		}
@@ -161,8 +158,7 @@  discard block
 block discarded – undo
161 158
 		public function from($table, $alias) {
162 159
 			if (is_null($alias)) {
163 160
 				$this->from[] = $table;
164
-			}
165
-			else {
161
+			} else {
166 162
 				$this->from[] = "$table as $alias";
167 163
 			}
168 164
 
Please login to merge, or discard this patch.