for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
/**
* This file is part of Laravel Zero.
*
* (c) Nuno Maduro <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace LaravelZero\Framework\Components\Updater;
use Humbug\SelfUpdate\Updater as PharUpdater;
use Illuminate\Console\OutputStyle;
* @internal
final class Updater
{
* The base updater.
* @var \Humbug\SelfUpdate\Updater
private $updater;
* Updater constructor.
* @param \Humbug\SelfUpdate\Updater $updater
public function __construct(PharUpdater $updater)
$this->updater = $updater;
}
* @param \Illuminate\Console\OutputStyle
* @return void
public function update(OutputStyle $output): void
$result = $this->updater->update();
if ($result) {
$output->success(sprintf('Updated from version %s to %s.', $this->updater->getOldVersion(),
$this->updater->getNewVersion()));
exit(0);
exit
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.
} elseif (! $this->updater->getNewVersion()) {
$output->success('There are no stable versions available.');
} else {
$output->success('You have the latest version installed.');
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.