8000 Reviewed EventDispatcher docs · symfony/symfony-docs@b85837f · GitHub
[go: up one dir, main page]

Skip to content

Commit b85837f

Browse files
committed
Reviewed EventDispatcher docs
1 parent a045995 commit b85837f

File tree

5 files changed

+143
-137
lines changed

5 files changed

+143
-137
lines changed

components/event_dispatcher/container_aware_dispatcher.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ The Container Aware Event Dispatcher
77
Introduction
88
------------
99

10-
The :class:`Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher` is
11-
a special ``EventDispatcher`` implementation which is coupled to the service container
12-
that is part of :doc:`the DependencyInjection component </components/dependency_injection/introduction>`.
10+
The :class:`Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher`
11+
is a special ``EventDispatcher`` implementation which is coupled to the
12+
service container that is part of
13+
:doc:`the DependencyInjection component </components/dependency_injection/introduction>`.
1314
It allows services to be specified as event listeners making the ``EventDispatcher``
1415
extremely powerful.
1516

16-
Services are lazy loaded meaning the services attached as listeners will only be
17-
created if an event is dispatched that requires those listeners.
17+
Services are lazy loaded meaning the services attached as listeners will
18+
only be created if an event is dispatched that requires those listeners.
1819

1920
Setup
2021
-----
@@ -34,8 +35,8 @@ Adding Listeners
3435
The ``ContainerAwareEventDispatcher`` can either load specified services
3536
directly or services that implement :class:`Symfony\\Component\\EventDispatcher\\EventSubscriberInterface`.
3637

37-
The following examples assume the service container has been loaded with any
38-
services that are mentioned.
38+
The following examples assume the service container has been loaded with
39+
any services that are mentioned.
3940

4041
.. note::
4142

components/event_dispatcher/generic_event.rst

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@
44
The Generic Event Object
55
========================
66

7-
The base :class:`Symfony\\Component\\EventDispatcher\\Event` class provided by the
8-
EventDispatcher component is deliberately sparse to allow the creation of
9-
API specific event objects by inheritance using OOP. This allows for elegant and
10-
readable code in complex applications.
7+
The base :class:`Symfony\\Component\\EventDispatcher\\Event` class provided
8+
by the EventDispatcher component is deliberately sparse to allow the creation
9+
of API specific event objects by inheritance using OOP. This allows for
10+
elegant and readable code in complex applications.
1111

1212
The :class:`Symfony\\Component\\EventDispatcher\\GenericEvent` is available
13-
for convenience for those who wish to use just one event object throughout their
14-
application. It is suitable for most purposes straight out of the box, because
15-
it follows the standard observer pattern where the event object
13+
for convenience for those who wish to use just one event object throughout
14+
their application. It is suitable for most purposes straight out of the
15+
box, because it follows the standard observer pattern where the event object
1616
encapsulates an event 'subject', but has the addition of optional extra
1717
arguments.
1818

19-
:class:`Symfony\\Component\\EventDispatcher\\GenericEvent` has a simple API in
20-
addition to the base class :class:`Symfony\\Component\\EventDispatcher\\Event`
19+
:class:`Symfony\\Component\\EventDispatcher\\GenericEvent` has a simple
20+
API in addition to the base class
21+
:class:`Symfony\\Component\\EventDispatcher\\Event`
2122

2223
* :method:`Symfony\\Component\\EventDispatcher\\GenericEvent::__construct`:
2324
Constructor takes the event subject and any arguments;
@@ -41,8 +42,8 @@ addition to the base class :class:`Symfony\\Component\\EventDispatcher\\Event`
4142
Returns true if the argument key exists;
4243

4344
The ``GenericEvent`` also implements :phpclass:`ArrayAccess` on the event
44-
arguments which makes it very convenient to pass extra arguments regarding the
45-
event subject.
45+
arguments which makes it very convenient to pass extra arguments regarding
46+
the event subject.
4647

4748
The following examples show use-cases to give a general idea of the flexibility.
4849
The examples assume event listeners have been added to the dispatcher.
@@ -64,8 +65,8 @@ Simply passing a subject::
6465
}
6566
}
6667

67-
Passing and processing arguments using the :phpclass:`ArrayAccess` API to access
68-
the event arguments::
68+
Passing and processing arguments using the :phpclass:`ArrayAccess` API to
69+
access the event arguments::
6970

7071
use Symfony\Component\EventDispatcher\GenericEvent;
7172

components/event_dispatcher/immutable_dispatcher.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ The Immutable Event Dispatcher
77
.. versionadded:: 2.1
88
This feature was introduced in Symfony 2.1.
99

10-
The :class:`Symfony\\Component\\EventDispatcher\\ImmutableEventDispatcher` is
11-
a locked or frozen event dispatcher. The dispatcher cannot register new
10+
The :class:`Symfony\\Component\\EventDispatcher\\ImmutableEventDispatcher`
11+
is a locked or frozen event dispatcher. The dispatcher cannot register new
1212
listeners or subscribers.
1313

14-
The ``ImmutableEventDispatcher`` takes another event dispatcher with all the
15-
listeners and subscribers. The immutable dispatcher is just a proxy of this
16-
original dispatcher.
14+
The ``ImmutableEventDispatcher`` takes another event dispatcher with all
15+
the listeners and subscribers. The immutable dispatcher is just a proxy
16+
of this original dispatcher.
1717

1818
To use it, first create a normal dispatcher (``EventDispatcher`` or
1919
``ContainerAwareEventDispatcher``) and register some listeners or

0 commit comments

Comments
 (0)
0