Options   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 97
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 21
dl 0
loc 97
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 22 1
1
<?php
2
/**
3
 * Pool options
4
 * User: moyo
5
 * Date: 14/08/2017
6
 * Time: 2:33 PM
7
 */
8
9
namespace Carno\Pool;
10
11
class Options
12
{
13
    /**
14
     * how many connections created for initial
15
     * @var int
16
     */
17
    public $initial = 0;
18
19
    /**
20
     * how many connections allows overall
21
     * @var int
22
     */
23
    public $overall = 0;
24
25
    /**
26
     * max idle connections allowed and automatic recycling when pool is idle
27
     * @var int
28
     */
29
    public $maxIdle = 0;
30
31
    /**
32
     * min idle connections keeps and automatic increasing when pool is busy
33
     * @var int
34
     */
35
    public $minIdle = 0;
36
37
    /**
38
     * time(seconds) to idling(real) state
39
     * @var int
40
     */
41
    public $idleTimeout = 0;
42
43
    /**
44
     * idle check interval in seconds
45
     * @var int
46
     */
47
    public $icInterval = 0;
48
49
    /**
50
     * heartbeat interval in seconds
51
     * @var int
52
     */
53
    public $hbInterval = 0;
54
55
    /**
56
     * select wait queue max
57
     * @var int
58
     */
59
    public $getWaitQMax = 0;
60
61
    /**
62
     * select wait timeout
63
     * @var int
64
     */
65
    public $getWaitTimeout = 0;
66
67
    /**
68
     * wait conn scale factor
69
     * @var float
70
     */
71
    public $scaleFactor = 0.0;
72
73
    /**
74
     * Options constructor.
75
     * @param int $initial
76
     * @param int $overall
77
     * @param int $maxIdle
78
     * @param int $minIdle
79
     * @param int $idleTimeout
80
     * @param int $recyclingInv
81
     * @param int $heartbeatInv
82
     * @param int $getWaitQMax
83
     * @param int $getWaitTimeout
84
     * @param float $scaleFactor
85
     */
86
    public function __construct(
87
        int $initial = 1,
88
        int $overall = 32,
89
        int $maxIdle = 4,
90
        int $minIdle = 2,
91
        int $idleTimeout = 65,
92
        int $recyclingInv = 15,
93
        int $heartbeatInv = 0,
94
        int $getWaitQMax = 15000,
95
        int $getWaitTimeout = 2000,
96
        float $scaleFactor = 0.008
97
    ) {
98
        $this->initial = $initial;
99
        $this->overall = $overall;
100
        $this->maxIdle = $maxIdle;
101
        $this->minIdle = $minIdle;
102
        $this->idleTimeout = $idleTimeout;
103
        $this->icInterval = $recyclingInv;
104
        $this->hbInterval = $heartbeatInv;
105
        $this->getWaitQMax = $getWaitQMax;
106
        $this->getWaitTimeout = $getWaitTimeout;
107
        $this->scaleFactor = $scaleFactor;
108
    }
109
}
110