@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function create($associative1DArray, $tableName, $dbConn = Null) |
| 42 | 42 | { |
| 43 | - $unexpectedFields = self::checkIfMagicSetterContainsIsSameAsClassModel($this->tableFields,$associative1DArray); |
|
| 43 | + $unexpectedFields = self::checkIfMagicSetterContainsIsSameAsClassModel($this->tableFields, $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->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 | /* |
@@ -90,19 +90,19 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | unset($associative1DArray['id']); |
| 92 | 92 | |
| 93 | - $unexpectedFields = self::checkIfMagicSetterContainsIsSameAsClassModel($this->tableFields,$associative1DArray); |
|
| 93 | + $unexpectedFields = self::checkIfMagicSetterContainsIsSameAsClassModel($this->tableFields, $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 | - foreach($associative1DArray as $field => $value) |
|
| 100 | + foreach ($associative1DArray as $field => $value) |
|
| 101 | 101 | { |
| 102 | 102 | $sql = "`$field` = '$value'".","; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - $updateSql.= $this->prepareUpdateQuery($sql); |
|
| 105 | + $updateSql .= $this->prepareUpdateQuery($sql); |
|
| 106 | 106 | |
| 107 | 107 | foreach ($updateParams as $key => $val) { |
| 108 | 108 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $boolResponse = $stmt->execute(); |
| 115 | 115 | |
| 116 | - return $boolResponse ? : false; |
|
| 116 | + return $boolResponse ?: false; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $dbConn = $dhl->connect(); |
| 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 | } |
@@ -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,16 +204,16 @@ 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 | } |
| 215 | 215 | |
| 216 | - public function findAndWhere(array $params,$tableName) |
|
| 216 | + public function findAndWhere(array $params, $tableName) |
|
| 217 | 217 | { |
| 218 | 218 | if (is_array($params) && !empty($params)) { |
| 219 | 219 | |