-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve openspout compat / refactor zip utils / phpstan v2
- Loading branch information
Showing
16 changed files
with
339 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Results for csv | ||
LeKoala\SpreadCompat\Csv\Native : 0.008 | ||
LeKoala\SpreadCompat\Csv\League : 0.0312 | ||
LeKoala\SpreadCompat\Csv\OpenSpout : 0.0979 | ||
LeKoala\SpreadCompat\Csv\PhpSpreadsheet : 1.3744 | ||
|
||
Results for xlsx | ||
LeKoala\SpreadCompat\Xlsx\Native : 0.0617 | ||
LeKoala\SpreadCompat\Xlsx\Simple : 0.1396 | ||
LeKoala\SpreadCompat\Xlsx\OpenSpout : 0.9332 | ||
LeKoala\SpreadCompat\Xlsx\PhpSpreadsheet : 1.4632 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Results for csv | ||
LeKoala\SpreadCompat\Csv\Native : 0.0074 | ||
LeKoala\SpreadCompat\Csv\League : 0.0125 | ||
LeKoala\SpreadCompat\Csv\OpenSpout : 0.0433 | ||
LeKoala\SpreadCompat\Csv\PhpSpreadsheet : 0.7075 | ||
|
||
Results for xlsx | ||
LeKoala\SpreadCompat\Xlsx\Native : 0.0402 | ||
LeKoala\SpreadCompat\Xlsx\Simple : 0.0845 | ||
LeKoala\SpreadCompat\Xlsx\OpenSpout : 0.2622 | ||
LeKoala\SpreadCompat\Xlsx\PhpSpreadsheet : 1.017 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace LeKoala\SpreadCompat\Common; | ||
|
||
use ZipArchive; | ||
|
||
class ZipUtils | ||
{ | ||
public static function zipError(int $code): string | ||
{ | ||
return match ($code) { | ||
ZipArchive::ER_EXISTS => 'File already exists.', | ||
ZipArchive::ER_INCONS => 'Zip archive inconsistent.', | ||
ZipArchive::ER_INVAL => 'Invalid argument.', | ||
ZipArchive::ER_MEMORY => 'Malloc failure.', | ||
ZipArchive::ER_NOENT => 'No such file.', | ||
ZipArchive::ER_NOZIP => 'Not a zip archive.', | ||
ZipArchive::ER_OPEN => 'Can\'t open file.', | ||
ZipArchive::ER_READ => 'Read error.', | ||
ZipArchive::ER_SEEK => 'Seek error.', | ||
default => 'Unknown error code ' . $code . '.', | ||
}; | ||
} | ||
|
||
public static function getData(ZipArchive $zip, string $name): ?string | ||
{ | ||
$idx = $zip->locateName($name); | ||
if ($idx) { | ||
$result = $zip->getFromIndex($idx); | ||
if ($result) { | ||
return $result; | ||
} | ||
} | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.