Completed
Branch 0.4-dev (999b58)
by Evgenij
18:41
created

SelectContext   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 4
c 3
b 0
f 0
lcom 0
cbo 0
dl 0
loc 67
ccs 8
cts 8
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getRead() 0 4 1
A getWrite() 0 4 1
A getOob() 0 4 1
1
<?php
2
/**
3
 * Async sockets
4
 *
5
 * @copyright Copyright (c) 2015-2016, Efimov Evgenij <[email protected]>
6
 *
7
 * This source file is subject to the MIT license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace AsyncSockets\Socket;
12
13
/**
14
 * Class SelectContext
15
 */
16
class SelectContext
17
{
18
    /**
19
     * List os sockets ready to read
20
     *
21
     * @var StreamResourceInterface[]
22
     */
23
    private $read;
24
25
    /**
26
     * List of sockets ready to write
27
     *
28
     * @var StreamResourceInterface[]
29
     */
30
    private $write;
31
32
    /**
33
     * array
34
     *
35
     * @var array
36
     */
37
    private $oob;
38 67
39
    /**
40 67
     * Constructor
41 67
     *
42 67
     * @param StreamResourceInterface[] $read List of ready to read sockets
43
     * @param StreamResourceInterface[] $write List of ready to write sockets
44
     * @param StreamResourceInterface[] $oob List of sockets having OOB data
45
     */
46
    public function __construct(array $read, array $write, array $oob)
47
    {
48
        $this->read  = $read;
49 66
        $this->write = $write;
50
        $this->oob   = $oob;
51 66
    }
52
53
    /**
54
     * Get ready to read sockets
55
     *
56
     * @return StreamResourceInterface[]
57
     */
58
    public function getRead()
59 65
    {
60
        return $this->read;
61 65
    }
62
63
    /**
64
     * Get ready to write sockets
65
     *
66
     * @return StreamResourceInterface[]
67
     */
68
    public function getWrite()
69
    {
70
        return $this->write;
71
    }
72
73
    /**
74
     * Return sockets having OOB data
75
     *
76
     * @return StreamResourceInterface[]
77
     */
78
    public function getOob()
79
    {
80
        return $this->oob;
81
    }
82
}
83