StringOutput   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getContent() 0 3 1
A doWrite() 0 3 2
A clear() 0 3 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: sheldon
5
 * Date: 18-4-19
6
 * Time: 下午2:23.
7
 */
8
9
namespace Yeelight\Models\Tools\Terminal;
10
11
use Symfony\Component\Console\Output\Output;
12
13
/**
14
 * Class StringOutput
15
 *
16
 * @category Yeelight
17
 *
18
 * @package Yeelight\Models\Tools\Terminal
19
 *
20
 * @author Sheldon Lee <[email protected]>
21
 *
22
 * @license https://opensource.org/licenses/MIT MIT
23
 *
24
 * @link https://www.yeelight.com
25
 */
26
class StringOutput extends Output
27
{
28
    public $output = '';
29
30
    public function clear()
31
    {
32
        $this->output = '';
33
    }
34
35
    protected function doWrite($message, $newline)
36
    {
37
        $this->output .= $message.($newline ? "\n" : '');
38
    }
39
40
    public function getContent()
41
    {
42
        return trim($this->output);
43
    }
44
}
45