HandleClassNameInflector::inflect()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
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 5
    public function inflect($command, $commandHandler): string
18
    {
19 5
        $commandName = parent::inflect($command, $commandHandler);
20
21 5
        return 'handle' . ucfirst($commandName);
22
    }
23
}
24