Convert ComponentDecodeOptions constants to enum cases
This commit is contained in:
parent
2bd2d757fd
commit
d379956437
4 changed files with 6 additions and 6 deletions
|
@ -481,7 +481,7 @@
|
||||||
return match (Resolver::componentType($acquired_file))
|
return match (Resolver::componentType($acquired_file))
|
||||||
{
|
{
|
||||||
PackageDirectory::RESOURCES->value => self::$imported_packages[$package]->getResource(Resolver::componentName($acquired_file))->getData(),
|
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)),
|
default => throw new IOException(sprintf('Unable to acquire file "%s" from package "%s" because it is not a resource or component', $path, $package)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
namespace ncc\Enums\Options;
|
namespace ncc\Enums\Options;
|
||||||
|
|
||||||
final class ComponentDecodeOptions
|
enum ComponentDecodeOptions : string
|
||||||
{
|
{
|
||||||
public const AS_FILE = 'as_file';
|
case AS_FILE = 'as_file';
|
||||||
}
|
}
|
|
@ -672,7 +672,7 @@
|
||||||
|
|
||||||
IO::fwrite(
|
IO::fwrite(
|
||||||
$bin_path . DIRECTORY_SEPARATOR . $component_name,
|
$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);
|
//Console::inlineProgressBar(++$current_step, $total_steps);
|
||||||
|
|
|
@ -177,7 +177,7 @@
|
||||||
{
|
{
|
||||||
try
|
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)));
|
return (new Standard())->prettyPrintFile(AstWalker::decodeRecursive(base64_decode($this->data)));
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@
|
||||||
{
|
{
|
||||||
try
|
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)));
|
return (new Standard())->prettyPrintFile(AstWalker::decodeRecursive(ZiProto::decode($this->data)));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue