Completed
Push — master ( 3653e4...6fb8c6 )
by Xu
05:26
created

Channel::getTimeout()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 1
nop 0
dl 0
loc 3
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\notifications\channels;
9
10
use yii\base\BaseObject;
11
use yuncms\notifications\contracts\ChannelInterface;
12
use yuncms\notifications\Notification;
13
14
/**
15
 * Class Channel
16
 *
17
 * @author Tongle Xu <[email protected]>
18
 * @since 3.0
19
 */
20
abstract class Channel  extends BaseObject implements ChannelInterface
21
{
22
    const DEFAULT_TIMEOUT = 5.0;
23
24
    /**
25
     * @var float
26
     */
27
    protected $timeout;
28
29
    /**
30
     * Return timeout.
31
     * @return int|mixed
32
     */
33
    public function getTimeout()
34
    {
35
        return $this->timeout ?: self::DEFAULT_TIMEOUT;
36
    }
37
38
    /**
39
     * Set timeout.
40
     *
41
     * @param int $timeout
42
     * @return $this
43
     */
44
    public function setTimeout($timeout)
45
    {
46
        $this->timeout = floatval($timeout);
47
        return $this;
48
    }
49
}