GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#6)
by Koldo
02:33
created

LaravelLazyLocator::getHandlerForCommand()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 8
loc 8
ccs 0
cts 4
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 6
1
<?php
2
3
namespace Joselfonseca\LaravelTactician\Locator;
4
5
use League\Tactician\Exception\MissingHandlerException;
6
7
class LaravelLazyLocator extends LaravelLocator
8
{
9
10
    /**
11
     * Bind a handler instance to receive all commands with a certain class
12
     *
13
     * @param string $handler          Handler to receive class name
14
     * @param string $commandClassName Command class e.g. "My\TaskAddedCommand"
15
     */
16
    public function addHandler($handler, $commandClassName)
17
    {
18
        $this->handlers[$commandClassName] = function () use ($handler) {
19
            return app($handler);
20
        };
21
    }
22
23
    /**
24
     * Retrieves the handler for a specified command
25
     *
26
     * @param string $commandName
27
     *
28
     * @return object
29
     *
30
     * @throws MissingHandlerException
31
     */
32 View Code Duplication
    public function getHandlerForCommand($commandName)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
33
    {
34
        if (!isset($this->handlers[$commandName])) {
35
            throw MissingHandlerException::forCommand($commandName);
36
        }
37
38
        return $this->handlers[$commandName]();
39
    }
40
}
41