Repository URL to install this package:
|
Version:
1.0.0 ▾
|
<?php
/**
* Created by PhpStorm.
* User: danilo
* Date: 18/12/15
* Time: 10:55
*/
namespace Modules\Core\Commands;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
class IdeHelperCommand extends Command
{
protected $name = 'webbing:ide-helper';
protected $description = 'Execute IDE Helper Commands (generate,models,meta';
/**
* @param Command $command
* @throws \Exception
*/
public function fire()
{
if (!class_exists('Barryvdh\Debugbar\ServiceProvider')) {
throw new \Exception('ide-helper not installed, please execute "composer require barryvdh/laravel-ide-helper" to install');
}
/**
* @var \Pingpong\Modules\Module $module
*/
$modules = [];
foreach ($this->option('modules') as $module) {
$module = $this->laravel['modules']->findOrFail($module);
$modelDir = 'Modules/' . $module->getStudlyName() . '/Entities';
if (is_dir($modelDir) && count(glob($modelDir, GLOB_NOSORT)) !== 0) {
$modules[] = $modelDir;
}
}
$this->info('Clearing compiled files', 'comment');
$this->call('clear-compiled');
$this->info('Generating phpDocs', 'comment');
$this->call('ide-helper:generate');
$this->info('Generating models phpdoc', 'comment');
$this->call('ide-helper:models', ['--dir' => $modules]);
$this->info('Generating phpstorm meta', 'comment');
$this->call('ide-helper:meta');
$this->info('Optimizing classes', 'comment');
$this->call('optimize');
}
/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return array(
array('modules', 'M', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'The modules to generate entities docs', array()),
);
}
}