Uncompressed   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 47
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getCompressingCommand() 0 4 1
A getDecompressingCommand() 0 8 2
A getFileName() 0 8 2
1
<?php
2
3
namespace N98\Magento\Command\Database\Compressor;
4
5
class Uncompressed extends AbstractCompressor
6
{
7
    /**
8
     * Returns the command line for compressing the dump file.
9
     *
10
     * @param string $command
11
     * @param bool $pipe
12
     * @return string
13
     */
14
    public function getCompressingCommand($command, $pipe = true)
15
    {
16
        return $command;
17
    }
18
19
    /**
20
     * Returns the command line for decompressing the dump file.
21
     *
22
     * @param string $command MySQL client tool connection string
23
     * @param string $fileName Filename (shell argument escaped)
24
     * @param bool $pipe
25
     * @return string
26
     */
27
    public function getDecompressingCommand($command, $fileName, $pipe = true)
28
    {
29
        if ($this->hasPipeViewer()) {
30
            return 'pv ' . $fileName . ' | ' . $command;
31
        }
32
33
        return $command . ' < ' . $fileName;
34
    }
35
36
    /**
37
     * Returns the file name for the compressed dump file.
38
     *
39
     * @param string $fileName
40
     * @param bool $pipe
41
     * @return string
42
     */
43
    public function getFileName($fileName, $pipe = true)
44
    {
45
        if (substr($fileName, -4, 4) !== '.sql') {
46
            $fileName .= '.sql';
47
        }
48
49
        return $fileName;
50
    }
51
}
52