Convert InstallPackageOptions constants to enum cases
This commit is contained in:
parent
ec6b368a82
commit
87844ab00a
5 changed files with 10 additions and 10 deletions
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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';
|
||||
}
|
Loading…
Add table
Reference in a new issue