Completed
Pull Request — master (#81)
by
unknown
01:35
created

Compressor   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 27
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
getCompressorCommand() 0 1 ?
A getExtension() 0 4 1
A setLevel() 0 4 1
1
<?php
2
3
namespace Spatie\DbDumper\Compressors;
4
5
abstract class Compressor
6
{
7
    /* @string compression level*/
8
    protected $level = null;
9
10
    abstract function getCompressorCommand();
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
11
12
    /**
13
     * get the extension of the compressed file
14
     *
15
     * @returns string
16
     */
17
    public function getExtension()
18
    {
19
        return $this->extension;
0 ignored issues
show
Bug introduced by
The property extension does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
20
    }
21
22
    /**
23
     * Set compression level
24
     *
25
     * @param string $level
26
     */
27
    public function setLevel(string $level)
28
    {
29
        $this->level = $level;
30
    }
31
}
32