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

@@ 124-143 (lines=20) @@
121
     * @throws \Spatie\DbDumper\Exceptions\CannotStartDump
122
     * @throws \Spatie\DbDumper\Exceptions\DumpFailed
123
     */
124
    public function dumpToFile(string $dumpFile)
125
    {
126
        $this->guardAgainstIncompleteCredentials();
127
128
        $tempFileHandle = tmpfile();
129
        fwrite($tempFileHandle, $this->getContentsOfCredentialsFile());
130
        $temporaryCredentialsFile = stream_get_meta_data($tempFileHandle)['uri'];
131
132
        $command = $this->getDumpCommand($dumpFile, $temporaryCredentialsFile);
133
134
        $process = new Process($command);
135
136
        if (! is_null($this->timeout)) {
137
            $process->setTimeout($this->timeout);
138
        }
139
140
        $process->run();
141
142
        $this->checkIfDumpWasSuccessFul($process, $dumpFile);
143
    }
144
145
    public function addExtraOption(string $extraOption)
146
    {