@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function create($associative1DArray, $tableName, $dbConn = Null) |
| 42 | 42 | { |
| 43 | - $unexpectedFields = self::checkIfMagicSetterContainsIsSameAsClassModel($this->getColumnNames($this->model, $this->dbConnection),$associative1DArray); |
|
| 43 | + $unexpectedFields = self::checkIfMagicSetterContainsIsSameAsClassModel($this->getColumnNames($this->model, $this->dbConnection), $associative1DArray); |
|
| 44 | 44 | |
| 45 | 45 | if (count($unexpectedFields) > 0) |
| 46 | 46 | { |
| 47 | - throw TableFieldUndefinedException::fieldsNotDefinedException($unexpectedFields,"needs to be created as table field"); |
|
| 47 | + throw TableFieldUndefinedException::fieldsNotDefinedException($unexpectedFields, "needs to be created as table field"); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | unset($this->getColumnNames($this->model, $this->dbConnection)[0]); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | $insertQuery = 'INSERT INTO '.$tableName; |
| 57 | 57 | |
| 58 | - $TableValues = implode(',',array_keys($associative1DArray)); |
|
| 58 | + $TableValues = implode(',', array_keys($associative1DArray)); |
|
| 59 | 59 | |
| 60 | 60 | foreach ($associative1DArray as $field => $value) { |
| 61 | 61 | |
@@ -63,13 +63,13 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | $splittedTableValues = implode(',', $FormValues); |
| 65 | 65 | |
| 66 | - $insertQuery.= ' ('.$TableValues.')'; |
|
| 66 | + $insertQuery .= ' ('.$TableValues.')'; |
|
| 67 | 67 | |
| 68 | - $insertQuery.= ' VALUES ('.$splittedTableValues.')'; |
|
| 68 | + $insertQuery .= ' VALUES ('.$splittedTableValues.')'; |
|
| 69 | 69 | |
| 70 | 70 | $executeQuery = $dbConn->exec($insertQuery); |
| 71 | 71 | |
| 72 | - return $executeQuery ? : false; |
|
| 72 | + return $executeQuery ?: false; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /* |
@@ -90,15 +90,15 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | unset($associative1DArray['id']); |
| 92 | 92 | |
| 93 | - $unexpectedFields = self::checkIfMagicSetterContainsIsSameAsClassModel($this->getColumnNames($this->model, $this->dbConnection),$associative1DArray); |
|
| 93 | + $unexpectedFields = self::checkIfMagicSetterContainsIsSameAsClassModel($this->getColumnNames($this->model, $this->dbConnection), $associative1DArray); |
|
| 94 | 94 | |
| 95 | 95 | if (count($unexpectedFields) > 0) { |
| 96 | 96 | |
| 97 | - throw TableFieldUndefinedException::fieldsNotDefinedException($unexpectedFields,"needs to be created as table field"); |
|
| 97 | + throw TableFieldUndefinedException::fieldsNotDefinedException($unexpectedFields, "needs to be created as table field"); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | |
| 101 | - foreach($associative1DArray as $field => $value) |
|
| 101 | + foreach ($associative1DArray as $field => $value) |
|
| 102 | 102 | { |
| 103 | 103 | $sql .= "`$field` = '$value'".","; |
| 104 | 104 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | $boolResponse = $stmt->execute(); |
| 116 | 116 | |
| 117 | - return $boolResponse ? : false; |
|
| 117 | + return $boolResponse ?: false; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $sql = $id ? 'SELECT * FROM '.$tableName.' WHERE id = '.$id : 'SELECT * FROM '.$tableName; |
|
| 135 | + $sql = $id ? 'SELECT * FROM '.$tableName.' WHERE id = '.$id : 'SELECT * FROM '.$tableName; |
|
| 136 | 136 | |
| 137 | 137 | try { |
| 138 | 138 | $stmt = $dbConn->prepare($sql); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | $results = $stmt->fetchAll(PDO::FETCH_ASSOC); |
| 148 | 148 | |
| 149 | - foreach($results as $result) { |
|
| 149 | + foreach ($results as $result) { |
|
| 150 | 150 | |
| 151 | 151 | array_push($tableData, $result); |
| 152 | 152 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | $boolResponse = $dbConn->exec($sql); |
| 173 | 173 | |
| 174 | - return $boolResponse ? : false; |
|
| 174 | + return $boolResponse ?: false; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | foreach ($userSetterArray as $key => $val) |
| 188 | 188 | { |
| 189 | - if (!in_array($key,$tableColumn)) { |
|
| 189 | + if (!in_array($key, $tableColumn)) { |
|
| 190 | 190 | |
| 191 | 191 | $unexpectedFields[] = $key; |
| 192 | 192 | } |
@@ -202,11 +202,11 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function prepareUpdateQuery($sql) |
| 204 | 204 | { |
| 205 | - $splittedQuery = explode(",",$sql); |
|
| 205 | + $splittedQuery = explode(",", $sql); |
|
| 206 | 206 | |
| 207 | 207 | array_pop($splittedQuery); |
| 208 | 208 | |
| 209 | - $mergeData = implode(",",$splittedQuery); |
|
| 209 | + $mergeData = implode(",", $splittedQuery); |
|
| 210 | 210 | |
| 211 | 211 | return $mergeData; |
| 212 | 212 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | $returnedRowNumbers = $statement->rowCount(); |
| 242 | 242 | |
| 243 | - return $returnedRowNumbers ? true : false; |
|
| 243 | + return $returnedRowNumbers ? true : false; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | throw EmptyArrayException::checkEmptyArrayException("Array Expected: parameter passed to this function is not an array"); |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | |
| 268 | 268 | $results = $stmt->fetchAll(PDO::FETCH_ASSOC); |
| 269 | 269 | |
| 270 | - foreach($results as $result) { |
|
| 270 | + foreach ($results as $result) { |
|
| 271 | 271 | |
| 272 | 272 | array_push($tableFields, $result['Field']); |
| 273 | 273 | } |