Skip to content

Fix namespaces and file names #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 1, 2016
Merged
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
5 changes: 3 additions & 2 deletions As3PostProcessBundle.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php
namespace As3\PostProcessBundle;
namespace As3\Bundle\PostProcessBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use As3\PostProcessBundle\DependencyInjection\Compiler;
use As3\Bundle\PostProcessBundle\DependencyInjection\Compiler;

class As3PostProcessBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new Compiler\AddTasksCompilerPass());
$container->addCompilerPass(new Compiler\AddPluginsCompilerPass());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace As3\PostProcessBundle\DependencyInjection;
namespace As3\Bundle\PostProcessBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
Expand Down
3 changes: 2 additions & 1 deletion DependencyInjection/Compiler/AddPluginsCompilerPass.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace As3\PostProcessBundle\DependencyInjection\Compiler;

namespace As3\Bundle\PostProcessBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down
3 changes: 2 additions & 1 deletion DependencyInjection/Compiler/AddTasksCompilerPass.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
namespace As3\PostProcessBundle\DependencyInjection\Compiler;

namespace As3\Bundle\PostProcessBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace As3\PostProcessBundle\DependencyInjection;
namespace As3\Bundle\PostProcessBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
Expand Down
2 changes: 1 addition & 1 deletion Plugins/PluginInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace As3\PostProcessBundle\Plugins;
namespace As3\Bundle\PostProcessBundle\Plugins;

use Symfony\Component\HttpKernel\Event\PostResponseEvent;
use Symfony\Component\HttpFoundation\Response;
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To install this bundle via composer, perform the following command: `composer re
### Register the Bundle

Once installed, register the bundle in your `AppKernel.php`:
```
```php
// app/AppKernel.php
public function registerBundles()
{
Expand All @@ -35,8 +35,8 @@ A task can be used to execute logic after the response has been sent to the user

Example:

```
use As3\PostProcessBundle\TaskInterface;
```php
use As3\Bundle\PostProcessBundle\TaskInterface;

class SleepTestTask implements TaskInterface
{
Expand All @@ -52,7 +52,7 @@ class SleepTestTask implements TaskInterface
```

To register your task, call the `addTask` method against the task manager's service (`as3_post_process.task.manager`):
```
```php
$manager = $this->get('as3_post_process.task.manager');
$manager->addTask(new SleepTestTask(), 5);
```
Expand All @@ -61,7 +61,7 @@ Tasks can have a `priority` set when they are added to the manager -- by default

You can also register a service by using the tag `as3_post_process.task` if your task should be run on every request.

```
```yaml
# src\MyBundle\Resources\services.yml
services:
my_app.my_cool_task:
Expand All @@ -76,7 +76,7 @@ A plugin can be used to modify the response before it is returned to the user.

Example:

```
```php
use Symfony\Component\HttpFoundation\Response;

/**
Expand Down Expand Up @@ -117,7 +117,7 @@ class NewRelicInjector extends PluginInterface

This plugin will disable automatic injection of NewRelic end user monitoring javascript. To enable this for all requests, add the following service definition:

```
```yaml
my_app.my_bundle.new_relic_injector:
class: MyApp\MyBundle\NewRelicPlugin
tags:
Expand Down
2 changes: 1 addition & 1 deletion Resources/config/services.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
as3_post_process.task.manager:
class: As3\PostProcessBundle\Task\TaskManager
class: As3\Bundle\PostProcessBundle\Task\TaskManager
tags:
- { name: kernel.event_listener, event: kernel.response, method: filterResponse, priority: -255 }
- { name: kernel.event_listener, event: kernel.terminate, method: execute, priority: 1 }
2 changes: 1 addition & 1 deletion Task/TaskInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace As3\PostProcessBundle\Task;
namespace As3\Bundle\PostProcessBundle\Task;

/**
* Interface for Tasks to be executed "post process" - after the response is sent
Expand Down
11 changes: 5 additions & 6 deletions Task/TaskManager.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace As3\PostProcessBundle\Task;
namespace As3\Bundle\PostProcessBundle\Task;

use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\Event\PostResponseEvent;
use Symfony\Component\HttpFoundation\Response;
use As3\PostProcessBundle\Plugins\PluginInterface;
use As3\Bundle\PostProcessBundle\Plugins\PluginInterface;

/**
* The task manager is responsible for running PHP code after a response is sent to the browser.
Expand Down Expand Up @@ -169,8 +169,7 @@ public function isEnabled()
* Executes the post-response Tasks.
* Is called via Symfony's kernel.terminate event.
*
* @param Symfony\Component\HttpKernel\Event\PostResponseEvent $event The Symfony post response event
* @return void
* @param PostResponseEvent $event
*/
public function execute(PostResponseEvent $event)
{
Expand All @@ -192,8 +191,8 @@ public function execute(PostResponseEvent $event)
* Sets the HTTP headers required to execute post-response Tasks.
* Is called via Symfony's kernel.response event.
*
* @param Symfony\Component\HttpKernel\Event\FilterResponseEvent $event The Symfony response event
* @return Symfony\Component\HttpFoundation\Response
* @param FilterResponseEvent $event
* @return Response
*/
public function filterResponse(FilterResponseEvent $event)
{
Expand Down