Code Duplication    Length = 6-7 lines in 2 locations

src/Model.php 2 locations

@@ 171-176 (lines=6) @@
168
    {
169
        $bindNameParameters = [];
170
        $sqlUpdate = 'UPDATE '.$this->getTableName().' SET ';
171
        foreach ($this->properties as $columnName => $columnValue) {
172
            if ($columnName == 'id') {
173
                continue;
174
            }
175
            $bindColumnName = ':'.$columnName;
176
            $sqlUpdate .= "$columnName = $bindColumnName,";
177
            $bindNameParameters[$bindColumnName] = $columnValue;
178
        }
179
        //Remove the last comma in sql command then join it to the other query part.
@@ 199-205 (lines=7) @@
196
        $columnValues = '';
197
        $bindNameParameters = [];
198
        $sqlCreate = 'INSERT'.' INTO '.$this->getTableName().' (';
199
        foreach ($this->properties as $columnName => $columnValue) {
200
            $bindColumnName = ':'.$columnName;
201
            $columnNames .= $columnName.',';
202
            $columnValues .= $bindColumnName.',';
203
            $bindNameParameters[$bindColumnName] = $columnValue;
204
        }
205
        // Remove ending comma and whitespace.
206
        $columnNames = substr($columnNames, 0, -1);
207
        $columnValues = substr($columnValues, 0, -1);
208