Completed
Pull Request — master (#27)
by Harry
02:14
created

InvalidTimestampException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 19
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
1
<?php
2
/**
3
 * This file is part of graze/gigya-client
4
 *
5
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license https://github.com/graze/gigya-client/blob/master/LICENSE.md
11
 * @link    https://github.com/graze/gigya-client
12
 */
13
14
namespace Graze\Gigya\Exception;
15
16
use Exception;
17
use Graze\Gigya\Response\ResponseInterface;
18
use Graze\Gigya\Validation\Signature;
19
20
class InvalidTimestampException extends ResponseException
21
{
22
    /**
23
     * @param int               $timestamp
24
     * @param ResponseInterface $response
25
     * @param Exception|null    $previous
26
     */
27
    public function __construct($timestamp, ResponseInterface $response, Exception $previous = null)
28
    {
29
        $message = sprintf(
30
            'The supplied timestamp: %d is more than %d seconds different to now: %d',
31
            $timestamp,
32
            Signature::TIMESTAMP_OFFSET,
33
            time()
34
        );
35
36
        parent::__construct($response, $message, $previous);
37
    }
38
}
39