Completed
Push — master ( a10ad6...262a1e )
by Russell
20:23
created

SentryClientAdaptor   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getOpts() 0 10 2
setData() 0 1 ?
getLevel() 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
use SilverStripe\Core\Config\Config;
13
14
/**
15
 * The SentryClientAdaptor provides the base-class functionality for subclasses
16
 * to act as bridges between the PHP SDK and the SentryLogWriter class itself.
17
 * Any {@link SentryClientAdaptor} subclass should be able to be swapped-out and
18
 * used at any point.
19
 */
20
21
abstract class SentryClientAdaptor
22
{
23
24
    /**
25
     * @param  mixed $opt
26
     * @return mixed
27
     */ 
28
    protected function getOpts($opt)
29
    {
30
        $opts = Config::inst()->get(__CLASS__, 'opts');
31
32
        if (!empty($opts[$opt])) {
33
            return $opts[$opt];
34
        }
35
36
        return null;
37
    }
38
39
    /**
40
     * Set the data we need from the writer.
41
     *
42
     * @param string                 $field
43
     * @param mixed (string | array) $data
44
     */
45
    abstract public function setData($field, $data);
46
    
47
    /**
48
     * @return string
49
     */
50
    abstract public function getLevel($level);
51
    
52
}
53