Completed
Push — master ( 9cbcb0...b6322f )
by Xu
09:02 queued 02:42
created

Gateway::setTimeout()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @link http://www.tintsoft.com/
4
 * @copyright Copyright (c) 2012 TintSoft Technology Co. Ltd.
5
 * @license http://www.tintsoft.com/license/
6
 */
7
8
namespace yuncms\payment;
9
10
use yuncms\payment\contracts\GatewayInterface;
11
use yuncms\payment\traits\GatewayTrait;
12
13
/**
14
 * Class Gateway
15
 *
16
 * @author Tongle Xu <[email protected]>
17
 * @since 3.0
18
 */
19
class Gateway implements GatewayInterface
20
{
21
    use GatewayTrait;
22
23
    const DEFAULT_TIMEOUT = 5.0;
24
25
    /**
26
     * @var float
27
     */
28
    protected $timeout;
29
30
    /**
31
     * Return timeout.
32
     *
33
     * @return int|mixed
34
     */
35
    public function getTimeout()
36
    {
37
        return $this->timeout ?: self::DEFAULT_TIMEOUT;
38
    }
39
40
    /**
41
     * Set timeout.
42
     *
43
     * @param int $timeout
44
     *
45
     * @return $this
46
     */
47
    public function setTimeout($timeout)
48
    {
49
        $this->timeout = floatval($timeout);
50
        return $this;
51
    }
52
}