mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
Use constant back due to config validation problem
This commit is contained in:
parent
94fb7a643e
commit
5298ee4f97
@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use StaticPHP\Artifact\Downloader\Type\BitBucketTag;
|
||||
use StaticPHP\Artifact\Downloader\Type\DownloadTypeInterface;
|
||||
use StaticPHP\Artifact\Downloader\Type\FileList;
|
||||
use StaticPHP\Artifact\Downloader\Type\Git;
|
||||
use StaticPHP\Artifact\Downloader\Type\GitHubRelease;
|
||||
use StaticPHP\Artifact\Downloader\Type\GitHubTarball;
|
||||
use StaticPHP\Artifact\Downloader\Type\HostedPackageBin;
|
||||
use StaticPHP\Artifact\Downloader\Type\LocalDir;
|
||||
use StaticPHP\Artifact\Downloader\Type\PECL;
|
||||
use StaticPHP\Artifact\Downloader\Type\PhpRelease;
|
||||
use StaticPHP\Artifact\Downloader\Type\PIE;
|
||||
use StaticPHP\Artifact\Downloader\Type\Url;
|
||||
|
||||
/* @return array<string, DownloadTypeInterface> */
|
||||
return [
|
||||
'bitbuckettag' => BitBucketTag::class,
|
||||
'filelist' => FileList::class,
|
||||
'git' => Git::class,
|
||||
'ghrel' => GitHubRelease::class,
|
||||
'ghtar' => GitHubTarball::class,
|
||||
'ghtagtar' => GitHubTarball::class,
|
||||
'local' => LocalDir::class,
|
||||
'pie' => PIE::class,
|
||||
'pecl' => PECL::class,
|
||||
'url' => Url::class,
|
||||
'php-release' => PhpRelease::class,
|
||||
'hosted' => HostedPackageBin::class,
|
||||
];
|
||||
@ -6,11 +6,19 @@ namespace StaticPHP\Artifact;
|
||||
|
||||
use Psr\Log\LogLevel;
|
||||
use StaticPHP\Artifact\Downloader\DownloadResult;
|
||||
use StaticPHP\Artifact\Downloader\Type\BitBucketTag;
|
||||
use StaticPHP\Artifact\Downloader\Type\CheckUpdateInterface;
|
||||
use StaticPHP\Artifact\Downloader\Type\CheckUpdateResult;
|
||||
use StaticPHP\Artifact\Downloader\Type\DownloadTypeInterface;
|
||||
use StaticPHP\Artifact\Downloader\Type\FileList;
|
||||
use StaticPHP\Artifact\Downloader\Type\Git;
|
||||
use StaticPHP\Artifact\Downloader\Type\GitHubRelease;
|
||||
use StaticPHP\Artifact\Downloader\Type\GitHubTarball;
|
||||
use StaticPHP\Artifact\Downloader\Type\HostedPackageBin;
|
||||
use StaticPHP\Artifact\Downloader\Type\LocalDir;
|
||||
use StaticPHP\Artifact\Downloader\Type\PECL;
|
||||
use StaticPHP\Artifact\Downloader\Type\PhpRelease;
|
||||
use StaticPHP\Artifact\Downloader\Type\PIE;
|
||||
use StaticPHP\Artifact\Downloader\Type\Url;
|
||||
use StaticPHP\Artifact\Downloader\Type\ValidatorInterface;
|
||||
use StaticPHP\DI\ApplicationContext;
|
||||
@ -31,6 +39,21 @@ use ZM\Logger\ConsoleColor;
|
||||
*/
|
||||
class ArtifactDownloader
|
||||
{
|
||||
public const array DOWNLOADERS = [
|
||||
'bitbuckettag' => BitBucketTag::class,
|
||||
'filelist' => FileList::class,
|
||||
'git' => Git::class,
|
||||
'ghrel' => GitHubRelease::class,
|
||||
'ghtar' => GitHubTarball::class,
|
||||
'ghtagtar' => GitHubTarball::class,
|
||||
'local' => LocalDir::class,
|
||||
'pie' => PIE::class,
|
||||
'pecl' => PECL::class,
|
||||
'url' => Url::class,
|
||||
'php-release' => PhpRelease::class,
|
||||
'hosted' => HostedPackageBin::class,
|
||||
];
|
||||
|
||||
/** @var array<string, class-string<DownloadTypeInterface>> */
|
||||
protected array $downloaders = [];
|
||||
|
||||
@ -198,7 +221,7 @@ class ArtifactDownloader
|
||||
$this->_before_files = FileSystem::scanDirFiles(DOWNLOAD_PATH, false, true, true) ?: [];
|
||||
|
||||
// load downloaders
|
||||
$this->downloaders = require ROOT_DIR . '/config/downloader.php';
|
||||
$this->downloaders = self::DOWNLOADERS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user