LogIO   A
last analyzed

Complexity

Total Complexity 17

Size/Duplication

Total Lines 129
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
c 1
b 0
f 0
dl 0
loc 129
rs 10
wmc 17

17 Methods

Rating   Name   Duplication   Size   Complexity  
A isDebug() 0 3 1
A isInteractive() 0 3 1
A __construct() 0 3 1
A writeError() 0 3 1
A getLogs() 0 3 1
A select() 0 3 1
A overwrite() 0 3 1
A overwriteError() 0 3 1
A askConfirmation() 0 3 1
A isVeryVerbose() 0 3 1
A write() 0 3 1
A askAndValidate() 0 3 1
A isDecorated() 0 3 1
A append() 0 3 1
A isVerbose() 0 3 1
A askAndHideAnswer() 0 3 1
A ask() 0 3 1
1
<?php
2
3
namespace App\Composer;
4
5
use Composer\IO\BaseIO;
6
7
class LogIO extends BaseIO
8
{
9
    private $logs;
10
11
    public function __construct()
12
    {
13
        $this->logs = '';
14
    }
15
16
    public function getLogs(): string
17
    {
18
        return $this->logs;
19
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function isInteractive()
25
    {
26
        return false;
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function isVerbose()
33
    {
34
        return true;
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function isVeryVerbose()
41
    {
42
        return true;
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function isDebug()
49
    {
50
        return true;
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function isDecorated()
57
    {
58
        return true;
59
    }
60
61
    /**
62
     * {@inheritdoc}
63
     */
64
    public function write($messages, $newline = true, $verbosity = self::NORMAL)
65
    {
66
        $this->append($messages, 'info');
67
    }
68
69
    /**
70
     * {@inheritdoc}
71
     */
72
    public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
73
    {
74
        $this->append($messages, 'error');
75
    }
76
77
    /**
78
     * {@inheritdoc}
79
     */
80
    public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
81
    {
82
        $this->append($messages, 'info');
83
    }
84
85
    /**
86
     * {@inheritdoc}
87
     */
88
    public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
89
    {
90
        $this->append($messages, 'error');
91
    }
92
93
    /**
94
     * {@inheritdoc}
95
     */
96
    public function ask($question, $default = null)
97
    {
98
        return $default;
99
    }
100
101
    /**
102
     * {@inheritdoc}
103
     */
104
    public function askConfirmation($question, $default = true)
105
    {
106
        return $default;
107
    }
108
109
    /**
110
     * {@inheritdoc}
111
     */
112
    public function askAndValidate($question, $validator, $attempts = null, $default = null)
113
    {
114
        return $default;
115
    }
116
117
    /**
118
     * {@inheritdoc}
119
     */
120
    public function askAndHideAnswer($question)
121
    {
122
        return null;
123
    }
124
125
    /**
126
     * {@inheritdoc}
127
     */
128
    public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
129
    {
130
        return $default;
131
    }
132
133
    private function append($messages, $class)
134
    {
135
        $this->logs .= sprintf('<p class="%s">%s</p>', $class, $messages);
136
    }
137
}
138