mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
@@ -35,10 +35,10 @@ class MetaCommand extends Command {
|
||||
*/
|
||||
protected $description = 'Generate metadata for PhpStorm';
|
||||
|
||||
/** @var \Illuminate\Filesystem\Filesystem */
|
||||
/** @var \Illuminate\Contracts\Filesystem\Filesystem */
|
||||
protected $files;
|
||||
|
||||
/** @var \Illuminate\View\Factory */
|
||||
/** @var \Illuminate\Contracts\View\Factory */
|
||||
protected $view;
|
||||
|
||||
protected $methods = [
|
||||
@@ -52,8 +52,8 @@ class MetaCommand extends Command {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Illuminate\Filesystem\Filesystem $files
|
||||
* @param \Illuminate\View\Factory $view
|
||||
* @param \Illuminate\Contracts\Filesystem\Filesystem $files
|
||||
* @param \Illuminate\Contracts\View\Factory $view
|
||||
*/
|
||||
public function __construct($files, $view) {
|
||||
$this->files = $files;
|
||||
@@ -68,11 +68,8 @@ class MetaCommand extends Command {
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
$filename = $this->option('filename');
|
||||
|
||||
$bindings = array();
|
||||
|
||||
foreach ($this->laravel->getBindings() as $abstract => $options) {
|
||||
foreach ($this->getAbstracts() as $abstract) {
|
||||
try {
|
||||
$concrete = $this->laravel->make($abstract);
|
||||
if (is_object($concrete)) {
|
||||
@@ -88,6 +85,7 @@ class MetaCommand extends Command {
|
||||
'methods' => $this->methods,
|
||||
])->render();
|
||||
|
||||
$filename = $this->option('filename');
|
||||
$written = $this->files->put($filename, $content);
|
||||
|
||||
if ($written !== false) {
|
||||
@@ -97,6 +95,29 @@ class MetaCommand extends Command {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a filtered list of abstracts from the Laravel Application.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getAbstracts()
|
||||
{
|
||||
$abstracts = $this->laravel->getBindings();
|
||||
|
||||
// Remove the S3 cloud driver when not available
|
||||
if (config('filesystems.cloud') === 's3' && !class_exists('League\Flysystem\AwsS3v2\AwsS3Adapter')) {
|
||||
unset($abstracts['filesystem.cloud']);
|
||||
}
|
||||
|
||||
// Remove Redis when not available
|
||||
if (isset($abstracts['redis']) && !class_exists('Predis\Client')) {
|
||||
unset($abstracts['redis']);
|
||||
}
|
||||
|
||||
// Return the abstract names only
|
||||
return array_keys($abstracts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user