<commit_before><?php namespace Silber\Templates\Laravel;

use Silber\Templates\Templates;
use Illuminate\Support\ServiceProvider;

class TemplatesServiceProvider extends ServiceProvider {

	/**
	 * Bootstrap the application events.
	 *
	 * @return void
	 */
	public function boot()
	{
		$this->publishes([
			__DIR__.'/../config.php' => config_path('templates.php'),
		], 'config');
	}

	/**
	 * Register the service provider.
	 *
	 * @return void
	 */
	public function register()
	{
		$this->mergeConfigFrom(__DIR__.'/../config.php', 'templates');

		$this->app->bindShared('Silber\Templates\Templates', function($app)
		{
			$views = $this->getViewsBasePath();

			$config = $this->app['config']->get('templates');

			return new Templates($views, $config);
		});
	}

	/**
	 * Get the services provided by the provider.
	 *
	 * @return array
	 */
	public function provides()
	{
		return ['Silber\Templates\Templates'];
	}

	/**
	 * Get the base path to the views directory.
	 *
	 * @return string
	 */
	protected function getViewsBasePath()
	{
		$path = $this->app['config']->get('templates.views', function()
		{
			return $this->app['config']->get('view.paths.0', function()
			{
				return base_path('resources/views');
			});
		});

		return realpath($path);
	}

}<commit_msg>Better view root path handling in laravel service provider<commit_after><?php namespace Silber\Templates\Laravel;

use Silber\Templates\Templates;
use Illuminate\Support\ServiceProvider;

class TemplatesServiceProvider extends ServiceProvider {

	/**
	 * Bootstrap the application events.
	 *
	 * @return void
	 */
	public function boot()
	{
		$this->publishes([
			__DIR__.'/../config.php' => config_path('templates.php'),
		], 'config');
	}

	/**
	 * Register the service provider.
	 *
	 * @return void
	 */
	public function register()
	{
		$this->mergeConfigFrom(__DIR__.'/../config.php', 'templates');

		$this->app->bindShared('Silber\Templates\Templates', function($app)
		{
			$views = $this->getViewsBasePath();

			$config = $this->app['config']->get('templates');

			return new Templates($views, $config);
		});
	}

	/**
	 * Get the services provided by the provider.
	 *
	 * @return array
	 */
	public function provides()
	{
		return ['Silber\Templates\Templates'];
	}

	/**
	 * Get the base path to the views directory.
	 *
	 * @return string
	 */
	protected function getViewsBasePath()
	{
		$path = $this->app['config']->get('templates.views');

		if (is_null($path))
		{
			$path = $this->app['config']->get('view.paths.0');
		}

		if (is_null($path))
		{
			$path = base_path('resources/views');
		}

		return realpath($path);
	}

}
{'fraction_non_alphanumeric': 0.17338403041825096, 'fraction_numerical': 0.0007604562737642585, 'mean_word_length': 3.5996503496503496, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7307551', 'n_tokens_mistral': 945, 'n_tokens_neox': 836, 'n_words': 174}