@@ -42,7 +42,7 @@ |
||
| 42 | 42 | |
| 43 | 43 | return $conn->exec($sql); |
| 44 | 44 | |
| 45 | - throw TableNotCreatedException::tableNotCreatedException("Check your database connection"); |
|
| 45 | + throw TableNotCreatedException::tableNotCreatedException("Check your database connection"); |
|
| 46 | 46 | |
| 47 | 47 | } |
| 48 | 48 | |
@@ -42,11 +42,11 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function create($associative1DArray, $tableName, $dbConn = Null) |
| 44 | 44 | { |
| 45 | - $unexpectedFields = self::checkIfMagicSetterContainsIsSameAsClassModel($this->tableFields,$associative1DArray); |
|
| 45 | + $unexpectedFields = self::checkIfMagicSetterContainsIsSameAsClassModel($this->tableFields, $associative1DArray); |
|
| 46 | 46 | |
| 47 | 47 | if (count($unexpectedFields) > 0) |
| 48 | 48 | { |
| 49 | - throw TableFieldUndefinedException::fieldsNotDefinedException($unexpectedFields,"needs to be created as table field"); |
|
| 49 | + throw TableFieldUndefinedException::fieldsNotDefinedException($unexpectedFields, "needs to be created as table field"); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | unset($this->tableFields[0]); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | $insertQuery = 'INSERT INTO '.$tableName; |
| 59 | 59 | |
| 60 | - $TableValues = implode(',',array_keys($associative1DArray)); |
|
| 60 | + $TableValues = implode(',', array_keys($associative1DArray)); |
|
| 61 | 61 | |
| 62 | 62 | foreach ($associative1DArray as $field => $value) { |
| 63 | 63 | |
@@ -65,13 +65,13 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | $splittedTableValues = implode(',', $FormValues); |
| 67 | 67 | |
| 68 | - $insertQuery.= ' ('.$TableValues.')'; |
|
| 68 | + $insertQuery .= ' ('.$TableValues.')'; |
|
| 69 | 69 | |
| 70 | - $insertQuery.= ' VALUES ('.$splittedTableValues.')'; |
|
| 70 | + $insertQuery .= ' VALUES ('.$splittedTableValues.')'; |
|
| 71 | 71 | |
| 72 | 72 | $executeQuery = $dbConn->exec($insertQuery); |
| 73 | 73 | |
| 74 | - return $executeQuery ? : false; |
|
| 74 | + return $executeQuery ?: false; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /* |
@@ -92,15 +92,15 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | unset($associative1DArray['id']); |
| 94 | 94 | |
| 95 | - $unexpectedFields = self::checkIfMagicSetterContainsIsSameAsClassModel($this->tableFields,$associative1DArray); |
|
| 95 | + $unexpectedFields = self::checkIfMagicSetterContainsIsSameAsClassModel($this->tableFields, $associative1DArray); |
|
| 96 | 96 | |
| 97 | 97 | if (count($unexpectedFields) > 0) { |
| 98 | 98 | |
| 99 | - throw TableFieldUndefinedException::fieldsNotDefinedException($unexpectedFields,"needs to be created as table field"); |
|
| 99 | + throw TableFieldUndefinedException::fieldsNotDefinedException($unexpectedFields, "needs to be created as table field"); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | |
| 103 | - foreach($associative1DArray as $field => $value) |
|
| 103 | + foreach ($associative1DArray as $field => $value) |
|
| 104 | 104 | { |
| 105 | 105 | $sql .= "`$field` = '$value'".","; |
| 106 | 106 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | $boolResponse = $stmt->execute(); |
| 118 | 118 | |
| 119 | - return $boolResponse ? : false; |
|
| 119 | + return $boolResponse ?: false; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - $sql = $id ? 'SELECT * FROM '.$tableName.' WHERE id = '.$id : 'SELECT * FROM '.$tableName; |
|
| 137 | + $sql = $id ? 'SELECT * FROM '.$tableName.' WHERE id = '.$id : 'SELECT * FROM '.$tableName; |
|
| 138 | 138 | |
| 139 | 139 | try { |
| 140 | 140 | $stmt = $dbConn->prepare($sql); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | $results = $stmt->fetchAll(PDO::FETCH_ASSOC); |
| 150 | 150 | |
| 151 | - foreach($results as $result) { |
|
| 151 | + foreach ($results as $result) { |
|
| 152 | 152 | |
| 153 | 153 | array_push($tableData, $result); |
| 154 | 154 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | $boolResponse = $dbConn->exec($sql); |
| 175 | 175 | |
| 176 | - return $boolResponse ? : false; |
|
| 176 | + return $boolResponse ?: false; |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | foreach ($userSetterArray as $key => $val) |
| 190 | 190 | { |
| 191 | - if (!in_array($key,$tableColumn)) { |
|
| 191 | + if (!in_array($key, $tableColumn)) { |
|
| 192 | 192 | |
| 193 | 193 | $unexpectedFields[] = $key; |
| 194 | 194 | } |
@@ -204,11 +204,11 @@ discard block |
||
| 204 | 204 | */ |
| 205 | 205 | private function prepareUpdateQuery($sql) |
| 206 | 206 | { |
| 207 | - $splittedQuery = explode(",",$sql); |
|
| 207 | + $splittedQuery = explode(",", $sql); |
|
| 208 | 208 | |
| 209 | 209 | array_pop($splittedQuery); |
| 210 | 210 | |
| 211 | - $mergeData = implode(",",$splittedQuery); |
|
| 211 | + $mergeData = implode(",", $splittedQuery); |
|
| 212 | 212 | |
| 213 | 213 | return $mergeData; |
| 214 | 214 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | $returnedRowNumbers = $statement->rowCount(); |
| 246 | 246 | |
| 247 | - return $returnedRowNumbers ? true : false; |
|
| 247 | + return $returnedRowNumbers ? true : false; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | throw EmptyArrayException::checkEmptyArrayException("Array Expected: parameter passed to this function is not an array"); |