Convert ComponentDecodeOptions constants to enum cases

This commit is contained in:
netkas 2024-09-14 08:44:06 -04:00
parent 2bd2d757fd
commit d379956437
4 changed files with 6 additions and 6 deletions

View file

@ -481,7 +481,7 @@
return match (Resolver::componentType($acquired_file))
{
PackageDirectory::RESOURCES->value => self::$imported_packages[$package]->getResource(Resolver::componentName($acquired_file))->getData(),
PackageDirectory::COMPONENTS->value => self::$imported_packages[$package]->getComponent(Resolver::componentName($acquired_file))->getData([ComponentDecodeOptions::AS_FILE]),
PackageDirectory::COMPONENTS->value => self::$imported_packages[$package]->getComponent(Resolver::componentName($acquired_file))->getData([ComponentDecodeOptions::AS_FILE->value]),
default => throw new IOException(sprintf('Unable to acquire file "%s" from package "%s" because it is not a resource or component', $path, $package)),
};
}

View file

@ -22,7 +22,7 @@
namespace ncc\Enums\Options;
final class ComponentDecodeOptions
enum ComponentDecodeOptions : string
{
public const AS_FILE = 'as_file';
case AS_FILE = 'as_file';
}

View file

@ -672,7 +672,7 @@
IO::fwrite(
$bin_path . DIRECTORY_SEPARATOR . $component_name,
$package_reader->getComponent($component_name)->getData([ComponentDecodeOptions::AS_FILE]), 0755
$package_reader->getComponent($component_name)->getData([ComponentDecodeOptions::AS_FILE->value]), 0755
);
//Console::inlineProgressBar(++$current_step, $total_steps);

View file

@ -177,7 +177,7 @@
{
try
{
if(in_array(ComponentDecodeOptions::AS_FILE, $options, true))
if(in_array(ComponentDecodeOptions::AS_FILE->value, $options, true))
{
return (new Standard())->prettyPrintFile(AstWalker::decodeRecursive(base64_decode($this->data)));
}
@ -197,7 +197,7 @@
{
try
{
if(in_array(ComponentDecodeOptions::AS_FILE, $options, true))
if(in_array(ComponentDecodeOptions::AS_FILE->value, $options, true))
{
return (new Standard())->prettyPrintFile(AstWalker::decodeRecursive(ZiProto::decode($this->data)));
}