protected function modifyApplication($app, $plugin, $options)
    {
        $file = new File($app, false);
        $contents = $file->read();

        $append = "\n        \$this->addPlugin('%s', [%s]);\n";
        $insert = str_replace(', []', '', sprintf($append, $plugin, $options));

        if (!preg_match('/function bootstrap\(\)/m', $contents)) {
            $this->abort('Your Application class does not have a bootstrap() method. Please add one.');
        } else {
            $contents = preg_replace('/(function bootstrap\(\)(?:\s+)\{)/m', '$1' . $insert, $contents);
        }
        $file->write($contents);

        $this->out('');
        $this->out(sprintf('%s modified', $app));
    }