Code Duplication    Length = 18-18 lines in 2 locations

src/Query/Insert.php 1 location

@@ 18-35 (lines=18) @@
15
        'set',
16
    ];
17
18
    public function __construct(Table $table, array $data = [])
19
    {
20
        $this->table = $table;
21
22
        $this->query = $table->getDatabase()
23
            ->insert()
24
            ->into((string) $table);
25
26
        foreach ($data as $fieldName => $value) {
27
            $this->table->{$fieldName}->insert($this->query, $value);
28
        }
29
30
        $eventDispatcher = $table->getEventDispatcher();
31
32
        if ($eventDispatcher) {
33
            $eventDispatcher->dispatch(new CreateInsertQuery($this));
34
        }
35
    }
36
37
    public function run()
38
    {

src/Query/Update.php 1 location

@@ 25-42 (lines=18) @@
22
        'offset',
23
    ];
24
25
    public function __construct(Table $table, array $data = [])
26
    {
27
        $this->table = $table;
28
29
        $this->query = $table->getDatabase()
30
            ->update()
31
            ->table((string) $table);
32
33
        foreach ($data as $fieldName => $value) {
34
            $this->table->{$fieldName}->update($this->query, $value);
35
        }
36
37
        $eventDispatcher = $table->getEventDispatcher();
38
39
        if ($eventDispatcher) {
40
            $eventDispatcher->dispatch(new CreateUpdateQuery($this));
41
        }
42
    }
43
}
44