1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
<?php
// Hand-written proxy stub for Composer\IO\BaseIO, kept in the shape the future stub generator
// will output: every public method of the real class (its own and the IOInterface /
// LoggerInterface surface) forwards to the Rust-side entity. Loading this stub pulls the real
// IOInterface contract from the Composer PHP runtime, which must already be required.
namespace Composer\IO;
use Composer\Config;
abstract class BaseIO implements IOInterface, \ShirabeRustStub
{
/** @var int */
protected $__rhandle;
/** @var int */
protected $__epoch;
public function __construct(int $rhandle = 0, int $epoch = 0)
{
if (func_num_args() < 2) {
// Constructing the class from plugin code (a common idiom for e.g. `new BufferIO()`)
// is an open question of the plugin design; only proxy instantiation passes a
// Rust handle. Fail with a diagnosable message instead of an ArgumentCountError.
throw new \RuntimeException(
'Shirabe does not support constructing ' . static::class . ' inside the plugin process yet'
);
}
$this->__rhandle = $rhandle;
$this->__epoch = $epoch;
}
public function __destruct()
{
\ShirabeRustObjectRegistry::release($this->__rhandle);
}
public function __shirabeRustHandleDescriptor(): array
{
return [
'__rhandle' => $this->__rhandle,
'__class' => static::class,
'__epoch' => $this->__epoch,
];
}
public function isInteractive()
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'isInteractive', []);
}
public function isVerbose()
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'isVerbose', []);
}
public function isVeryVerbose()
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'isVeryVerbose', []);
}
public function isDebug()
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'isDebug', []);
}
public function isDecorated()
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'isDecorated', []);
}
public function write($messages, bool $newline = true, int $verbosity = self::NORMAL)
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'write', [$messages, $newline, $verbosity]);
}
public function writeError($messages, bool $newline = true, int $verbosity = self::NORMAL)
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'writeError', [$messages, $newline, $verbosity]);
}
public function writeRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'writeRaw', [$messages, $newline, $verbosity]);
}
public function writeErrorRaw($messages, bool $newline = true, int $verbosity = self::NORMAL)
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'writeErrorRaw', [$messages, $newline, $verbosity]);
}
public function overwrite($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL)
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'overwrite', [$messages, $newline, $size, $verbosity]);
}
public function overwriteError($messages, bool $newline = true, ?int $size = null, int $verbosity = self::NORMAL)
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'overwriteError', [$messages, $newline, $size, $verbosity]);
}
public function ask(string $question, $default = null)
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'ask', [$question, $default]);
}
public function askConfirmation(string $question, bool $default = true)
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'askConfirmation', [$question, $default]);
}
public function askAndValidate(string $question, callable $validator, ?int $attempts = null, $default = null)
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'askAndValidate', [$question, $validator, $attempts, $default]);
}
public function askAndHideAnswer(string $question)
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'askAndHideAnswer', [$question]);
}
public function select(string $question, array $choices, $default, $attempts = false, string $errorMessage = 'Value "%s" is invalid', bool $multiselect = false)
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'select', [$question, $choices, $default, $attempts, $errorMessage, $multiselect]);
}
public function getAuthentications()
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'getAuthentications', []);
}
public function resetAuthentications()
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'resetAuthentications', []);
}
public function hasAuthentication(string $repositoryName)
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'hasAuthentication', [$repositoryName]);
}
public function getAuthentication(string $repositoryName)
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'getAuthentication', [$repositoryName]);
}
public function setAuthentication(string $repositoryName, string $username, ?string $password = null)
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'setAuthentication', [$repositoryName, $username, $password]);
}
public function loadConfiguration(Config $config)
{
return \ShirabeRpcRuntime::callRust($this->__rhandle, 'loadConfiguration', [$config]);
}
public function emergency($message, array $context = []): void
{
\ShirabeRpcRuntime::callRust($this->__rhandle, 'emergency', [$message, $context]);
}
public function alert($message, array $context = []): void
{
\ShirabeRpcRuntime::callRust($this->__rhandle, 'alert', [$message, $context]);
}
public function critical($message, array $context = []): void
{
\ShirabeRpcRuntime::callRust($this->__rhandle, 'critical', [$message, $context]);
}
public function error($message, array $context = []): void
{
\ShirabeRpcRuntime::callRust($this->__rhandle, 'error', [$message, $context]);
}
public function warning($message, array $context = []): void
{
\ShirabeRpcRuntime::callRust($this->__rhandle, 'warning', [$message, $context]);
}
public function notice($message, array $context = []): void
{
\ShirabeRpcRuntime::callRust($this->__rhandle, 'notice', [$message, $context]);
}
public function info($message, array $context = []): void
{
\ShirabeRpcRuntime::callRust($this->__rhandle, 'info', [$message, $context]);
}
public function debug($message, array $context = []): void
{
\ShirabeRpcRuntime::callRust($this->__rhandle, 'debug', [$message, $context]);
}
public function log($level, $message, array $context = []): void
{
\ShirabeRpcRuntime::callRust($this->__rhandle, 'log', [$level, $message, $context]);
}
}
|