Completed
Branch query_logging_to_events (6a211d)
by Alessandro
02:15
created

ConnectionEvent   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 37
ccs 6
cts 8
cp 0.75
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
 * @internal
13
 */
14
class ConnectionEvent extends GenericEvent
15
{
16
    const CLIENT_CREATED = 'facile_mongo_db.event.connection_client.created';
17
18
    /** @var string */
19
    private $clientName;
20
21
    /**
22
     * ConnectionEvent constructor.
23
     *
24
     * @param Client $client
25
     * @param string $clientName
26
     * @param array  $arguments
27
     */
28 10
    public function __construct(Client $client, string $clientName, array $arguments = [])
29
    {
30 10
        parent::__construct($client, $arguments);
31
32 10
        $this->clientName = $clientName;
33 10
    }
34
35
    /**
36
     * @return Client
37
     */
38
    public function getConnectionClient(): Client
39
    {
40
        return $this->getSubject();
41
    }
42
43
    /**
44
     * @return string
45
     */
46 9
    public function getClientName(): string
47
    {
48 9
        return $this->clientName;
49
    }
50
}
51