Skip to content

Commit

Permalink
chore: refactor tap() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
owenvoke committed Oct 8, 2024
1 parent d9cb08a commit b9ded5f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
14 changes: 8 additions & 6 deletions src/Commands/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,15 @@ private function compile(string $name): BuildCommand
/** @phpstan-ignore-next-line This is an instance of `ConsoleOutputInterface` */
$section = tap($this->originalOutput->section())->write('');

$progressBar = tap(
new ProgressBar(
$this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL ? new NullOutput : $section, 25
)
)->setProgressCharacter("\xF0\x9F\x8D\xBA");
$progressBar = new ProgressBar(
$this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL ? new NullOutput : $section, 25
);

$progressBar->setProgressCharacter("\xF0\x9F\x8D\xBA");

$process->start();

foreach (tap($process)->start() as $type => $data) {
foreach ($process as $type => $data) {
$progressBar->advance();

if ($this->output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) {
Expand Down
9 changes: 5 additions & 4 deletions src/Commands/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace LaravelZero\Framework\Commands;

use LaravelZero\Framework\Components;
use LaravelZero\Framework\Components\AbstractInstaller;
use Symfony\Component\Console\Input\ArrayInput;

final class InstallCommand extends Command
Expand Down Expand Up @@ -46,9 +47,6 @@ final class InstallCommand extends Command
'view' => Components\View\Installer::class,
];

/**
* {@inheritdoc}
*/
public function handle()
{
$title = 'Laravel Zero - Component installer';
Expand All @@ -63,7 +61,10 @@ public function handle()
}

if ($option !== null && ! empty($this->componentInstallers[$option])) {
$command = tap($this->app[$this->componentInstallers[$option]])->setLaravel($this->app);
/** @var AbstractInstaller $command */
$command = $this->app[$this->componentInstallers[$option]];

$command->setLaravel($this->app);

$command->setApplication($this->getApplication());

Expand Down

0 comments on commit b9ded5f

Please sign in to comment.