Code Duplication    Length = 14-16 lines in 2 locations

src/Databases/Sqlite.php 1 location

@@ 17-30 (lines=14) @@
14
     *
15
     * @throws \Spatie\DbDumper\Exceptions\DumpFailed
16
     */
17
    public function dumpToFile(string $dumpFile)
18
    {
19
        $command = $this->getDumpCommand($dumpFile);
20
21
        $process = new Process($command);
22
23
        if (! is_null($this->timeout)) {
24
            $process->setTimeout($this->timeout);
25
        }
26
27
        $process->run();
28
29
        $this->checkIfDumpWasSuccessFul($process, $dumpFile);
30
    }
31
32
    /**
33
     * Get the command that should be performed to dump the database.

src/Databases/MongoDb.php 1 location

@@ 27-42 (lines=16) @@
24
     * @throws \Spatie\DbDumper\Exceptions\CannotStartDump
25
     * @throws \Spatie\DbDumper\Exceptions\DumpFailed
26
     */
27
    public function dumpToFile(string $dumpFile)
28
    {
29
        $this->guardAgainstIncompleteCredentials();
30
31
        $command = $this->getDumpCommand($dumpFile);
32
33
        $process = new Process($command);
34
35
        if (! is_null($this->timeout)) {
36
            $process->setTimeout($this->timeout);
37
        }
38
39
        $process->run();
40
41
        $this->checkIfDumpWasSuccessFul($process, $dumpFile);
42
    }
43
44
    /**
45
     * Verifies if the dbname and host options are set.