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

SentryClientAdaptor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 43
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getOpts() 0 10 3
setData() 0 1 ?
getLevel() 0 1 ?
send() 0 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