Code Duplication    Length = 16-16 lines in 2 locations

src/Repositories/BaseRepository.php 2 locations

@@ 123-138 (lines=16) @@
120
     *
121
     * @return int
122
     */
123
    protected function createResource(array $values): int
124
    {
125
        $query = $this->getConnection()->createQueryBuilder();
126
127
        $query->insert($this->getTableNameForWriting());
128
        foreach ($values as $key => $value) {
129
            $query->setValue($key, $this->createTypedParameter($query, $value));
130
        }
131
132
        $numberOfAdded = $query->execute();
133
        assert(is_int($numberOfAdded) === true);
134
135
        $lastInsertId = $this->getConnection()->lastInsertId();
136
137
        return $lastInsertId;
138
    }
139
140
    /**
141
     * @param string|int $identifier
@@ 180-195 (lines=16) @@
177
     *
178
     * @return int
179
     */
180
    protected function updateResource($identifier, array $values): int
181
    {
182
        $query = $this->getConnection()->createQueryBuilder();
183
184
        $query
185
            ->update($this->getTableNameForWriting())
186
            ->where($this->getPrimaryKeyName() . '=' . $this->createTypedParameter($query, $identifier));
187
        foreach ($values as $key => $value) {
188
            $query->set($key, $this->createTypedParameter($query, $value));
189
        }
190
191
        $numberOfUpdated = $query->execute();
192
        assert(is_int($numberOfUpdated) === true);
193
194
        return $numberOfUpdated;
195
    }
196
197
    /**
198
     * @param string|int $identifier