ameliabooking
/
vendor
/
league
/
tactician
/
src
/
Handler
/
MethodNameInflector
/
HandleClassNameInflector.php
ClassNameInflector.php
7 years ago
HandleClassNameInflector.php
7 years ago
HandleClassNameWithoutSuffixInflector.php
7 years ago
HandleInflector.php
7 years ago
InvokeInflector.php
7 years ago
MethodNameInflector.php
7 years ago
HandleClassNameInflector.php
24 lines
| 1 | <?php |
| 2 | |
| 3 | namespace League\Tactician\Handler\MethodNameInflector; |
| 4 | |
| 5 | /** |
| 6 | * Assumes the method is handle + the last portion of the class name. |
| 7 | * |
| 8 | * Examples: |
| 9 | * - \MyGlobalCommand => $handler->handleMyGlobalCommand() |
| 10 | * - \My\App\TaskCompletedCommand => $handler->handleTaskCompletedCommand() |
| 11 | */ |
| 12 | class HandleClassNameInflector extends ClassNameInflector |
| 13 | { |
| 14 | /** |
| 15 | * {@inheritdoc} |
| 16 | */ |
| 17 | public function inflect($command, $commandHandler) |
| 18 | { |
| 19 | $commandName = parent::inflect($command, $commandHandler); |
| 20 | |
| 21 | return 'handle' . ucfirst($commandName); |
| 22 | } |
| 23 | } |
| 24 |