<commit_before><?php namespace Orchestra\Foundation;

use Exception;

class Application {

	/**
	 * Application instance.
	 *
	 * @var Illuminate\Foundation\Application
	 */
	protected $app = null;

	/**
	 * List of services.
	 *
	 * @var array
	 */
	public $services = array();

	/**
	 * Construct a new Application instance.
	 *
	 * @access public
	 * @param  Illuminate\Foundation\Application    $app
	 * @return void
	 */
	public function __construct($app)
	{
		$this->app = $app;
	}

	/**
	 * Start the application.
	 *
	 * @access public
	 * @return void
	 */
	public function start()
	{
		$app = $this->app;

		// Make Menu instance for backend and frontend appliction
		$this->services['orchestra.menu'] = $app['orchestra.widget']->make('menu.orchestra');
		$this->services['app.menu']       = $app['orchestra.widget']->make('menu.app');
		$this->services['orchestra.acl']  = $app['orchestra.acl']->make('orchestra');

		$memory = null;

		try
		{
			// Initiate Memory class from App, this to allow advanced user
			// to use other implementation if there is a need for it.
			$memory = $app['orchestra.memory']->make();

			if (is_null($memory->get('site.name')))
			{
				throw new Exception('Installation is not completed');
			}

			// In event where we reach this point, we can consider no
			// exception has occur, we should be able to compile acl and
			// menu configuration
			$this->services['orchestra.acl']->attach($memory);

			// In any event where Memory failed to load, we should set
			// Installation status to false routing for installation is
			// enabled.
			$app['orchestra.installed'] = true;

			$this->createAdminMenu();
		}
		catch (Exception $e)
		{
			// In any case where Exception is catched, we can be assure that
			// Installation is not done/completed, in this case we should
			// use runtime/in-memory setup
			$memory = $app['orchestra.memory']->make('runtime.orchestra');
			$memory->put('site.name', 'Orchestra');

			$this->services['orchestra.menu']->add('install')
				->title('Install')
				->link(handles('orchestra/foundation::install'));

			$app['orchestra.installed'] = false;
		}

		$this->services['orchestra.memory'] = $memory;
		$app['events']->fire('orchestra.started');
	}

	/**
	 * Get installation status.
	 *
	 * @access public
	 * @return boolean
	 */
	public function installed()
	{
		return $this->app['orchestra.installed'];
	}

	/**
	 * Execute Illuminate\Foundation\Application::make().
	 *
	 * @access public
	 * @return mixed
	 */
	public function make($make = null)
	{
		if ( ! is_null($make)) return $this->app->make($make);

		return $this->app;
	}

	/**
	 * Get Illuminate Application instance.
	 *
	 * @access public
	 * @return Illuminate\Foundation\Application
	 * @see    self::make()
	 */
	public function illuminate()
	{
		return $this->make();
	}

	/**
	 * Magic method to get services.
	 */
	public function __call($method, $parameters)
	{
		$action = (count($parameters) < 1 ? "orchestra" : array_shift($parameters));
		$method = "{$action}.{$method}";

		return (isset($this->services[$method]) ? $this->services[$method] : null);
	}	

	/**
	 * Create Administration Menu for Orchestra Platform.
	 *
	 * @access protected
	 * @return void
	 */
	protected function createAdminMenu()
	{
		$acl  = $this->services['orchestra.acl'];
		$menu = $this->services['orchestra.menu'];

		$menu->add('home')
			->title(trans('orchestra/foundation::title.home'))
			->link(handles('orchestra/foundation::/'));

		$this->app['events']->listen('orchestra.ready: admin', function () use ($acl, $menu)
		{
			// Add menu when logged-user user has authorization to
			// `manage users`
			if ($acl->can('manage-users'))
			{
				$menu->add('users')
					->title(trans('orchestra/foundation::title.users.list'))
					->link(handles('orchestra/foundation::users'));

				$menu->add('add-users', '^:users')
					->title(trans('orchestra/foundation::title.users.create'))
					->link(handles('orchestra/foundation::users/view'));
			}
		});
	}
}<commit_msg>admin should be able to browse to extension and setting.<commit_after><?php namespace Orchestra\Foundation;

use Exception;

class Application {

	/**
	 * Application instance.
	 *
	 * @var Illuminate\Foundation\Application
	 */
	protected $app = null;

	/**
	 * List of services.
	 *
	 * @var array
	 */
	public $services = array();

