Do some code quality check and fix #126

This commit is contained in:
crazywhalecc
2023-08-20 19:51:45 +08:00
committed by Jerry Ma
parent 9c57ed6439
commit c8fa767576
104 changed files with 1040 additions and 785 deletions

View File

@@ -6,6 +6,7 @@ namespace SPC\store\source;
use JetBrains\PhpStorm\ArrayShape;
use SPC\exception\DownloaderException;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\Downloader;
@@ -16,8 +17,9 @@ class PhpSource extends CustomSourceBase
/**
* @throws DownloaderException
* @throws RuntimeException
* @throws FileSystemException
*/
public function fetch()
public function fetch(): void
{
$major = defined('SPC_BUILD_PHP_VERSION') ? SPC_BUILD_PHP_VERSION : '8.1';
Downloader::downloadSource('php-src', self::getLatestPHPInfo($major));

View File

@@ -4,20 +4,31 @@ declare(strict_types=1);
namespace SPC\store\source;
use SPC\exception\DownloaderException;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\Downloader;
class PostgreSQLSource extends CustomSourceBase
{
public const NAME = 'postgresql';
public function fetch()
/**
* @throws DownloaderException
* @throws RuntimeException
* @throws FileSystemException
*/
public function fetch(): void
{
Downloader::downloadSource('postgresql', self::getLatestInfo());
}
/**
* @throws DownloaderException
*/
public function getLatestInfo(): array
{
[$url, $filename, $version] = Downloader::getFromFileList('postgresql', [
[, $filename, $version] = Downloader::getFromFileList('postgresql', [
'url' => 'https://www.postgresql.org/ftp/source/',
'regex' => '/href="(?<file>v(?<version>[^"]+)\/)"/',
]);