Code Duplication    Length = 6-7 lines in 2 locations

src/Model.php 2 locations

@@ 157-162 (lines=6) @@
154
    {
155
        $bindNameParameters = [];
156
        $sqlUpdate = 'UPDATE '.$this->getTableName().' SET ';
157
        foreach ($this->properties as $columnName => $columnValue) {
158
            if ($columnName == 'id') {
159
                continue;
160
            }
161
            $bindColumnName = ':'.$columnName;
162
            $sqlUpdate .= "$columnName = $bindColumnName,";
163
            $bindNameParameters[$bindColumnName] = $columnValue;
164
        }
165
        //Remove the last comma in sql command then join it to the other query part.
@@ 185-191 (lines=7) @@
182
        $columnValues = '';
183
        $bindNameParameters = [];
184
        $sqlCreate = 'INSERT'.' INTO '.$this->getTableName().' (';
185
        foreach ($this->properties as $columnName => $columnValue) {
186
            $bindColumnName = ':'.$columnName;
187
            $columnNames .= $columnName.',';
188
            $columnValues .= $bindColumnName.',';
189
            $bindNameParameters[$bindColumnName] = $columnValue;
190
        }
191
        // Remove ending comma and whitespace.
192
        $columnNames = substr($columnNames, 0, -1);
193
        $columnValues = substr($columnValues, 0, -1);
194