Completed
Push — master ( f3f57f...c0b774 )
by François
02:05
created

AccessWatchHttpLogger::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 2
eloc 3
nc 2
nop 1
1
<?php
2
3
/*
4
 * This file is part of the Bouncer package.
5
 *
6
 * (c) François Hodierne <[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 Bouncer\Logger;
13
14
use Bouncer\Identity;
15
use Bouncer\Request;
16
17
/**
18
 * Log Connections on the Access Watch Cloud Service using the HTTP protocol
19
 *
20
 * @author François Hodierne <[email protected]>
21
 */
22
class AccessWatchHttpLogger extends HttpLogger
23
{
24
25
    protected $endpoint = 'http://access.watch/api/v1/log';
26
27
    protected $key;
28
29
    public function __construct($params = [])
30
    {
31
        if (isset($params['apiKey'])) {
32
            $this->key = $params['apiKey'];
33
        }
34
    }
35
36
    /**
37
     * {@inheritDoc}
38
     */
39
    public function log($connection, Identity $identity, Request $request)
40
    {
41
        if ($this->key) {
42
            $connection['key'] = $this->key;
43
        }
44
45
        parent::log($connection, $identity, $request);
46
    }
47
48
}
49