From 3a0afc20f25ad3bed640ff1a14957f972d123cf7 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 4 Dec 2014 23:03:58 -0600 Subject: [PATCH] Working on re-doing package handling. --- src/Illuminate/Support/ServiceProvider.php | 95 ---------------------- 1 file changed, 95 deletions(-) diff --git a/src/Illuminate/Support/ServiceProvider.php b/src/Illuminate/Support/ServiceProvider.php index 2c9e4520c69b..7fe977821f68 100755 --- a/src/Illuminate/Support/ServiceProvider.php +++ b/src/Illuminate/Support/ServiceProvider.php @@ -36,90 +36,6 @@ public function __construct($app) */ abstract public function register(); - /** - * 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) - { - $namespace = $this->getPackageNamespace($package, $namespace); - - // In this method we will register the configuration package for the package - // so that the configuration options cleanly cascade into the application - // folder to make the developers lives much easier in maintaining them. - $path = $path ?: $this->guessPackagePath(); - - $config = $path.'/config'; - - if ($this->app['files']->isDirectory($config)) - { - $this->app['config']->package($package, $config, $namespace); - } - - // Next we will check for any "language" components. If language files exist - // we will register them with this given package's namespace so that they - // may be accessed using the translation facilities of the application. - $lang = $path.'/lang'; - - if ($this->app['files']->isDirectory($lang)) - { - $this->app['translator']->addNamespace($namespace, $lang); - } - - // Next, we will see if the application view folder contains a folder for the - // package and namespace. If it does, we'll give that folder precedence on - // the loader list for the views so the package views can be overridden. - $appView = $this->getAppViewPath($package); - - if ($this->app['files']->isDirectory($appView)) - { - $this->app['view']->addNamespace($namespace, $appView); - } - - // Finally we will register the view namespace so that we can access each of - // the views available in this package. We use a standard convention when - // registering the paths to every package's views and other components. - $view = $path.'/views'; - - if ($this->app['files']->isDirectory($view)) - { - $this->app['view']->addNamespace($namespace, $view); - } - } - - /** - * Guess the package path for the provider. - * - * @return string - */ - public function guessPackagePath() - { - $path = (new ReflectionClass($this))->getFileName(); - - return realpath(dirname($path).'/../../'); - } - - /** - * Determine the namespace for a package. - * - * @param string $package - * @param string $namespace - * @return string - */ - protected function getPackageNamespace($package, $namespace) - { - if (is_null($namespace)) - { - list($vendor, $namespace) = explode('/', $package); - } - - return $namespace; - } - /** * Register the package's custom Artisan commands. * @@ -141,17 +57,6 @@ public function commands($commands) }); } - /** - * Get the application package view path. - * - * @param string $package - * @return string - */ - protected function getAppViewPath($package) - { - return $this->app['path.base']."/resources/views/packages/{$package}"; - } - /** * Get the services provided by the provider. *