Code Duplication    Length = 20-20 lines in 2 locations

src/Databases/PostgreSql.php 1 location

@@ 37-56 (lines=20) @@
34
     * @throws \Spatie\DbDumper\Exceptions\CannotStartDump
35
     * @throws \Spatie\DbDumper\Exceptions\DumpFailed
36
     */
37
    public function dumpToFile(string $dumpFile)
38
    {
39
        $this->guardAgainstIncompleteCredentials();
40
41
        $command = $this->getDumpCommand($dumpFile);
42
43
        $tempFileHandle = tmpfile();
44
        fwrite($tempFileHandle, $this->getContentsOfCredentialsFile());
45
        $temporaryCredentialsFile = stream_get_meta_data($tempFileHandle)['uri'];
46
47
        $process = new Process($command, null, $this->getEnvironmentVariablesForDumpCommand($temporaryCredentialsFile));
48
49
        if (! is_null($this->timeout)) {
50
            $process->setTimeout($this->timeout);
51
        }
52
53
        $process->run();
54
55
        $this->checkIfDumpWasSuccessFul($process, $dumpFile);
56
    }
57
58
    /**
59
     * Get the command that should be performed to dump the database.

src/Databases/MySql.php 1 location

@@ 137-156 (lines=20) @@
134
     * @throws \Spatie\DbDumper\Exceptions\CannotStartDump
135
     * @throws \Spatie\DbDumper\Exceptions\DumpFailed
136
     */
137
    public function dumpToFile(string $dumpFile)
138
    {
139
        $this->guardAgainstIncompleteCredentials();
140
141
        $tempFileHandle = tmpfile();
142
        fwrite($tempFileHandle, $this->getContentsOfCredentialsFile());
143
        $temporaryCredentialsFile = stream_get_meta_data($tempFileHandle)['uri'];
144
145
        $command = $this->getDumpCommand($dumpFile, $temporaryCredentialsFile);
146
147
        $process = new Process($command);
148
149
        if (! is_null($this->timeout)) {
150
            $process->setTimeout($this->timeout);
151
        }
152
153
        $process->run();
154
155
        $this->checkIfDumpWasSuccessFul($process, $dumpFile);
156
    }
157
158
    public function addExtraOption(string $extraOption)
159
    {