public function register(Application $app)
    {
        $this->addMerger($app);

        $app->extend(
            'console',
            function (ConsoleApplication $console) {
                $console->getDefinition()->addOption(
                    new InputOption(
                        'config',
                        'c',
                        InputOption::VALUE_OPTIONAL,
                        'Location of a custom configuration file'
                    )
                );

                return $console;
            }
        );

        $app['config.path.template'] = __DIR__ . '/Resources/phpdoc.tpl.xml';
        $app['config.path.user'] = getcwd()
            . ((file_exists(getcwd() . '/phpdoc.xml')) ? '/phpdoc.xml' : '/phpdoc.dist.xml');
        $app['config.class'] = 'phpDocumentor\Configuration';

        $app['config'] = $app->share(
            function ($app) {
                $loader = new Loader($app['serializer'], $app['config.merger']);

                return $loader->load($app['config.path.template'], $app['config.path.user'], $app['config.class']);
            }
        );
    }