Completed
Push — master ( d7f2fe...303bad )
by Taosikai
11:51
created

ClientTerminateEvent   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 53
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getClosedBy() 0 4 1
A getClient() 0 4 1
A getChunkServers() 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\Event;
13
14
use Slince\EventDispatcher\Event;
15
use Spike\Client\ClientInterface;
16
use Spike\Server\ChunkServer\ChunkServerInterface;
17
18
class ClientTerminateEvent extends Event
19
{
20
    const CLOSED_BY_REMOTE = 'remote';
21
22
    const CLOSED_BY_TIMER = 'timer';
23
24
    /**
25
     * @var ClientInterface
26
     */
27
    protected $client;
28
29
    /**
30
     * @var ChunkServerInterface[]
31
     */
32
    protected $chunkServers;
33
34
    /**
35
     * @var string
36
     */
37
    protected $closedBy;
38
39
    public function __construct(ClientInterface $client, $chunkServers, $closedBy)
40
    {
41
        $this->client = $client;
42
        $this->chunkServers = $chunkServers;
43
        $this->closedBy = $closedBy;
44
        parent::__construct(Events::CLIENT_CLOSE);
45
    }
46
47
    /**
48
     * @return string
49
     */
50
    public function getClosedBy()
51
    {
52
        return $this->closedBy;
53
    }
54
55
    /**
56
     * @return ClientInterface
57
     */
58
    public function getClient()
59
    {
60
        return $this->client;
61
    }
62
63
    /**
64
     * @return ChunkServerInterface[]
65
     */
66
    public function getChunkServers()
67
    {
68
        return $this->chunkServers;
69
    }
70
}