Aggiornato Composer
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2022 Justin Hileman
|
||||
* (c) 2012-2023 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -19,13 +19,7 @@ interface Checker
|
||||
const MONTHLY = 'monthly';
|
||||
const NEVER = 'never';
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isLatest(): bool;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLatest(): string;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2022 Justin Hileman
|
||||
* (c) 2012-2023 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -19,9 +19,6 @@ class GitHubChecker implements Checker
|
||||
|
||||
private $latest;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isLatest(): bool
|
||||
{
|
||||
// version_compare doesn't handle semver completely;
|
||||
@@ -31,9 +28,6 @@ class GitHubChecker implements Checker
|
||||
return \version_compare($version, $this->getLatest(), '>=');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLatest(): string
|
||||
{
|
||||
if (!isset($this->latest)) {
|
||||
@@ -75,7 +69,7 @@ class GitHubChecker implements Checker
|
||||
$context = \stream_context_create([
|
||||
'http' => [
|
||||
'user_agent' => 'PsySH/'.Shell::VERSION,
|
||||
'timeout' => 3,
|
||||
'timeout' => 1.0,
|
||||
],
|
||||
]);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2022 Justin Hileman
|
||||
* (c) 2012-2023 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -43,6 +43,9 @@ class IntervalChecker extends GitHubChecker
|
||||
return $release;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \RuntimeException if interval passed to constructor is not supported
|
||||
*/
|
||||
private function getDateInterval(): \DateInterval
|
||||
{
|
||||
switch ($this->interval) {
|
||||
@@ -53,6 +56,8 @@ class IntervalChecker extends GitHubChecker
|
||||
case Checker::MONTHLY:
|
||||
return new \DateInterval('P1M');
|
||||
}
|
||||
|
||||
throw new \RuntimeException('Invalid interval configured');
|
||||
}
|
||||
|
||||
private function updateCache($release)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2022 Justin Hileman
|
||||
* (c) 2012-2023 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -14,21 +14,15 @@ namespace Psy\VersionUpdater;
|
||||
use Psy\Shell;
|
||||
|
||||
/**
|
||||
* A version checker stub which always thinks the current verion is up to date.
|
||||
* A version checker stub which always thinks the current version is up to date.
|
||||
*/
|
||||
class NoopChecker implements Checker
|
||||
{
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isLatest(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLatest(): string
|
||||
{
|
||||
return Shell::VERSION;
|
||||
|
||||
Reference in New Issue
Block a user