Code formatting

This commit is contained in:
Franck Allimant
2014-04-14 10:48:46 +02:00
parent a3f6d749f2
commit 08b2d6dfd6

View File

@@ -55,10 +55,11 @@ class Database
} }
// Get the PDO connection from an // Get the PDO connection from an
if ($connection instanceof ConnectionWrapper) if ($connection instanceof ConnectionWrapper) {
$connection = $connection->getWrappedConnection(); $connection = $connection->getWrappedConnection();
}
if (! $connection instanceof \PDO) { if (!$connection instanceof \PDO) {
throw new \InvalidArgumentException("A PDO connection shoud be provided"); throw new \InvalidArgumentException("A PDO connection shoud be provided");
} }
@@ -95,7 +96,7 @@ class Database
} }
} }
$size = count($sql); $size = count($sql);
for ($i = 0; $i < $size; $i ++) { for ($i = 0; $i < $size; $i++) {
if (!empty($sql[$i])) { if (!empty($sql[$i])) {
$this->execute($sql[$i]); $this->execute($sql[$i]);
} }
@@ -108,7 +109,8 @@ class Database
* @param string $sql SQL query * @param string $sql SQL query
* @param array $args SQL request parameters (PDO style) * @param array $args SQL request parameters (PDO style)
*/ */
public function execute($sql, $args = array()) { public function execute($sql, $args = array())
{
$this->connection->query($sql, $args); $this->connection->query($sql, $args);
} }
@@ -126,7 +128,7 @@ class Database
$tab = explode(";\n", $sql); $tab = explode(";\n", $sql);
$size = count($tab); $size = count($tab);
for ($i=0; $i<$size; $i++) { for ($i = 0; $i < $size; $i++) {
$queryTemp = str_replace("-CODE-", ";',", $tab[$i]); $queryTemp = str_replace("-CODE-", ";',", $tab[$i]);
$queryTemp = str_replace("|", ";", $queryTemp); $queryTemp = str_replace("|", ";", $queryTemp);
$query[] = $queryTemp; $query[] = $queryTemp;