Code Duplication    Length = 6-7 lines in 2 locations

src/Model.php 2 locations

@@ 135-140 (lines=6) @@
132
        $columnValues = "";
133
        $bindNameParameters = [];
134
        $sqlUpdate = "UPDATE " . $this->getTableName() . " SET " ;
135
        foreach ($this->properties as $columnName => $columnValue) {
136
            if($key == 'id') continue;
137
            $bindColumnName = ':' . $columnName;
138
            $sqlUpdate .= "$columnName = $bindColumnName,";
139
            $bindNameParameters[$bindColumnName] = $columnValue;
140
        }
141
        //Remove the last comma in sql command then join it to the other query part.
142
        $sqlUpdate = substr($sqlUpdate, 0, -1)." WHERE id = :id";
143
        $sqlStatement = $this->databaseConnection->prepare($sqlUpdate);
@@ 161-167 (lines=7) @@
158
        $columnValues = "";
159
        $bindNameParameters = [];
160
        $sqlCreate = "INSERT" . " INTO " . $this->getTableName()." (";
161
        foreach ($this->properties as $columnName => $columnValue) {
162
163
            $bindColumnName = ':' . $columnName;
164
            $columnNames .= $columnName.",";
165
            $columnValues .= $bindColumnName.",";
166
            $bindNameParameters[$bindColumnName] = $columnValue;
167
        }
168
        // Remove ending comma and whitespace.
169
        $columnNames = substr($columnNames, 0, -1);
170
        $columnValues = substr($columnValues, 0, -1);