Completed
Push — master ( ac3cad...7fabe3 )
by Artem
03:23
created

RollbarHelperTrait::sendMessageToRollbar()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
rs 9.4285
nc 2
cc 2
eloc 4
nop 2
1
<?php
2
/*
3
 * This file is part of the FreshCommonApiBundle
4
 *
5
 * (c) Artem Genvald <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Fresh\CommonApiBundle\Helper\Logger;
12
13
/**
14
 * RollbarHelperTrait.
15
 *
16
 * @author Artem Genvald <[email protected]>
17
 */
18
trait RollbarHelperTrait
19
{
20
    use BaseLoggerTrait;
21
22
    /**
23
     * Send exception to Rollbar.
24
     *
25
     * @param \Exception $e Exception
26
     */
27
    protected function sendExceptionToRollbar(\Exception $e)
28
    {
29
        if ($this->has('ftrrtf_rollbar.notifier')) {
30
            /** @var \Ftrrtf\Rollbar\Notifier $rollbarNotifier */
31
            $rollbarNotifier = $this->get('ftrrtf_rollbar.notifier');
32
            $rollbarNotifier->reportException($e);
33
        }
34
    }
35
36
    /**
37
     * Send message to Rollbar.
38
     *
39
     * @param string $message Message
40
     * @param string $level   Level
41
     */
42
    protected function sendMessageToRollbar($message, $level)
43
    {
44
        if ($this->has('ftrrtf_rollbar.notifier')) {
45
            /** @var \Ftrrtf\Rollbar\Notifier $rollbarNotifier */
46
            $rollbarNotifier = $this->get('ftrrtf_rollbar.notifier');
47
            $rollbarNotifier->reportMessage($message, $level);
48
        }
49
    }
50
}
51