Pooling::pooling()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Options of pooling
4
 * User: moyo
5
 * Date: 19/10/2017
6
 * Time: 3:19 PM
7
 */
8
9
namespace Carno\HTTP\Client\Options;
10
11
use Carno\Pool\Options;
12
13
trait Pooling
14
{
15
    /**
16
     * @var Options
17
     */
18
    private $pool = null;
19
20
    /**
21
     * @var string
22
     */
23
    private $identify = null;
24
25
    /**
26
     * @param Options $options
27
     * @param string $identify
28
     * @return static
29
     */
30
    public function keepalive(Options $options, string $identify = 'http') : self
31
    {
32
        $this->pool = $options;
33
        $this->identify = $identify;
34
        return $this;
35
    }
36
37
    /**
38
     * @return bool
39
     */
40
    public function pooled() : bool
41
    {
42
        return $this->pool ? true : false;
43
    }
44
45
    /**
46
     * @return Options
47
     */
48
    public function pooling() : Options
49
    {
50
        return $this->pool;
51
    }
52
53
    /**
54
     * @return string
55
     */
56
    public function identify() : string
57
    {
58
        return $this->identify;
59
    }
60
}
61