Completed
Push — master ( 509b14...929e7e )
by Barney
04:52 queued 03:02
created

DefaultStartMessage   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 8 1
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\Formatter\Message;
13
14
use Psr\Http\Message\RequestInterface;
15
use Shrikeh\GuzzleMiddleware\TimerLogger\Timer\TimerInterface;
16
17
/**
18
 * Class DefaultStartMessage.
19
 */
20
class DefaultStartMessage
21
{
22
    const MSG = 'Started call to %s at %s';
23
    const FORMAT = 'Y-m-d H:i:s';
24
25
    /**
26
     * @param TimerInterface   $timer   The timer to format
27
     * @param RequestInterface $request The request for the timer
28
     *
29
     * @return string
30
     */
31
    public function __invoke(
32
        TimerInterface $timer,
33
        RequestInterface $request
34
    ) {
35
        return \sprintf(
36
            self::MSG,
37
            $request->getUri(),
38
            $timer->start()->format(self::FORMAT)
39
        );
40
    }
41
}
42