@@ -134,7 +134,7 @@ |
||
| 134 | 134 | 'password' => $this->_password[$connectionName], |
| 135 | 135 | 'charset' => $this->_charset[$connectionName], |
| 136 | 136 | 'schema' => $this->_schema[$connectionName]]; |
| 137 | - } else { |
|
| 137 | + }else { |
|
| 138 | 138 | throw new \Exception("The connection name $connectionName is not set."); |
| 139 | 139 | } |
| 140 | 140 | |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | if (!empty($this->_data[$key])) { |
| 136 | 136 | $sql = 'UPDATE ' . $_tableName . ' SET '; |
| 137 | 137 | |
| 138 | - if (count($this->_newData) <= 0){ |
|
| 139 | - Error::create('Don\'t have alter data.', 1,'InvalidArgumentException'); |
|
| 138 | + if (count($this->_newData) <= 0) { |
|
| 139 | + Error::create('Don\'t have alter data.', 1, 'InvalidArgumentException'); |
|
| 140 | 140 | return false; |
| 141 | 141 | } |
| 142 | 142 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $this->_newData[] = $this->{$key}; |
| 147 | 147 | |
| 148 | 148 | $update = true; |
| 149 | - } else { |
|
| 149 | + }else { |
|
| 150 | 150 | /** |
| 151 | 151 | * Insert case don't have primary key |
| 152 | 152 | */ |
@@ -162,8 +162,8 @@ discard block |
||
| 162 | 162 | $insert = $this->Connection->getConnection()->prepare($sql); |
| 163 | 163 | $this->burnError($insert); |
| 164 | 164 | |
| 165 | - $this->_newData = array_map(function ($data){ |
|
| 166 | - if(is_bool($data) and $data === false) $data = 0; |
|
| 165 | + $this->_newData = array_map(function($data) { |
|
| 166 | + if (is_bool($data) and $data === false) $data = 0; |
|
| 167 | 167 | |
| 168 | 168 | return $data; |
| 169 | 169 | }, $this->_newData); |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | return true; |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - private function burnError($statment){ |
|
| 195 | + private function burnError($statment) { |
|
| 196 | 196 | if (!is_null($statment->errorInfo()[1])) throw new \Exception($statment->errorInfo()[2], $statment->errorInfo()[1]); |
| 197 | 197 | } |
| 198 | 198 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | $instance = self::$_instance; |
| 219 | 219 | |
| 220 | - if (is_callable($this->triggerBefore)) ($this->triggerBefore)();; |
|
| 220 | + if (is_callable($this->triggerBefore)) ($this->triggerBefore)(); ; |
|
| 221 | 221 | |
| 222 | 222 | $start = microtime(true); |
| 223 | 223 | |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | if ($instance->Connection->getConnection()->lastInsertId() == '-1' || $instance->Connection->getConnection()->lastInsertId() == 0) { |
| 375 | 375 | return false; |
| 376 | - } else { |
|
| 376 | + }else { |
|
| 377 | 377 | return $instance; |
| 378 | 378 | } |
| 379 | 379 | } |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | |
| 527 | 527 | if ($match) { |
| 528 | 528 | $this->_data = $objetos = $consulta->fetchAll(\PDO::FETCH_CLASS, get_called_class()); |
| 529 | - } else { |
|
| 529 | + }else { |
|
| 530 | 530 | $objetos = $consulta->rowCount(); |
| 531 | 531 | } |
| 532 | 532 | |
@@ -202,7 +202,7 @@ |
||
| 202 | 202 | if (substr_count($last, 'ORDER BY') > 0) { |
| 203 | 203 | $sql .= isset($this->_group) ? $this->_group : ''; |
| 204 | 204 | $sql .= $last; |
| 205 | - } else { |
|
| 205 | + }else { |
|
| 206 | 206 | $sql .= $last; |
| 207 | 207 | $sql .= isset($this->_group) ? $this->_group : ''; |
| 208 | 208 | } |
@@ -100,8 +100,7 @@ discard block |
||
| 100 | 100 | $default = $this->Config->getDefault(); |
| 101 | 101 | |
| 102 | 102 | $name = is_null($default) ? |
| 103 | - @end(array_keys($configs)) : |
|
| 104 | - $this->Config->getDefault(); |
|
| 103 | + @end(array_keys($configs)) : $this->Config->getDefault(); |
|
| 105 | 104 | |
| 106 | 105 | self::open($name); |
| 107 | 106 | } |
@@ -132,7 +131,7 @@ discard block |
||
| 132 | 131 | } catch (\Exception $e) { |
| 133 | 132 | throw $e; |
| 134 | 133 | } |
| 135 | - } else { |
|
| 134 | + }else { |
|
| 136 | 135 | |
| 137 | 136 | throw new \Exception("This connection isn't actived."); |
| 138 | 137 | } |
@@ -178,7 +177,7 @@ discard block |
||
| 178 | 177 | { |
| 179 | 178 | if (array_key_exists($connectionName, $this->connections)) { |
| 180 | 179 | return true; |
| 181 | - } else { |
|
| 180 | + }else { |
|
| 182 | 181 | return false; |
| 183 | 182 | } |
| 184 | 183 | } |
@@ -201,7 +200,7 @@ discard block |
||
| 201 | 200 | { |
| 202 | 201 | if (array_key_exists($connectionName, $this->Config->getConfigs())) { |
| 203 | 202 | return true; |
| 204 | - } else { |
|
| 203 | + }else { |
|
| 205 | 204 | return false; |
| 206 | 205 | } |
| 207 | 206 | } |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | * @param \Closure $connection |
| 55 | 55 | * @return \ConnectionManager |
| 56 | 56 | */ |
| 57 | - $connectionManager = ConnectionManager::initialize(function ($connection) { |
|
| 57 | + $connectionManager = ConnectionManager::initialize(function($connection) { |
|
| 58 | 58 | /** |
| 59 | 59 | * 4. Add the configurations using the method addConfig, accepts various configurations |
| 60 | 60 | * Arguments: |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * @param \Closure $connection |
| 33 | 33 | * @return \ConnectionManager |
| 34 | 34 | */ |
| 35 | - $connectionManager = ConnectionManager::initialize(function ($connection) { |
|
| 35 | + $connectionManager = ConnectionManager::initialize(function($connection) { |
|
| 36 | 36 | /** |
| 37 | 37 | * Add the configurations using the method addConfig, accepts various configurations |
| 38 | 38 | * Arguments: |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | $usage = UsageModel::procedure('criar_usuario', ['Teste procedure apelido']); |
| 56 | 56 | var_dump($usage); |
| 57 | - if($usage){ |
|
| 57 | + if ($usage) { |
|
| 58 | 58 | var_dump($usage); |
| 59 | - }else{ |
|
| 59 | + }else { |
|
| 60 | 60 | echo 'The procedure not executed.'; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * @param \Closure $connection |
| 40 | 40 | * @return \ConnectionManager |
| 41 | 41 | */ |
| 42 | - $connectionManager = ConnectionManager::initialize(function ($connection) { |
|
| 42 | + $connectionManager = ConnectionManager::initialize(function($connection) { |
|
| 43 | 43 | /** |
| 44 | 44 | * Add the configurations using the method addConfig, accepts various configurations |
| 45 | 45 | * Arguments: |
@@ -73,9 +73,9 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | $result = $usage->save(); |
| 75 | 75 | |
| 76 | - if($result){ |
|
| 76 | + if ($result) { |
|
| 77 | 77 | echo 'Data Edited.'; |
| 78 | - }else{ |
|
| 78 | + }else { |
|
| 79 | 79 | echo 'Haven\'t data for this ID.'; |
| 80 | 80 | } |
| 81 | 81 | |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | * @param \Closure $connection |
| 40 | 40 | * @return \ConnectionManager |
| 41 | 41 | */ |
| 42 | - $connectionManager = ConnectionManager::initialize(function ($connection) { |
|
| 42 | + $connectionManager = ConnectionManager::initialize(function($connection) { |
|
| 43 | 43 | /** |
| 44 | 44 | * Add the configurations using the method addConfig, accepts various configurations |
| 45 | 45 | * Arguments: |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @return Connection |
| 45 | 45 | */ |
| 46 | 46 | |
| 47 | - $connectionManager = ConnectionManager::initialize(function ($connection) { |
|
| 47 | + $connectionManager = ConnectionManager::initialize(function($connection) { |
|
| 48 | 48 | $connection->addConfig('mysql', 'root', '', 'localhost', 'local_controlook', 'local', 3306); |
| 49 | 49 | $connection->addConfig('pgsql', 'postgres', '123456', 'localhost', 'local_controlook', 'postgres_local', 5432); |
| 50 | 50 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | /** |
| 62 | 62 | * 4. Instantiate the model |
| 63 | 63 | */ |
| 64 | - $connectionManager = ConnectionManager::initialize(function ($connection) { |
|
| 64 | + $connectionManager = ConnectionManager::initialize(function($connection) { |
|
| 65 | 65 | $connection->addConfig('mysql', 'root', '', 'localhost', 'local_controlook', 'local', 3306); |
| 66 | 66 | $connection->addConfig('pgsql', 'postgres', '123456', 'localhost', 'local_controlook', 'postgres_local', 5432); |
| 67 | 67 | |