StartTimer   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 7 2
1
<?php
2
/**
3
 * @codingStandardsIgnoreStart
4
 *
5
 * @author       Barney Hanlon <[email protected]>
6
 * @copyright    Barney Hanlon 2017
7
 * @license      https://opensource.org/licenses/MIT
8
 *
9
 * @codingStandardsIgnoreEnd
10
 */
11
12
namespace Shrikeh\GuzzleMiddleware\TimerLogger\Handler;
13
14
use Exception;
15
use Psr\Http\Message\RequestInterface;
16
use Shrikeh\GuzzleMiddleware\TimerLogger\Handler\Traits\HandlerStaticConstructorTrait;
17
18
/**
19
 * Class StartHandler.
20
 */
21
final class StartTimer
22
{
23
    use HandlerStaticConstructorTrait;
24
25
    /**
26
     * @param RequestInterface $request The Request to start timing
27
     */
28
    public function __invoke(RequestInterface $request)
29
    {
30
        try {
31
            $this->responseTimeLogger->start($request);
32
        } catch (Exception $e) {
33
            // Pass the exception to the handler
34
            $this->exceptionHandler->handle($e);
35
        }
36
    }
37
}
38