Skip to content

Commit

Permalink
Merge pull request #134 from Art4/patch-1
Browse files Browse the repository at this point in the history
Fix code example
  • Loading branch information
philipobenito authored Aug 29, 2017
2 parents c25ba16 + 8c30b4e commit 4f00d3b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/2.x/inflectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ This is useful for example when you want to invoke a method on all objects that
Imagine that you have a `LoggerAwareInterface` and would like to invoke the method called `setLogger` passing in a logger every time a class is retrieved that implements this interface.

~~~ php
$container->register('Some\Logger');
$container->register('Some\LoggerAwareClass'); // implements LoggerAwareInterface
$container->register('Some\Other\LoggerAwareClass'); // implements LoggerAwareInterface
$container->add('Some\Logger');
$container->add('Some\LoggerAwareClass'); // implements LoggerAwareInterface
$container->add('Some\Other\LoggerAwareClass'); // implements LoggerAwareInterface

$container->inflector('LoggerAwareInterface')
->invokeMethod('setLogger', ['Some\Logger']); // Some\Logger will be resolved via the container
Expand Down

0 comments on commit 4f00d3b

Please sign in to comment.