	/**
	 * Construct a new Application instance.
	 *
	 * @access public
	 * @param  Illuminate\Foundation\Application    $app
	 * @return void
	 */
	public function __construct($app)
	{
		$this->app = $app;
	}

	/**
	 * Start the application.
	 *
	 * @access public
	 * @return void
	 */
	public function start()
	{
		$app = $this->app;

		// Make Menu instance for backend and frontend appliction
		$this->services['orchestra.menu'] = $app['orchestra.widget']->make('menu.orchestra');
		$this->services['app.menu']       = $app['orchestra.widget']->make('menu.app');
		$this->services['orchestra.acl']  = $app['orchestra.acl']->make('orchestra');

		$memory = null;

		try
		{
			// Initiate Memory class from App, this to allow advanced user
			// to use other implementation if there is a need for it.
			$memory = $app['orchestra.memory']->make();

			if (is_null($memory->get('site.name')))
			{
				throw new Exception('Installation is not completed');
			}

			// In event where we reach this point, we can consider no
			// exception has occur, we should be able to compile acl and
			// menu configuration
			$this->services['orchestra.acl']->attach($memory);

			// In any event where Memory failed to load, we should set
			// Installation status to false routing for installation is
			// enabled.
			$app['orchestra.installed'] = true;

			$this->createAdminMenu();
		}
		catch (Exception $e)
		{
			// In any case where Exception is catched, we can be assure that
			// Installation is not done/completed, in this case we should
			// use runtime/in-memory setup
			$memory = $app['orchestra.memory']->make('runtime.orchestra');
			$memory->put('site.name', 'Orchestra');

			$this->services['orchestra.menu']->add('install')
				->title('Install')
				->link(handles('orchestra/foundation::install'));

			$app['orchestra.installed'] = false;
		}

		$this->services['orchestra.memory'] = $memory;
		$app['events']->fire('orchestra.started');
	}

	/**
	 * Get installation status.
	 *
	 * @access public
	 * @return boolean
	 */
	public function installed()
	{
		return $this->app['orchestra.installed'];
	}

	/**
	 * Execute Illuminate\Foundation\Application::make().
	 *
	 * @access public
	 * @return mixed
	 */
	public function make($make = null)
	{
		if ( ! is_null($make)) return $this->app->make($make);

		return $this->app;
	}

	/**
	 * Get Illuminate Application instance.
	 *
	 * @access public
	 * @return Illuminate\Foundation\Application
	 * @see    self::make()
	 */
	public function illuminate()
	{
		return $this->make();
	}

	/**
	 * Magic method to get services.
	 */
	public function __call($method, $parameters)
	{
		$action = (count($parameters) < 1 ? "orchestra" : array_shift($parameters));
		$method = "{$action}.{$method}";

		return (isset($this->services[$method]) ? $this->services[$method] : null);
	}	

	/**
	 * Create Administration Menu for Orchestra Platform.
	 *
	 * @access protected
	 * @return void
	 */
	protected function createAdminMenu()
	{
		$acl  = $this->services['orchestra.acl'];
		$menu = $this->services['orchestra.menu'];

		$menu->add('home')
			->title(trans('orchestra/foundation::title.home'))
			->link(handles('orchestra/foundation::/'));

		$this->app['events']->listen('orchestra.ready: admin', function () use ($acl, $menu)
		{
			// Add menu when logged-user user has authorization to
			// `manage users`
			if ($acl->can('manage-users'))
			{
				$menu->add('users')
					->title(trans('orchestra/foundation::title.users.list'))
					->link(handles('orchestra/foundation::users'));

				$menu->add('add-users', '^:users')
					->title(trans('orchestra/foundation::title.users.create'))
					->link(handles('orchestra/foundation::users/view'));
			}

			// Add menu when logged-in user has authorization to
			// `manage orchestra`
			if ($acl->can('manage-orchestra'))
			{
				$menu->add('extensions', '>:home')
					->title(trans('orchestra/foundation::title.extensions.list'))
					->link(handles('orchestra/foundation::extensions'));

				$menu->add('settings')
					->title(trans('orchestra/foundation::title.settings.list'))
					->link(handles('orchestra/foundation::settings'));
			}
		});
	}
}
{'fraction_non_alphanumeric': 0.17443767572633553, 'fraction_numerical': 0.00023430178069353328, 'mean_word_length': 3.4790136411332635, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 95, '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': '1445906', 'n_tokens_mistral': 3010, 'n_tokens_neox': 2668, 'n_words': 616}