39 lines
859 B
PHP
39 lines
859 B
PHP
<?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('Validating <info>%s</info>', $path);
|
|
|
|
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;
|
|
}
|
|
}
|