@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @param $tablename |
| 63 | 63 | * @param $con |
| 64 | 64 | * |
| 65 | - * @return bool |
|
| 65 | + * @return boolean|null |
|
| 66 | 66 | */ |
| 67 | 67 | public function checkTableExist($table, $con=NULL) |
| 68 | 68 | { |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | /** |
| 78 | 78 | * checkTableName Return the table name |
| 79 | 79 | * |
| 80 | - * @param $tablename |
|
| 80 | + * @param string|false $tablename |
|
| 81 | 81 | * @param $con |
| 82 | 82 | * |
| 83 | 83 | * @return string |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * checkColumn Check if column exist in table |
| 99 | 99 | * |
| 100 | 100 | * @param $tableName |
| 101 | - * @param $columnName |
|
| 101 | + * @param string $columnName |
|
| 102 | 102 | * @param $con |
| 103 | 103 | * |
| 104 | 104 | * @return string |
@@ -191,6 +191,8 @@ discard block |
||
| 191 | 191 | /** |
| 192 | 192 | * selectAllQuery |
| 193 | 193 | * |
| 194 | + * @param string $tableName |
|
| 195 | + * @param string $field |
|
| 194 | 196 | * @return string |
| 195 | 197 | */ |
| 196 | 198 | public static function selectAllQuery($tableName, $field) |
@@ -226,6 +228,8 @@ discard block |
||
| 226 | 228 | /** |
| 227 | 229 | * selectQuery |
| 228 | 230 | * |
| 231 | + * @param string $tableName |
|
| 232 | + * @param string $connection |
|
| 229 | 233 | * @return string |
| 230 | 234 | */ |
| 231 | 235 | public static function selectQuery($tableName, $data, $condition, $connection) |
@@ -253,6 +257,7 @@ discard block |
||
| 253 | 257 | /** |
| 254 | 258 | * insertQuery |
| 255 | 259 | * |
| 260 | + * @param string $tableName |
|
| 256 | 261 | * @return string |
| 257 | 262 | */ |
| 258 | 263 | public function insertQuery($tableName) |
@@ -270,6 +275,7 @@ discard block |
||
| 270 | 275 | /** |
| 271 | 276 | * updateQuery |
| 272 | 277 | * |
| 278 | + * @param string $tableName |
|
| 273 | 279 | * @return string |
| 274 | 280 | */ |
| 275 | 281 | public function updateQuery($tableName) |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function tableName() |
| 48 | 48 | { |
| 49 | - if(isset($this->table)) { |
|
| 49 | + if (isset($this->table)) { |
|
| 50 | 50 | return $this->table; |
| 51 | 51 | } |
| 52 | 52 | return null; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $sqlQuery = DatabaseQuery::selectAllQuery(self::getTableName($connection), self::fields()); |
| 106 | 106 | $query = $connection->prepare($sqlQuery); |
| 107 | 107 | $query->execute(); |
| 108 | - if ( $query->rowCount() ) |
|
| 108 | + if ($query->rowCount()) |
|
| 109 | 109 | { |
| 110 | 110 | return new GetData($query->fetchAll($connection::FETCH_ASSOC)); |
| 111 | 111 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $sqlQuery = $databaseQuery->selectQuery(self::getTableName($connection), $data, $condition, $connection); |
| 127 | 127 | $query = $connection->prepare($sqlQuery); |
| 128 | 128 | $query->execute(); |
| 129 | - if ( $query->rowCount() ) |
|
| 129 | + if ($query->rowCount()) |
|
| 130 | 130 | { |
| 131 | 131 | return new GetData($query->fetchAll($connection::FETCH_ASSOC)); |
| 132 | 132 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $sqlQuery = DatabaseQuery::selectQuery(self::getTableName($connection), ['id' => $value], NULL, $connection); |
| 147 | 147 | $query = $connection->prepare($sqlQuery); |
| 148 | 148 | $query->execute(); |
| 149 | - if ( $query->rowCount() ) |
|
| 149 | + if ($query->rowCount()) |
|
| 150 | 150 | { |
| 151 | 151 | $found = new static; |
| 152 | 152 | $found->id = $value; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | $query = $this->insertQuery(self::getTableName($connection)); |
| 170 | 170 | $statement = $connection->prepare($query); |
| 171 | - if( $statement->execute() ) |
|
| 171 | + if ($statement->execute()) |
|
| 172 | 172 | { |
| 173 | 173 | return true; |
| 174 | 174 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | $updateQuery = $this->updateQuery(self::getTableName($connection)); |
| 190 | 190 | $statement = $connection->prepare($updateQuery); |
| 191 | - if( $statement->execute() ) |
|
| 191 | + if ($statement->execute()) |
|
| 192 | 192 | { |
| 193 | 193 | return true; |
| 194 | 194 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | { |
| 206 | 206 | $connection = DatabaseQuery::checkConnection($dbConnection); |
| 207 | 207 | |
| 208 | - $query = $connection->prepare('DELETE FROM ' . self::getTableName($connection) . ' WHERE id = '.$value); |
|
| 208 | + $query = $connection->prepare('DELETE FROM '.self::getTableName($connection).' WHERE id = '.$value); |
|
| 209 | 209 | $query->execute(); |
| 210 | 210 | $check = $query->rowCount(); |
| 211 | 211 | if ($check) |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | */ |
| 63 | 63 | public function first() |
| 64 | 64 | { |
| 65 | - return json_decode( $this->toJson() ); |
|
| 65 | + return json_decode($this->toJson()); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |