Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Commit

Permalink
Update provider for Silex 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy-muehle committed Feb 23, 2017
1 parent eacebe9 commit 6c8a43b
Showing 1 changed file with 6 additions and 27 deletions.
33 changes: 6 additions & 27 deletions src/Provider/SitemapServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,16 @@

namespace TM\Provider;

use Silex\Application;
use Silex\ServiceProviderInterface;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
use TM\Service\SitemapGenerator;

/**
* @package TM\Provider
*/
class SitemapServiceProvider implements ServiceProviderInterface
{
/**
* Registers services on the given app.
*
* This method should only be used to configure services and parameters.
* It should not get services.
*
* @param Application $app An Application instance
* @param Container $app
*/
public function register(Application $app)
public function register(Container $app)
{
$options = [
'xml_writer' => new \XMLWriter,
Expand All @@ -32,23 +24,10 @@ public function register(Application $app)
$options = array_merge($options, $app['sitemap.options']);
}

$app['sitemap'] = $app->share(function () use ($options) {
$app['sitemap'] = function () use ($options) {
return new SitemapGenerator(
$options['xml_writer'], $options['version'], $options['charset'], $options['scheme']
);
});
}

/**
* Bootstraps the application.
*
* This method is called after all services are registered
* and should be used for "dynamic" configuration (whenever
* a service must be requested).
*
* @param Application $app An Application instance
*/
public function boot(Application $app)
{
};
}
}

0 comments on commit 6c8a43b

Please sign in to comment.