1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of CaptainHook. |
4
|
|
|
* |
5
|
|
|
* (c) Sebastian Feldmann <[email protected]> |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
*/ |
10
|
|
|
namespace sebastianfeldmann\CaptainHook\Console\IO; |
11
|
|
|
|
12
|
|
|
use Composer\IO\IOInterface; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Class ComposerIO |
16
|
|
|
* |
17
|
|
|
* @package CaptainHook |
18
|
|
|
* @author Sebastian Feldmann <[email protected]> |
19
|
|
|
* @link https://github.com/sebastianfeldmann/captainhook |
20
|
|
|
* @since Class available since Release 0.9.0 |
21
|
|
|
*/ |
22
|
|
|
class ComposerIO extends Base |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* @var \Composer\IO\IOInterface |
26
|
|
|
*/ |
27
|
|
|
private $io; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* ComposerIO constructor. |
31
|
|
|
* |
32
|
|
|
* @param \Composer\IO\IOInterface $io |
33
|
|
|
*/ |
34
|
10 |
|
public function __construct(IOInterface $io) |
35
|
|
|
{ |
36
|
10 |
|
$this->io = $io; |
37
|
10 |
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* {@inheritDoc} |
41
|
|
|
*/ |
42
|
1 |
|
public function isInteractive() |
43
|
|
|
{ |
44
|
1 |
|
return $this->io->isInteractive(); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* {@inheritDoc} |
49
|
|
|
*/ |
50
|
1 |
|
public function isVerbose() |
51
|
|
|
{ |
52
|
1 |
|
return $this->io->isVerbose(); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* {@inheritDoc} |
57
|
|
|
*/ |
58
|
1 |
|
public function isVeryVerbose() |
59
|
|
|
{ |
60
|
1 |
|
return $this->io->isVeryVerbose(); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* {@inheritDoc} |
65
|
|
|
*/ |
66
|
1 |
|
public function isDebug() |
67
|
|
|
{ |
68
|
1 |
|
return $this->io->isDebug(); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* {@inheritDoc} |
73
|
|
|
*/ |
74
|
2 |
|
public function write($messages, $newline = true, $verbosity = self::NORMAL) |
75
|
|
|
{ |
76
|
2 |
|
$this->io->write($messages, $newline, $verbosity); |
77
|
2 |
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* {@inheritDoc} |
81
|
|
|
*/ |
82
|
1 |
|
public function writeError($messages, $newline = true, $verbosity = self::NORMAL) |
83
|
|
|
{ |
84
|
1 |
|
$this->io->writeError($messages, $newline, $verbosity); |
85
|
1 |
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* {@inheritDoc} |
89
|
|
|
*/ |
90
|
2 |
|
public function ask($question, $default = null) |
91
|
|
|
{ |
92
|
2 |
|
return $this->io->ask($question, $default); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* {@inheritDoc} |
97
|
|
|
*/ |
98
|
1 |
|
public function askConfirmation($question, $default = true) |
99
|
|
|
{ |
100
|
1 |
|
return $this->io->askConfirmation($question, $default); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* {@inheritDoc} |
105
|
|
|
*/ |
106
|
1 |
|
public function askAndValidate($question, $validator, $attempts = null, $default = null) |
107
|
|
|
{ |
108
|
1 |
|
return $this->io->askAndValidate($question, $validator, $attempts, $default); |
109
|
|
|
} |
110
|
|
|
} |
111
|
|
|
|