1 | <?php |
||
22 | class Tar extends SimulatorExecutable implements Simulator |
||
23 | { |
||
24 | /** |
||
25 | * Tar Executable |
||
26 | * |
||
27 | * @var \phpbu\App\Cli\Executable\Tar |
||
28 | */ |
||
29 | protected $executable; |
||
30 | |||
31 | /** |
||
32 | * Path to executable. |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | private $pathToTar; |
||
37 | |||
38 | /** |
||
39 | * Path to backup |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | private $path; |
||
44 | |||
45 | /** |
||
46 | * Remove the packed data |
||
47 | * |
||
48 | * @var boolean |
||
49 | */ |
||
50 | private $removeDir; |
||
51 | |||
52 | /** |
||
53 | * Compression to use. |
||
54 | * |
||
55 | * @var string |
||
56 | */ |
||
57 | private $compression; |
||
58 | |||
59 | /** |
||
60 | * Path where to store the archive. |
||
61 | * |
||
62 | * @var string |
||
63 | */ |
||
64 | private $pathToArchive; |
||
65 | |||
66 | /** |
||
67 | * Setup. |
||
68 | * |
||
69 | * @see \phpbu\App\Backup\Source |
||
70 | * @param array $conf |
||
71 | * @throws \phpbu\App\Exception |
||
72 | */ |
||
73 | public function setup(array $conf = []) |
||
83 | 7 | ||
84 | 7 | /** |
|
85 | 7 | * (non-PHPDoc) |
|
86 | 7 | * |
|
87 | * @see \phpbu\App\Backup\Source |
||
88 | 7 | * @param \phpbu\App\Backup\Target $target |
|
89 | 1 | * @param \phpbu\App\Result $result |
|
90 | * @return \phpbu\App\Backup\Source\Status |
||
91 | 6 | * @throws \phpbu\App\Exception |
|
92 | */ |
||
93 | public function backup(Target $target, Result $result) |
||
109 | |||
110 | 3 | /** |
|
111 | 1 | * Setup the Executable to run the 'tar' command. |
|
112 | 1 | * |
|
113 | * @param \phpbu\App\Backup\Target |
||
114 | 3 | * @return \phpbu\App\Cli\Executable |
|
115 | */ |
||
116 | 3 | public function getExecutable(Target $target) |
|
139 | 1 | ||
140 | /** |
||
141 | 2 | * Check the source to compress. |
|
142 | * |
||
143 | 1 | * @throws \phpbu\App\Exception |
|
144 | */ |
||
145 | 3 | private function validatePath() |
|
151 | 6 | ||
152 | /** |
||
153 | * Create backup status. |
||
154 | * |
||
155 | * @param \phpbu\App\Backup\Target |
||
156 | * @return \phpbu\App\Backup\Source\Status |
||
157 | */ |
||
158 | protected function createStatus(Target $target) |
||
167 | } |
||
168 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.