This class 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...
22
{
23
/**
24
* @var string|callable
25
*/
26
private $msg;
27
28
/**
29
* @var string|callable
30
*/
31
private $level;
32
33
/**
34
* StartFormatter constructor.
35
*
36
* @param callable $msg A callable used to create the message
37
* @param callable|string $level the level this should be logged at
38
*/
39
public function __construct(callable $msg, $level = LogLevel::DEBUG)
40
{
41
$this->msg = $msg;
42
$this->level = $level;
43
}
44
45
/**
46
* {@inheritdoc}
47
*/
48
public function start(TimerInterface $timer, RequestInterface $request)
49
{
50
$msg = $this->msg;
51
52
return $msg($timer, $request);
53
}
54
55
/**
56
* {@inheritdoc}
57
*/
58
public function levelStart(TimerInterface $timer, RequestInterface $request)
The expression return $level also could return the type callable which is incompatible with the return type mandated by Shrikeh\GuzzleMiddleware...Interface::levelStart() of string.
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.