Skip to content

Commit f41b098

Browse files
committed
split one component & Updtae
1 parent e8539f8 commit f41b098

6 files changed

Lines changed: 49 additions & 22 deletions

File tree

File renamed without changes.

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
"Framework\\Tests\\": "Tests/"
2929
}
3030
},
31+
"scripts": {
32+
"test": "vendor/bin/phpunit"
33+
},
3134
"config":{
3235
"optimize-autoloader":true
3336
},

composer.lock

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Archive/Adapter/Gzip.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,13 @@ public function extract(string $file = '', string $target = '', bool $delete = f
6565
* @param (string) $files The file that you want to compress.
6666
* @param (string) $destination The file destination.
6767
* @param (bool) $overwrite True to delete the file; False to not delete it.
68+
* @param (int) $mode Level of gzip compression.
6869
*
6970
* @since 1.0.0
7071
*
7172
* @return bool True when succeeded; False when failed.
7273
*/
73-
public function compress($files, string $destination = '', bool $overwrite = false): bool
74+
public function compress($files, string $destination = '', bool $overwrite = false, $mode = 9): bool
7475
{
7576
// If the destination already exists and overwrite is false, return false.
7677
if (file_exists($destination) && !$overwrite) {
@@ -82,7 +83,6 @@ public function compress($files, string $destination = '', bool $overwrite = fal
8283
return false;
8384
}
8485

85-
$mode = 'wb'.__config('archive.gzip.level') ?? 9;
8686
$filename = $destination;
8787
if ($outfile = gzopen($filename, $mode)) {
8888
if ($infile = fopen($files, 'rb')) {

src/Archive/Archive.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ class Archive
3434
*/
3535
public function __construct($adapter = null)
3636
{
37-
($adapter !== null) ? $this->setAdapter($adapter) : $this->setAdapter(__config('archive.driver'));
37+
if (\defined('__ZEST__ROOT__')) {
38+
$this->setAdapter(__config('archive.driver'));
39+
}
40+
41+
if (adapter !== null) {
42+
$this->setAdapter($adapter);
43+
}
3844
}
3945

4046
/**

src/Archive/composer.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "zest/archive",
3+
"description": "The Zest Archive component",
4+
"type": "libraray",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "lablnet",
9+
"email": "mumerfarooqlablnet01@gmail.com"
10+
}
11+
],
12+
"require": {},
13+
"autoload": {
14+
"psr-4": {
15+
"Zest\\Archive\\": ""
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)