Rewrap text and few minor typos, refs #4832

main
Jordi Boggiano 9 years ago
parent 48287b5a1c
commit c4df3ec0d4

@ -36,7 +36,7 @@ as a normal package's.
The current composer plugin API version is 1.0.0.
An example of a valid plugin `composer.json` file (with the autoloading
An example of a valid plugin `composer.json` file (with the autoloading
part omitted):
```json
@ -89,31 +89,40 @@ Furthermore plugins may implement the
event handlers automatically registered with the `EventDispatcher` when the
plugin is loaded.
To register a method to an event, implement the method `getSubscribedEvents()` and have it return an array. The array key must be the event name ([listed here](https://getcomposer.org/doc/articles/scripts.md#event-names)) and the value is the name of the method in this class to be called.
To register a method to an event, implement the method `getSubscribedEvents()`
and have it return an array. The array key must be the
[event name](https://getcomposer.org/doc/articles/scripts.md#event-names)
and the value is the name of the method in this class to be called.
```php
public static function getSubscribedEvents()
{
return array(
'post-autoload-dump' => 'methodToBeCalled',
// ^ event name ^ ^ method name ^
// ^ event name ^ ^ method name ^
);
}
```
By default, the priority of an event handler is set to 0. The priorty can be changed by attaching a tuple where the first value is the method name, as before, and the second value is an integer representing the priority. Higher integers represent higher priorityes therefore, priortity 2 is called before priority 1, etc.
By default, the priority of an event handler is set to 0. The priorty can be
changed by attaching a tuple where the first value is the method name, as
before, and the second value is an integer representing the priority.
Higher integers represent higher priorities. Priortity 2 is called before
priority 1, etc.
```php
public static function getSubscribedEvents()
{
return array(
// Will be called before events with priority 0
'post-autoload-dump' => array('methodToBeCalled', 1)
'post-autoload-dump' => array('methodToBeCalled', 1)
);
}
```
If multiple methods should be called, then an array of tupples can be attached to each event. The tupples do not need to include the priority. If it is omitted, it will default to 0.
If multiple methods should be called, then an array of tuples can be attached
to each event. The tuples do not need to include the priority. If it is
omitted, it will default to 0.
```php
public static function getSubscribedEvents()

Loading…
Cancel
Save