DefaultLogger   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 124
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 18.18%

Importance

Changes 0
Metric Value
dl 0
loc 124
ccs 4
cts 22
cp 0.1818
rs 10
c 0
b 0
f 0
wmc 10
lcom 0
cbo 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A emergency() 0 4 1
A alert() 0 4 1
A critical() 0 4 1
A warning() 0 4 1
A notice() 0 4 1
A info() 0 4 1
A debug() 0 4 1
A log() 0 4 1
A error() 0 10 2
1
<?php namespace Arcanedev\Stripe\Utilities;
2
3
use Psr\Log\LoggerInterface;
4
5
/**
6
 * Class     DefaultLogger
7
 *
8
 * @package  Arcanedev\Stripe\Utilities
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class DefaultLogger implements LoggerInterface
12
{
13
    /* -----------------------------------------------------------------
14
     |  Main Methods
15
     | -----------------------------------------------------------------
16
     */
17
18
    /**
19
     * System is unusable.
20
     *
21
     * @param  string  $message
22
     * @param  array   $context
23
     */
24
    public function emergency($message, array $context = [])
25
    {
26
        // DO NOTHING
27
    }
28
29
    /**
30
     * Action must be taken immediately.
31
     *
32
     * Example: Entire website down, database unavailable, etc. This should
33
     * trigger the SMS alerts and wake you up.
34
     *
35
     * @param  string  $message
36
     * @param  array   $context
37
     */
38
    public function alert($message, array $context = [])
39
    {
40
        // DO NOTHING
41
    }
42
43
    /**
44
     * Critical conditions.
45
     *
46
     * Example: Application component unavailable, unexpected exception.
47
     *
48
     * @param  string  $message
49
     * @param  array   $context
50
     */
51
    public function critical($message, array $context = [])
52
    {
53
        // DO NOTHING
54
    }
55
56
    /**
57
     * Runtime errors that do not require immediate action but should typically
58
     * be logged and monitored.
59
     *
60
     * @param  string  $message
61
     * @param  array   $context
62
     */
63 2
    public function error($message, array $context = [])
64
    {
65 2
        if (count($context) > 0) {
66
            throw new \Exception(
67
                'DefaultLogger does not currently implement context. Please implement if you need it.'
68
            );
69
        }
70
71 2
        error_log($message);
72 2
    }
73
74
    /**
75
     * Exceptional occurrences that are not errors.
76
     *
77
     * Example: Use of deprecated APIs, poor use of an API, undesirable things
78
     * that are not necessarily wrong.
79
     *
80
     * @param  string  $message
81
     * @param  array   $context
82
     */
83
    public function warning($message, array $context = [])
84
    {
85
        // DO NOTHING
86
    }
87
88
    /**
89
     * Normal but significant events.
90
     *
91
     * @param  string  $message
92
     * @param  array   $context
93
     */
94
    public function notice($message, array $context = array())
95
    {
96
        // DO NOTHING
97
    }
98
99
    /**
100
     * Interesting events.
101
     *
102
     * Example: User logs in, SQL logs.
103
     *
104
     * @param  string  $message
105
     * @param  array   $context
106
     */
107
    public function info($message, array $context = [])
108
    {
109
        // DO NOTHING
110
    }
111
112
    /**
113
     * Detailed debug information.
114
     *
115
     * @param  string  $message
116
     * @param  array   $context
117
     */
118
    public function debug($message, array $context = [])
119
    {
120
        // DO NOTHING
121
    }
122
123
    /**
124
     * Logs with an arbitrary level.
125
     *
126
     * @param  mixed   $level
127
     * @param  string  $message
128
     * @param  array   $context
129
     */
130
    public function log($level, $message, array $context = [])
131
    {
132
        // DO NOTHING
133
    }
134
}
135