Completed
Push — master ( 44198b...431447 )
by Derek
03:47 queued 01:34
created

System::initialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
nc 1
cc 1
eloc 3
nop 0
crap 1
1
<?php
2
3
namespace Subreality\Dilmun\Nabu\LoggerHandler;
4
5
/**
6
 * Class System
7
 *
8
 * Simple log handler that writes to the system log using error_log.
9
 *
10
 * @package Subreality\Dilmun\Nabu\LoggerHandler
11
 *
12
 * @see error_log()
13
 */
14
class System extends AbstractHandler
15
{
16
    /**
17
     * @return bool
18
     *
19
     * @todo Find some way to suppress this as needed
0 ignored issues
show
Coding Style introduced by
Comment refers to a TODO task

This check looks TODO comments that have been left in the code.

``TODO``s show that something is left unfinished and should be attended to.

Loading history...
20
     */
21 3
    public function initialize()
22
    {
23 3
        $initialize_status = error_log("Initializing System logger.");
24
25 3
        return $initialize_status;
26
    }
27
28
    /**
29
     * Writes to the configured PHP error logger.
30
     *
31
     * @see error_log()
32
     *
33
     * @param string $message   Message to be written to PHP's system log
34
     * @return bool             Returns the status from the error_log function
35
     */
36 4
    public function write($message)
37
    {
38 4
        $written = false;
39
40 4
        if ($this->output_allowed) {
41 3
            $written = error_log($message);
42 3
        }
43
44 4
        return $written;
45
    }
46
}
47