<?php

namespace Ingot;

use Ingot\Provider\TackerServiceProvider;

abstract class Application extends \Flint\Application
{
    protected $env;

    public function __construct($rootDir, $env, $debug = false, $parameters = [])
    {
        parent::__construct($rootDir, $debug, $parameters);

        $this['env'] = $env;
    }

    /**
     * Standardise the way we intialize service providers.
     */
    abstract protected function initialize();

    public function boot()
    {
        if ($this->booted) {
            return;
        }

        // We need this always in order to expand from netgroup environments.
        $this->register(new TackerServiceProvider);

        $this->initialize();

        // We ALWAYS have a configuration file
        $this->configure('config/' . $this['env'] . '.json');

        parent::boot();
    }
}
