From facc08c28c33bf24913a5b375b4ebba531bb54df Mon Sep 17 00:00:00 2001 From: Menno Holtkamp Date: Sun, 15 Nov 2015 14:28:55 +0100 Subject: [PATCH 1/3] Extend example of $eventSubscribersByEventName --- doc/event_bus.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/event_bus.md b/doc/event_bus.md index 81551ce..c990028 100644 --- a/doc/event_bus.md +++ b/doc/event_bus.md @@ -42,10 +42,14 @@ every event subscriber will be fully loaded, even though it is not going to be u use SimpleBus\Message\CallableResolver\CallableCollection; use SimpleBus\Message\CallableResolver\ServiceLocatorAwareCallableResolver; -// Provide a map of event names to callables. You can provide actual callables, or lazy-loading ones. +// Provide a map of event names to callables. You can provide actual callables, or lazy-loading ones using a ServiceLocator $eventSubscribersByEventName = [ - 'Fully\Qualified\Class\Name\Of\Event' => [ - ['event_subscriber_service_id', 'notify'] + Fully\Qualified\Class\Name\Of\Event::class => [ + $fqcn = My\Class\Name::class, //Will use ServiceLocator for instantiation and invoke $instance->notify() + $object = new My\Class\Name(), //Will not use ServiceLocator and invoke $object->notify() + $callable1 = [My\Class\Name::class, 'notify'], //Will not use ServiceLocator and invoke My\Class\Name::notify() statically + $callable2 = [new My\Class\Name(), 'notify'], //Will not use ServiceLocator and invoke $serviceInstance->notify() + $callable3 = ['event_subscriber_service_id', 'notify'], //Will use ServiceLocator to instantiate service and invoke '$object->notify()' method ['another_event_subscriber_service_id', 'notify'] ] ]; From bf2b7dd9e7cb4cf7ff07acf12f48a8ad5c4fbb4d Mon Sep 17 00:00:00 2001 From: Menno Holtkamp Date: Thu, 26 Nov 2015 12:50:03 +0100 Subject: [PATCH 2/3] Added spaces after inline comment slashes --- doc/event_bus.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/event_bus.md b/doc/event_bus.md index c990028..8179927 100644 --- a/doc/event_bus.md +++ b/doc/event_bus.md @@ -45,11 +45,11 @@ use SimpleBus\Message\CallableResolver\ServiceLocatorAwareCallableResolver; // Provide a map of event names to callables. You can provide actual callables, or lazy-loading ones using a ServiceLocator $eventSubscribersByEventName = [ Fully\Qualified\Class\Name\Of\Event::class => [ - $fqcn = My\Class\Name::class, //Will use ServiceLocator for instantiation and invoke $instance->notify() - $object = new My\Class\Name(), //Will not use ServiceLocator and invoke $object->notify() - $callable1 = [My\Class\Name::class, 'notify'], //Will not use ServiceLocator and invoke My\Class\Name::notify() statically - $callable2 = [new My\Class\Name(), 'notify'], //Will not use ServiceLocator and invoke $serviceInstance->notify() - $callable3 = ['event_subscriber_service_id', 'notify'], //Will use ServiceLocator to instantiate service and invoke '$object->notify()' method + $fqcn = My\Class\Name::class, // Will use ServiceLocator for instantiation and invoke $instance->notify() if that function exists on the $instance + $object = new My\Class\Name(), // Will not use ServiceLocator and invoke $object->notify() + $callable1 = [My\Class\Name::class, 'notify'], // Will not use ServiceLocator and invoke My\Class\Name::notify() statically + $callable2 = [new My\Class\Name(), 'notify'], // Will not use ServiceLocator and invoke $serviceInstance->notify() + $callable3 = ['event_subscriber_service_id', 'notify'], // Will use ServiceLocator to instantiate service and invoke '$object->notify()' method ['another_event_subscriber_service_id', 'notify'] ] ]; From 63989b29d9137d1d29332a72854906a9c02acc32 Mon Sep 17 00:00:00 2001 From: Menno Holtkamp Date: Fri, 27 Nov 2015 10:55:53 +0100 Subject: [PATCH 3/3] Resolve conflict with master --- doc/event_bus.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/doc/event_bus.md b/doc/event_bus.md index d6a2e64..8179927 100644 --- a/doc/event_bus.md +++ b/doc/event_bus.md @@ -44,17 +44,12 @@ use SimpleBus\Message\CallableResolver\ServiceLocatorAwareCallableResolver; // Provide a map of event names to callables. You can provide actual callables, or lazy-loading ones using a ServiceLocator $eventSubscribersByEventName = [ -<<<<<<< HEAD Fully\Qualified\Class\Name\Of\Event::class => [ $fqcn = My\Class\Name::class, // Will use ServiceLocator for instantiation and invoke $instance->notify() if that function exists on the $instance $object = new My\Class\Name(), // Will not use ServiceLocator and invoke $object->notify() $callable1 = [My\Class\Name::class, 'notify'], // Will not use ServiceLocator and invoke My\Class\Name::notify() statically $callable2 = [new My\Class\Name(), 'notify'], // Will not use ServiceLocator and invoke $serviceInstance->notify() $callable3 = ['event_subscriber_service_id', 'notify'], // Will use ServiceLocator to instantiate service and invoke '$object->notify()' method -======= - 'Fully\Qualified\Class\Name\Of\Event' => [ - ['event_subscriber_service_id', 'notify'], ->>>>>>> SimpleBus/master ['another_event_subscriber_service_id', 'notify'] ] ];