@@ -43,8 +43,9 @@ discard block |
||
| 43 | 43 | $this->statement = $statement; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if ($this->statement instanceof \PDOStatement) |
|
| 47 | - $this->prepared = $this->statement; |
|
| 46 | + if ($this->statement instanceof \PDOStatement) { |
|
| 47 | + $this->prepared = $this->statement; |
|
| 48 | + } |
|
| 48 | 49 | |
| 49 | 50 | $this->run($bindings); |
| 50 | 51 | } |
@@ -60,11 +61,13 @@ discard block |
||
| 60 | 61 | // make senses for chronology and error handling |
| 61 | 62 | $pdo_statement = $this->executed ?? $this->prepared; |
| 62 | 63 | |
| 63 | - if ($pdo_statement === null) |
|
| 64 | - throw new CruditesException('both executed and prepared instances are null, cannot call PDOStatement method ' . $method); |
|
| 64 | + if ($pdo_statement === null) { |
|
| 65 | + throw new CruditesException('both executed and prepared instances are null, cannot call PDOStatement method ' . $method); |
|
| 66 | + } |
|
| 65 | 67 | |
| 66 | - if (!method_exists($pdo_statement, $method)) |
|
| 67 | - throw new \BadMethodCallException("method $method not found in PDOStatement instance"); |
|
| 68 | + if (!method_exists($pdo_statement, $method)) { |
|
| 69 | + throw new \BadMethodCallException("method $method not found in PDOStatement instance"); |
|
| 70 | + } |
|
| 68 | 71 | |
| 69 | 72 | return call_user_func_array([$pdo_statement, $method], $args); |
| 70 | 73 | } |
@@ -137,8 +140,9 @@ discard block |
||
| 137 | 140 | */ |
| 138 | 141 | public function ret($mode = \PDO::FETCH_ASSOC, $fetch_argument = null, $ctor_args = null) |
| 139 | 142 | { |
| 140 | - if($mode === \PDO::FETCH_CLASS) |
|
| 141 | - return $this->executed->fetchAll($mode, $fetch_argument, $ctor_args); |
|
| 143 | + if($mode === \PDO::FETCH_CLASS) { |
|
| 144 | + return $this->executed->fetchAll($mode, $fetch_argument, $ctor_args); |
|
| 145 | + } |
|
| 142 | 146 | |
| 143 | 147 | return $this->executed->fetchAll($mode); |
| 144 | 148 | } |
@@ -189,11 +193,13 @@ discard block |
||
| 189 | 193 | */ |
| 190 | 194 | public function errorInfo(): array |
| 191 | 195 | { |
| 192 | - if ($this->executed !== null) |
|
| 193 | - return $this->executed->errorInfo(); |
|
| 196 | + if ($this->executed !== null) { |
|
| 197 | + return $this->executed->errorInfo(); |
|
| 198 | + } |
|
| 194 | 199 | |
| 195 | - if ($this->prepared !== null) |
|
| 196 | - return $this->prepared->errorInfo(); |
|
| 200 | + if ($this->prepared !== null) { |
|
| 201 | + return $this->prepared->errorInfo(); |
|
| 202 | + } |
|
| 197 | 203 | |
| 198 | 204 | return $this->pdo->errorInfo(); |
| 199 | 205 | } |