Convert PackageStructureVersions constants to enum cases

This commit is contained in:
netkas 2024-09-14 00:13:43 -04:00
parent 2a16b2de6b
commit c687d0394d
2 changed files with 25 additions and 33 deletions

View file

@ -108,7 +108,7 @@
$this->temp_file = @fopen($this->temporary_path, 'wb'); // Create a temporary data file $this->temp_file = @fopen($this->temporary_path, 'wb'); // Create a temporary data file
$this->package_file = @fopen($file_path, 'wb'); $this->package_file = @fopen($file_path, 'wb');
$this->headers = [ $this->headers = [
PackageStructure::FILE_VERSION => PackageStructureVersions::_2_0, PackageStructure::FILE_VERSION => PackageStructureVersions::_2_0->value,
PackageStructure::FLAGS => [], PackageStructure::FLAGS => [],
PackageStructure::DIRECTORY => [] PackageStructure::DIRECTORY => []
]; ];

View file

@ -22,23 +22,15 @@
namespace ncc\Enums; namespace ncc\Enums;
final class PackageStructureVersions enum PackageStructureVersions : string
{ {
/** /**
* ncc 1.0.0 to 1.0.3 * ncc 1.0.0 to 1.0.3
*/ */
public const _1_0 = '1.0'; case _1_0 = '1.0';
/** /**
* ncc 1.0.4 and above * ncc 1.0.4 and above
*/ */
public const _2_0 = '2.0'; case _2_0 = '2.0';
/**
* All supported versions
*/
public const ALL = [
self::_1_0,
self::_2_0
];
} }