File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 44
55use Symfony \Component \EventDispatcher \Event ;
66
7+ // http://symfony.com/doc/current/components/event_dispatcher/generic_event.html
78class ProxyEvent extends Event implements \ArrayAccess {
89
910 private $ data ;
@@ -13,14 +14,14 @@ public function __construct($data = array()){
1314 }
1415
1516 public function offsetSet ($ offset , $ value ){
16-
17+
1718 if (is_null ($ offset )) {
1819 $ this ->data [] = $ value ;
1920 } else {
2021 $ this ->data [$ offset ] = $ value ;
2122 }
22- }
23-
23+ }
24+
2425 public function offsetExists ($ offset ){
2526 return isset ($ this ->data [$ offset ]);
2627 }
Original file line number Diff line number Diff line change 33namespace Proxy \Plugin ;
44
55use Symfony \Component \EventDispatcher \EventSubscriberInterface ;
6+ use Symfony \Component \EventDispatcher \EventDispatcherInterface ;
67use Proxy \Event \ProxyEvent ;
78
89abstract class AbstractPlugin implements EventSubscriberInterface {
@@ -27,7 +28,7 @@ public function onCompleted(ProxyEvent $event){
2728 }
2829
2930 // dispatch based on filter
30- final public function route (ProxyEvent $ event ){
31+ final public function route (ProxyEvent $ event, $ event_name , EventDispatcherInterface $ dispatcher ){
3132
3233 $ url = $ event ['request ' ]->getUri ();
3334
@@ -44,7 +45,7 @@ final public function route(ProxyEvent $event){
4445 }
4546 }
4647
47- switch ($ event -> getName () ){
48+ switch ($ event_name ){
4849
4950 case 'request.before_send ' :
5051 $ this ->onBeforeRequest ($ event );
@@ -64,6 +65,8 @@ final public function route(ProxyEvent $event){
6465 }
6566 }
6667
68+ // This method returns an array indexed by event names and whose values are either the method name to call
69+ // or an array composed of the method name to call and a priority.
6770 final public static function getSubscribedEvents (){
6871 return array (
6972 'request.before_send ' => 'route ' ,
You can’t perform that action at this time.
0 commit comments