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

DefaultStartMessage::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 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\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