Completed
Push — master ( 77ca8c...c3922c )
by Dmitry
01:15
created

MockLogger::show_error_log()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 *      Mock class for logging
5
 *
6
 *      @package debulog
7
 *      @version 1.0
8
 *      @author Dmitry Shovchko <[email protected]>
9
 */
10
11
namespace Debulog;
12
13
class MockLogger extends Logger
14
{
15
    /**
16
     *      @var array
17
     */
18
    protected $_add;
19
20
    /**
21
     *      @var array
22
     */
23
    protected $_error;
24
25
    /**
26
     *      @var array
27
     */
28
    protected $_debug;
29
30
    /**
31
     *      Logger constructor
32
     *
33
     */
34
    public function __construct(){}
35
36
    /**
37
     *      Add message to logger buffer
38
     *
39
     *      @param string $message Message text
40
     *
41
     */
42
    public function add($message)
43
    {
44
        $this->_add[] = $message;
45
    }
46
47
    /**
48
     *      Show data in log
49
     *
50
     *      @return array
51
     */
52
    public function show_log()
53
    {
54
        return $this->_add;
55
    }
56
57
    /**
58
     *      Add error message to logger buffer
59
     *
60
     *      @param string $message Message text
61
     *
62
     */
63
    public function error($message)
64
    {
65
        $this->_error[] = $message;
66
    }
67
68
    /**
69
     *      Show data in error_log
70
     *
71
     *      @return array
72
     */
73
    public function show_error_log()
74
    {
75
        return $this->_error;
76
    }
77
78
    /**
79
     *      Add debug message to logger buffer
80
     *
81
     *      @param string $message Message to log
82
     *
83
     */
84
    public function debug($message)
85
    {
86
        $this->_debug[] = $message;
87
    }
88
89
    /**
90
     *      Show data in debug_log
91
     *
92
     *      @return array
93
     */
94
    public function show_debug_log()
95
    {
96
        return $this->_debug;
97
    }
98
99
    /**
100
     *      Sync all buffers to files
101
     *
102
     */
103
    public function sync()
104
    {
105
        $this->_add[] = array();
106
        $this->_error[] = array();
107
        $this->_debug[] = array();
108
    }
109
}
110