public function setup($environment = null, $default = 'development')
    {
        if (Configure::read('Environment.setup')) {
            return false;
        }

        $current = $this->currentEnvironment($environment, $default);

        if (!isset($this->environments[$current])) {
            throw new Exception(sprintf('Environment %s does not exist.', $current));
        }

        $config = array_merge(
            $this->environments[$current]['config'],
            ['Environment.name' => $current]
        );
        foreach ($config as $param => $value) {
            Configure::write($param, $value);
        }

        if (is_callable($this->environments[$current]['callable'])) {
            $this->environments[$current]['callable']();
        }

        Configure::write('Environment.setup', true);

        return true;
    }