1
0
cms11/app/Console/Commands/Bundle/Traits/ReadsBundles.php

39 lines
856 B
PHP
Raw Normal View History

2024-05-12 14:47:44 +02:00
<?php
namespace App\Console\Commands\Bundle\Traits;
use App\Classes\Bundle;
trait ReadsBundles
{
protected $bundles;
/**
* Collect a list of bundles to validate
*/
protected function selectBundles(): self
{
$path = $this->argument('path') ?? '/';
$comment = sprintf('Reading <info>%s</info>', $path);
2024-05-12 14:47:44 +02:00
if ($this->option('recursive')) {
$comment .= ' and <info>all sub-bundles</info>';
}
$this->line($comment);
$this->output->write('Collecting bundles... ');
if ($this->option('recursive')) {
$bundles = Bundle::findBundles($this->sourceDisk, $path, true);
} else {
$bundles = [new Bundle($path, $this->sourceDisk)];
}
$this->bundles = $bundles;
$this->info('OK');
return $this;
}
}