Completed
Branch query_logging_to_events (025608)
by Alessandro
02:17
created

ConnectionEvent   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 39
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getConnectionClient() 0 4 1
A getClientName() 0 4 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Facile\MongoDbBundle\Event;
6
7
use MongoDB\Client;
8
use Symfony\Component\EventDispatcher\GenericEvent;
9
10
/**
11
 * Class ConnectionEvent.
12
 */
13
class ConnectionEvent extends GenericEvent
14
{
15
    const CLIENT_CREATED = 'facile_mongo_db.event.connection_client.created';
16
17
    /** @var string */
18
    private $clientName;
19
20
    /**
21
     * ConnectionEvent constructor.
22
     *
23
     * @param Client $client
24
     * @param string $clientName
25
     * @param array  $arguments
26
     */
27 9
    public function __construct(Client $client, string $clientName, array $arguments = [])
28
    {
29 9
        parent::__construct($client, $arguments);
30
31 9
        $this->clientName = $clientName;
32 9
    }
33
34
    /**
35
     * @return Client
36
     */
37
    public function getConnectionClient(): Client
38
    {
39
        return $this->getSubject();
40
    }
41
42
    /**
43
     * @return string
44
     */
45 2
    public function getClientName(): string
46
    {
47 2
        return $this->clientName;
48
    }
49
50
51
}
52