| Total Complexity | 5 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class ClassNameWithoutSuffixInflector implements MethodNameInflector |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | protected $suffix; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var int |
||
| 21 | */ |
||
| 22 | protected $suffixLength = 0; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * ClassNameWithoutSuffixInflector constructor. |
||
| 26 | * |
||
| 27 | * @param string $suffix |
||
| 28 | */ |
||
| 29 | 10 | public function __construct(string $suffix = 'Command') |
|
| 30 | { |
||
| 31 | 10 | $this->suffix = $suffix; |
|
| 32 | 10 | $this->suffixLength = strlen($suffix); |
|
| 33 | 10 | } |
|
| 34 | |||
| 35 | /** |
||
| 36 | * Return the method name to call on the command handler and return it. |
||
| 37 | * |
||
| 38 | * Examples: |
||
| 39 | * - \CompleteTaskCommand => $handler->completeTask() |
||
| 40 | * - \My\App\DoThingCommand => $handler->doThing() |
||
| 41 | * |
||
| 42 | * @param object $command |
||
| 43 | * @param object $commandHandler |
||
| 44 | * |
||
| 45 | * @return string |
||
| 46 | */ |
||
| 47 | 6 | public function inflect($command, $commandHandler) |
|
| 55 | } |
||
| 56 | } |
||
| 57 |