Tweak helper behavior

Helper file not included by default, but can be enabled with the config
file. Default value can be overridden with the --helpers (-H) of
--nohelpers (-N) options.
This commit is contained in:
Barry vd. Heuvel
2013-03-11 21:46:27 +01:00
parent 7c8514ac51
commit 9ca2450d10
3 changed files with 25 additions and 663 deletions
@@ -31,7 +31,13 @@ class GeneratorCommand extends Command {
$filename = $this->argument('filename');
$aliases = \Config::get('laravel-ide-helper::aliases');
$helpers = \Config::get('laravel-ide-helper::helpers');
if( $this->option('helpers') || (\Config::get('laravel-ide-helper::include_helpers') && ! $this->option('nohelpers'))){
$helpers = \Config::get('laravel-ide-helper::helper_files');
}else{
$helpers = array();
}
$content = $this->generateDocs($aliases, $helpers);
$written = \File::put($filename, $content);
@@ -56,6 +62,19 @@ class GeneratorCommand extends Command {
);
}
/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return array(
array('helpers', "H", InputOption::VALUE_NONE, 'Include the helper files'),
array('nohelpers', "N", InputOption::VALUE_NONE, 'Do not include the helper files'),
);
}
protected function generateDocs($aliases, $helpers){
$d = new Parser();
$d->setAllowInherited(true);
+5 -2
View File
@@ -18,11 +18,14 @@ return array(
| Helper files to include
|--------------------------------------------------------------------------
|
| Include all user-defined functions.
| Include helper files. By default not included, but can be toggled with the
| -- helpers (-H) option. Extra helper files can be included.
|
*/
'helpers' => array(
'include_helpers' => false,
'helper_files' => array(
base_path().'/vendor/laravel/framework/src/Illuminate/Support/helpers.php',
),