NewRelicDispatcher::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace ErsoyInsider\NewrelicCustomEvent\Services;
4
5
use ErsoyInsider\NewrelicCustomEvent\Events\CustomEvent;
6
use Illuminate\Config\Repository as Config;
7
use Illuminate\Events\Dispatcher;
8
9
class NewRelicDispatcher
10
{
11
    /**
12
     * @var Config
13
     */
14
    private $config;
15
    /**
16
     * @var Dispatcher
17
     */
18
    private $dispatcher;
19
20
    /**
21
     * Foobar constructor.
22
     * @param Config $config
23
     * @param Dispatcher $dispatcher
24
     */
25
    public function __construct(Config $config, Dispatcher $dispatcher)
26
    {
27
        $this->config = $config;
28
        $this->dispatcher = $dispatcher;
29
    }
30
31
    /**
32
     * @param array $properties
33
     */
34
    public function fire(array $properties)
35
    {
36
        $this->dispatcher->dispatch(
37
            new CustomEvent(
38
                $properties,
39
                $this->config->get('new-relic-custom-event.event_type'),
40
                $this->config->get('new-relic-custom-event.app_name')
41
            )
42
        );
43
    }
44
}
45