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

@ -1,44 +1,36 @@
<?php <?php
/* /*
* Copyright (c) Nosial 2022-2023, all rights reserved. * Copyright (c) Nosial 2022-2023, all rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction, including without * associated documentation files (the "Software"), to deal in the Software without restriction, including without
* limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the * limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
* Software, and to permit persons to whom the Software is furnished to do so, subject to the following * Software, and to permit persons to whom the Software is furnished to do so, subject to the following
* conditions: * conditions:
* *
* The above copyright notice and this permission notice shall be included in all copies or substantial portions * The above copyright notice and this permission notice shall be included in all copies or substantial portions
* of the Software. * of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
* *
*/ */
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
];
} }