Convert InstallPackageOptions constants to enum cases

This commit is contained in:
netkas 2024-09-14 08:41:25 -04:00
parent ec6b368a82
commit 87844ab00a
5 changed files with 10 additions and 10 deletions

View file

@ -155,17 +155,17 @@
if(isset($args['reinstall']))
{
$options[InstallPackageOptions::REINSTALL] = true;
$options[InstallPackageOptions::REINSTALL->value] = true;
}
if(isset($args['prefer-static']) || isset($args['static']))
{
$options[InstallPackageOptions::PREFER_STATIC] = true;
$options[InstallPackageOptions::PREFER_STATIC->value] = true;
}
if(isset($args['skip-dependencies']))
{
$options[InstallPackageOptions::SKIP_DEPENDENCIES] = true;
$options[InstallPackageOptions::SKIP_DEPENDENCIES->value] = true;
}
if($authentication !== null)

View file

@ -355,7 +355,7 @@
$release, $group, $project));
}
$static_preferred = isset($options[InstallPackageOptions::PREFER_STATIC]);
$static_preferred = isset($options[InstallPackageOptions::PREFER_STATIC->value]);
$preferred_asset = null;
$fallback_asset = null;

View file

@ -341,7 +341,7 @@
throw new NetworkException(sprintf('Failed to get release package for %s/%s/%s: No assets found', $group, $project, $release));
}
$static_preferred = isset($options[InstallPackageOptions::PREFER_STATIC]);
$static_preferred = isset($options[InstallPackageOptions::PREFER_STATIC->value]);
$preferred_asset = null;
$fallback_asset = null;

View file

@ -340,7 +340,7 @@
]);
$response = self::processHttpResponse($curl, $group, $project);
$static_preferred = isset($options[InstallPackageOptions::PREFER_STATIC]);
$static_preferred = isset($options[InstallPackageOptions::PREFER_STATIC->value]);
$preferred_asset = null;
$fallback_asset = null;

View file

@ -22,7 +22,7 @@
namespace ncc\Enums\Options;
final class InstallPackageOptions
enum InstallPackageOptions : string
{
/**
* Skips the installation of dependencies of the package
@ -30,17 +30,17 @@
* @warning This will cause the package to fail to import of
* the dependencies are not met
*/
public const SKIP_DEPENDENCIES = 'skip_dependencies';
case SKIP_DEPENDENCIES = 'skip_dependencies';
/**
* Reinstall all packages if they are already installed,
* Including dependencies if they are being processed.
*/
public const REINSTALL = 'reinstall';
case REINSTALL = 'reinstall';
/**
* Installs a static version of the package if it's available
* otherwise it will install non-static version
*/
public const PREFER_STATIC = 'prefer_static';
case PREFER_STATIC = 'prefer_static';
}