Completed
Branch 0.4-dev (d01bc8)
by Evgenij
05:19 queued 02:49
created

Context   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 44
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getUnreadData() 0 4 1
A setUnreadData() 0 4 1
A reset() 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
namespace AsyncSockets\Socket\Io;
11
12
/**
13
 * Class Context
14
 */
15
class Context
16
{
17
    /**
18
     * Unread data in socket
19
     *
20
     * @var string
21
     */
22
    private $unreadData = ['', ''];
23
24
    /**
25
     * Return UnreadData
26
     *
27
     * @param bool $isOutOfBand Flag if it is out of band data
28
     *
29
     * @return string
30
     */
31
    public function getUnreadData($isOutOfBand = false)
32
    {
33
        return $this->unreadData[(int) (bool) $isOutOfBand];
34
    }
35
36
    /**
37
     * Sets UnreadData
38
     *
39
     * @param string $unreadData New value for UnreadData
40
     * @param bool $isOutOfBand Flag if it is out of band data
41
     *
42
     * @return void
43
     */
44
    public function setUnreadData($unreadData, $isOutOfBand = false)
45
    {
46
        $this->unreadData[(int) (bool) $isOutOfBand] = $unreadData;
47
    }
48
49
    /**
50
     * Resets socket context
51
     *
52
     * @return void
53
     */
54
    public function reset()
55
    {
56
        $this->unreadData = ['', ''];
0 ignored issues
show
Documentation Bug introduced by
It seems like array('', '') of type array<integer,string,{"0":"string","1":"string"}> is incompatible with the declared type string of property $unreadData.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
57
    }
58
}
59