From c4df3ec0d4394e7cd4e55b6b076b62888d05c3d2 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 26 Jan 2016 12:17:10 +0000 Subject: [PATCH] Rewrap text and few minor typos, refs #4832 --- doc/articles/plugins.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/doc/articles/plugins.md b/doc/articles/plugins.md index 424f08605..b4997d22d 100644 --- a/doc/articles/plugins.md +++ b/doc/articles/plugins.md @@ -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()