HandleClassNameWithoutSuffixInflector
extends HandleClassNameInflector
in package
Returns a method name that is handle + the last portion of the class name but also without a given suffix, typically "Command". This allows you to handle multiple commands on a single object but with slightly less annoying method names.
The string removal is case sensitive.
Examples:
- \CompleteTaskCommand => $handler->handleCompleteTask()
- \My\App\DoThingCommand => $handler->handleDoThing()
Table of Contents
- $suffix : string
- $suffixLength : int
- __construct() : mixed
- inflect() : string
- Return the method name to call on the command handler and return it.
Properties
$suffix
private
string
$suffix
$suffixLength
private
int
$suffixLength
Methods
__construct()
public
__construct([string $suffix = 'Command' ]) : mixed
Parameters
- $suffix : string = 'Command'
-
The string to remove from end of each class name
Return values
mixed —inflect()
Return the method name to call on the command handler and return it.
public
inflect(object $command, object $commandHandler) : string
Parameters
- $command : object
- $commandHandler : object