Completed
Push — master ( 143878...f45699 )
by Taosikai
14:33
created

ReviewPublicConnection   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 8 3
A isPeriodic() 0 4 1
A getInterval() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the slince/spike package.
5
 *
6
 * (c) Slince <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Spike\Server\ChunkServer\Timer;
13
14
/**
15
 * @codeCoverageIgnore
16
 */
17
class ReviewPublicConnection extends Timer
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function __invoke()
23
    {
24
        foreach ($this->chunkServer->getPublicConnections() as $publicConnection) {
25
            if ($publicConnection->getWaitingDuration() > 120) {
26
                $this->chunkServer->closePublicConnection($publicConnection, 'Waiting for more than 60 seconds without responding');
27
            }
28
        }
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function isPeriodic()
35
    {
36
        return true;
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function getInterval()
43
    {
44
        return  60 * 1;
45
    }
46
}