1 | <?php |
||
11 | class File |
||
12 | { |
||
13 | /** |
||
14 | * @var ClientInterface |
||
15 | */ |
||
16 | private $guzzleClient; |
||
17 | |||
18 | /** |
||
19 | * @var Filesystem |
||
20 | */ |
||
21 | private $filesystem; |
||
22 | |||
23 | 27 | /** |
|
24 | * @var ZipArchive |
||
25 | 27 | */ |
|
26 | 27 | private $zipArchive; |
|
27 | 27 | ||
28 | public function __construct(ClientInterface $guzzleClient = null) |
||
34 | |||
35 | /** |
||
36 | * @param $source |
||
37 | 2 | * @param null|string $destination |
|
38 | * |
||
39 | 2 | * @throws Exception |
|
40 | 2 | * |
|
41 | 1 | * @return bool|string |
|
42 | */ |
||
43 | 1 | public function copyFile($source, $destination = null) |
|
64 | |||
65 | public function isHealthyZipFile($file) |
||
77 | |||
78 | /** |
||
79 | * @param string $url |
||
80 | * @param string $destination |
||
81 | * |
||
82 | * @throws CurlException |
||
83 | * @throws HttpStatusCodeException |
||
84 | * @throws \Exception |
||
85 | 2 | * |
|
86 | * @return string |
||
87 | 2 | */ |
|
88 | 2 | public function download($url, $destination) |
|
94 | 1 | ||
95 | 1 | /** |
|
96 | 1 | * @param string $file zipFile we want to open |
|
97 | 1 | * @param null|string $extractTo |
|
98 | 1 | * @param true|bool $delete |
|
99 | 1 | * |
|
100 | 1 | * @throws Exception |
|
101 | 1 | * |
|
102 | * @return array |
||
103 | 1 | */ |
|
104 | public function unZip($file, $extractTo = null, $delete = true) |
||
124 | |||
125 | /** |
||
126 | * @param string $file |
||
127 | * @return string[] |
||
128 | */ |
||
129 | public function readFileLinesIntoArray($file) |
||
133 | |||
134 | /** |
||
135 | * @param string[] $lines |
||
136 | * @param string $file |
||
137 | */ |
||
138 | public function writeLinesToFile($lines, $file) |
||
144 | } |
||
145 |
It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.