Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
vendor
/vendor
/composer.lock
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ You get accept header support and request body decoding.

## Registering

$app->register(new Flintstones\Rest\ServiceProvider(), array(
'rest.fos.class_path' => __DIR__.'/vendor',
'rest.serializer.class_path' => __DIR__.'/vendor',
));
$app->register(new Flintstones\Rest\ServiceProvider());

## Running the tests

Expand Down
235 changes: 0 additions & 235 deletions composer.lock

This file was deleted.

25 changes: 5 additions & 20 deletions src/Flintstones/Rest/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function register(Application $app)
}

$app['rest.format_negotiator'] = function ($app) {
return new FormatNegotiator($app['request'], $app['rest.priorities']);
return new FormatNegotiator();
};

$app['rest.decoder.json'] = function ($app) {
Expand All @@ -59,29 +59,14 @@ public function register(Application $app)
'xml' => 'rest.decoder.xml',
);

if (isset($app['rest.fos.class_path'])) {
$app['autoloader']->registerNamespace('FOS\RestBundle', $app['rest.fos.class_path']);
}

if (isset($app['rest.serializer.class_path'])) {
$app['autoloader']->registerNamespace('Symfony\Component\Serializer', $app['rest.serializer.class_path']);
}

$listener = new BodyListener(new PimpleDecoderProvider($app, $app['rest.decoders']));
$app['dispatcher']->addListener(HttpKernelEvents::REQUEST, array($listener, 'onKernelRequest'));

$listener = new FormatListener($app['rest.format_negotiator'], 'html', $app['rest.priorities']);
$app['dispatcher']->addListener(HttpKernelEvents::CONTROLLER, array($listener, 'onKernelController'), 10);
}

/**
* Bootstraps the application.
*
* This method is called after all services are registers
* and should be used for "dynamic" configuration (whenever
* a service must be requested).
*/
public function boot(Application $app) {
// TODO: Implement boot() method.
}

public function boot(Application $app)
{
}
}
5 changes: 1 addition & 4 deletions tests/Flintstones/Rest/Tests/ServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ public function testRegister()
{
$app = new Application();

$app->register(new RestServiceProvider(), array(
'rest.fos.class_path' => __DIR__.'/../../../../vendor',
'rest.serializer.class_path' => __DIR__.'/../../../../vendor',
));
$app->register(new RestServiceProvider());

$this->assertInstanceOf('Symfony\Component\Serializer\Serializer', $app['rest.serializer']);

Expand Down