DebugManager::setPathToLogFile()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @author stev leibelt <[email protected]>
4
 * @since 2015-07-03
5
 */
6
7
namespace Net\Bazzline\Component\Cli\Readline;
8
9
//use reflection instead of extends, add logging before each method call
10
class DebugManager extends Manager
11
{
12
    /** @var string */
13
    private $pathToLogFile;
14
15
    /**
16
     * @param string $path
17
     * @return $this
18
     */
19
    public function setPathToLogFile($path)
20
    {
21
        $this->pathToLogFile = $path;
22
        file_put_contents($this->pathToLogFile, '');    //truncating log
23
24
        return $this;
25
    }
26
27
    /**
28
     * @param mixed $message
29
     * @return int
30
     */
31
    private function log($message)
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
32
    {
33
        $message = (is_scalar($message)) ? $message : var_export($message, true);
34
35
        return file_put_contents($this->pathToLogFile, $message . PHP_EOL, FILE_APPEND);
36
    }
37
}