Completed
Push — master ( 3c4d1c...8994f7 )
by Russell
02:23
created

SentryClientAdaptor::getOpts()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 5
nc 2
nop 1
1
<?php
2
3
/**
4
 * Class: SentryClientAdaptor.
5
 *
6
 * @author  Russell Michell 2017 <[email protected]>
7
 * @package phptek/sentry
8
 */
9
10
namespace phptek\Sentry\Adaptor;
11
12
/**
13
 * The SentryClientAdaptor provides the base-class functionality for subclasses
14
 * to act as bridges between the PHP SDK and the SentryLogWriter class itself.
15
 * Any {@link SentryClientAdaptor} subclass should be able to be swapped-out and
16
 * used at any point.
17
 */
18
19
abstract class SentryClientAdaptor extends \Object
20
{
21
22
    /**
23
     * @param mixed $opt
24
     * @return mixed
25
     */
26
    protected function getOpts($opt)
27
    {
28
        $opts = $this->config()->opts;
29
30
        if (!is_null($opts) && !empty($opts[$opt])) {
31
            return $opts[$opt];
32
        }
33
34
        return null;
35
    }
36
37
    /**
38
     * Set the data we need from the writer.
39
     *
40
     * @param string                 $field
41
     * @param mixed (string | array) $data
42
     */
43
    abstract public function setData($field, $data);
44
    
45
    /**
46
     * @return string
47
     */
48
    abstract public function getLevel($level);
49
50
    /**
51
     * Physically transport the data to the configured Sentry host.
52
     *
53
     * @param  string $message
54
     * @param  array  $extras
55
     * @param  array  $data
56
     * @param  string $trace
57
     * @return mixed
58
     */
59
    abstract public function send($message, $extras = [], $data, $trace);
60
    
61
}
62