Skip to content

Commit b80186e

Browse files
committed
Fixed code examples in cookbook/event_dispatcher
1 parent d184401 commit b80186e

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

cookbook/event_dispatcher/before_after_filters.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ You can add basic token configuration using ``config.yml`` and the parameters ke
6363
// app/config/config.php
6464
$container->setParameter('tokens', array(
6565
'client1' => 'pass1',
66-
'client2' => 'pass2'
66+
'client2' => 'pass2',
6767
));
6868
6969
Tag Controllers to be checked
@@ -87,7 +87,7 @@ A controller that implements this interface simply looks like this::
8787

8888
class FooController implements TokenAuthenticatedController
8989
{
90-
// Your actions that need authentication
90+
// ... Your actions that need authentication
9191
}
9292

9393
Creating an Event Listener
@@ -97,6 +97,7 @@ Next, you'll need to create an event listener, which will hold the logic
9797
that you want executed before your controllers. If you're not familiar with
9898
event listeners, you can learn more about them at :doc:`/cookbook/service_container/event_listener`::
9999

100+
// src/Acme/DemoBundle/EventListener/BeforeListener.php
100101
namespace Acme\DemoBundle\EventListener;
101102

102103
use Acme\DemoBundle\Controller\TokenAuthenticatedController;
@@ -144,7 +145,7 @@ your listener to be called just before any controller is executed:
144145

145146
.. code-block:: yaml
146147
147-
# app/config/config.yml (or inside or your services.yml)
148+
# app/config/config.yml (or inside your services.yml)
148149
services:
149150
demo.tokens.action_listener:
150151
class: Acme\DemoBundle\EventListener\BeforeListener
@@ -154,13 +155,15 @@ your listener to be called just before any controller is executed:
154155
155156
.. code-block:: xml
156157
158+
<!-- app/config/config.xml (or inside your services.xml) -->
157159
<service id="demo.tokens.action_listener" class="Acme\DemoBundle\EventListener\BeforeListener">
158160
<argument>%tokens%</argument>
159161
<tag name="kernel.event_listener" event="kernel.controller" method="onKernelController" />
160162
</service>
161163
162164
.. code-block:: php
163165
166+
// app/config/config.php (or inside your services.php)
164167
use Symfony\Component\DependencyInjection\Definition;
165168
166169
$listener = new Definition('Acme\DemoBundle\EventListener\BeforeListener', array('%tokens%'));

cookbook/event_dispatcher/class_extension.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ and *add* the method ``bar()``:
109109
// the bar method arguments
110110
$arguments = $event->getArguments();
111111
112-
// do something
113-
// ...
112+
// ... do something
114113
115114
// set the return value
116115
$event->setReturnValue($someValue);

cookbook/event_dispatcher/method_behavior.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ method::
2424
// get $foo and $bar from the event, they may have been modified
2525
$foo = $event->getFoo();
2626
$bar = $event->getBar();
27+
2728
// the real method implementation is here
28-
// $ret = ...;
29+
$ret = ...;
2930

3031
// do something after the method
3132
$event = new FilterSendReturnValue($ret);

0 commit comments

Comments
 (0)