AmplitudeDriver::sendEvent()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
4
namespace LaravelAmplitude\Drivers;
5
6
7
use Zumba\Amplitude\Amplitude;
8
9
class AmplitudeDriver implements AmplitudeDriverInterface
10
{
11
    /** @var Amplitude */
12
    private $instance;
13
14
    /**
15
     * @param Amplitude $instance
16
     */
17
    public function __construct(Amplitude $instance)
18
    {
19
        $this->instance = $instance;
20
    }
21
22
    public function init($apiKey)
23
    {
24
        $this->instance->init($apiKey);
25
    }
26
27
    public function setUserId($userId)
28
    {
29
        $this->instance->setUserId($userId);
30
    }
31
32
    public function setUserProperties($userProperties)
33
    {
34
        $this->instance->setUserProperties($userProperties);
35
    }
36
37
    public function sendEvent($name, $properties)
38
    {
39
        $this->instance->logEvent(
40
            $name,
41
            $properties
42
        );
43
    }
44
45
    public function queueEvent($name, $properties)
46
    {
47
        $this->instance->queueEvent($name, $properties);
48
    }
49
50
    public function sendQueuedEvents()
51
    {
52
        $this->instance->logQueuedEvents();
53
    }
54
55
    public function getDriverName()
56
    {
57
        return 'amplitude';
58
    }
59
}
60