diff --git a/composer.json b/composer.json index 8759bbb..c0e7838 100644 --- a/composer.json +++ b/composer.json @@ -10,10 +10,10 @@ } ], "require": { - "php": ">=5.3.0", - "illuminate/support": "4.x|5.0.x", - "illuminate/console": "4.x|5.0.x", - "illuminate/filesystem": "4.x|5.0.x", + "php": ">=5.4.0", + "illuminate/support": "5.0.x", + "illuminate/console": "5.0.x", + "illuminate/filesystem": "5.0.x", "phpdocumentor/reflection-docblock": "2.0.x", "symfony/class-loader": "~2.3" }, diff --git a/src/config/config.php b/config/ide-helper.php similarity index 100% rename from src/config/config.php rename to config/ide-helper.php diff --git a/provides.json b/provides.json deleted file mode 100644 index 8714698..0000000 --- a/provides.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "providers": [ - "Barryvdh\\LaravelIdeHelper\\IdeHelperServiceProvider" - ] -} diff --git a/src/views/ide-helper.php b/resources/views/helper.php similarity index 97% rename from src/views/ide-helper.php rename to resources/views/helper.php index 473dc71..fb34570 100644 --- a/src/views/ide-helper.php +++ b/resources/views/helper.php @@ -1,39 +1,39 @@ - - -/** - * An helper file for Laravel 4, to provide autocomplete information to your IDE - * Generated for Laravel on . - * - * @author Barry vd. Heuvel - * @see https://github.com/barryvdh/laravel-ide-helper - */ - - $aliases): ?> -namespace { - - exit("This file should not be included, only analyzed by your IDE"); - - - - - getClassType() ?> getShortName() ?> getExtends() ? 'extends ' . $alias->getExtends() : '' ?>{ - getMethods() as $method): ?> - - getDocComment(' ')) ?> - - public static function getName() ?>(getParamsWithDefault() ?>){getDeclaringClass() !== $method->getRoot()): ?> - - //Method inherited from getDeclaringClass() ?> - - - shouldReturn() ? 'return ': '' ?>getRoot() ?>::getName() ?>(getParams() ?>); - } - - - } - - - -} - - + + +/** + * An helper file for Laravel 4, to provide autocomplete information to your IDE + * Generated for Laravel on . + * + * @author Barry vd. Heuvel + * @see https://github.com/barryvdh/laravel-ide-helper + */ + + $aliases): ?> +namespace { + + exit("This file should not be included, only analyzed by your IDE"); + + + + + getClassType() ?> getShortName() ?> getExtends() ? 'extends ' . $alias->getExtends() : '' ?>{ + getMethods() as $method): ?> + + getDocComment(' ')) ?> + + public static function getName() ?>(getParamsWithDefault() ?>){getDeclaringClass() !== $method->getRoot()): ?> + + //Method inherited from getDeclaringClass() ?> + + + shouldReturn() ? 'return ': '' ?>getRoot() ?>::getName() ?>(getParams() ?>); + } + + + } + + + +} + + diff --git a/src/Console/GeneratorCommand.php b/src/Console/GeneratorCommand.php index e1a9477..07ccfee 100644 --- a/src/Console/GeneratorCommand.php +++ b/src/Console/GeneratorCommand.php @@ -97,8 +97,8 @@ class GeneratorCommand extends Command $helpers = ''; - if ($this->option('helpers') || ($this->config->get('laravel-ide-helper::include_helpers'))) { - foreach ($this->config->get('laravel-ide-helper::helper_files', array()) as $helper) { + if ($this->option('helpers') || ($this->config->get('ide-helper.include_helpers'))) { + foreach ($this->config->get('ide-helper.helper_files', array()) as $helper) { if (file_exists($helper)) { $helpers .= str_replace(array(''), '', $this->files->get($helper)); } @@ -139,7 +139,7 @@ class GeneratorCommand extends Command */ protected function getArguments() { - $filename = $this->config->get('laravel-ide-helper::filename'); + $filename = $this->config->get('ide-helper.filename'); return array( array( @@ -155,7 +155,7 @@ class GeneratorCommand extends Command */ protected function getOptions() { - $format = $this->config->get('laravel-ide-helper::format'); + $format = $this->config->get('ide-helper.format'); return array( array('format', "F", InputOption::VALUE_OPTIONAL, 'The format for the IDE Helper', $format), diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index bd0a429..a56865d 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -60,7 +60,7 @@ class ModelsCommand extends Command $filename = $this->option('filename'); $this->write = $this->option('write'); $this->dirs = array_merge( - $this->laravel['config']->get('laravel-ide-helper::model_locations'), + $this->laravel['config']->get('ide-helper.model_locations'), $this->option('dir') ); $model = $this->argument('model'); diff --git a/src/Generator.php b/src/Generator.php index cea5cae..30dfb40 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -47,9 +47,9 @@ class Generator // Find the drivers to add to the extra/interfaces $this->detectDrivers(); - $this->extra = array_merge($this->extra, $this->config->get('laravel-ide-helper::extra')); - $this->magic = array_merge($this->magic, $this->config->get('laravel-ide-helper::magic')); - $this->interfaces = array_merge($this->interfaces, $this->config->get('laravel-ide-helper::interfaces')); + $this->extra = array_merge($this->extra, $this->config->get('ide-helper.extra')); + $this->magic = array_merge($this->magic, $this->config->get('ide-helper.magic')); + $this->interfaces = array_merge($this->interfaces, $this->config->get('ide-helper.interfaces')); // Make all interface classes absolute foreach ($this->interfaces as &$interface) { $interface = '\\' . ltrim($interface, '\\'); @@ -77,7 +77,7 @@ class Generator public function generatePhpHelper() { $app = app(); - return $this->view->make('laravel-ide-helper::ide-helper') + return $this->view->make('ide-helper::helper') ->with('namespaces', $this->getNamespaces()) ->with('helpers', $this->helpers) ->with('version', $app::VERSION) diff --git a/src/IdeHelperServiceProvider.php b/src/IdeHelperServiceProvider.php index 074fd60..8b1551e 100644 --- a/src/IdeHelperServiceProvider.php +++ b/src/IdeHelperServiceProvider.php @@ -31,7 +31,8 @@ class IdeHelperServiceProvider extends ServiceProvider */ public function boot() { - $this->package('barryvdh/laravel-ide-helper', 'laravel-ide-helper', __DIR__); + $viewPath = __DIR__.'/../resources/views'; + $this->loadViewsFrom('ide-helper', $viewPath); } /** @@ -41,6 +42,10 @@ class IdeHelperServiceProvider extends ServiceProvider */ public function register() { + $configPath = __DIR__ . '/../config/ide-helper.php'; + $this->mergeConfigFrom('ide-helper', $configPath); + $this->publishes([$configPath => config_path('ide-helper.php')]); + $this->app['command.ide-helper.generate'] = $this->app->share( function ($app) { return new GeneratorCommand($app['config'], $app['files'], $app['view']); @@ -65,37 +70,5 @@ class IdeHelperServiceProvider extends ServiceProvider { return array('command.ide-helper.generate', 'command.ide-helper.models'); } - - /** - * Register the package's component namespaces. - * - * @param string $package - * @param string $namespace - * @param string $path - * @return void - */ - public function package($package, $namespace = null, $path = null) - { - - // Is it possible to register the config? - if (method_exists($this->app['config'], 'package')) { - $this->app['config']->package($package, $path.'/config', $namespace); - } else { - // Load the config for now.. - $config = $this->app['files']->getRequire($path .'/config/config.php'); - foreach($config as $key => $value){ - $this->app['config']->set($namespace.'::'.$key, $value); - } - } - - // Register view files - $appView = $this->app['path']."/views/packages/{$package}"; - if ($this->app['files']->isDirectory($appView)) - { - $this->app['view']->addNamespace($namespace, $appView); - } - - $this->app['view']->addNamespace($namespace, $path.'/views'); - } }