NewRelicDispatcher   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 32
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A fire() 0 7 1
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