Skip to content

Commit fb51560

Browse files
committed
some update
1 parent 82ba9a3 commit fb51560

File tree

3 files changed

+29
-19
lines changed

3 files changed

+29
-19
lines changed

src/io/Input.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public function get($name, $default = null)
181181
*/
182182
public function getRequiredArg($name)
183183
{
184-
if (isset($this->args[$name])) {
184+
if ('' !== $this->get($name, '')) {
185185
return $this->args[$name];
186186
}
187187

src/traits/FormatOutputTrait.php

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,81 +134,90 @@ public function progressBar($total, array $opts = [])
134134
* @param string|null $type
135135
* @param string $style
136136
* @param int|boolean $quit If is int, setting it is exit code.
137+
* @return int
137138
*/
138139
public function block($messages, $type = 'MESSAGE', $style = Style::NORMAL, $quit = false)
139140
{
140-
Show::block($messages, $type, $style, $quit);
141+
return Show::block($messages, $type, $style, $quit);
141142
}
142143

143144
/**
144145
* @param mixed $messages
145146
* @param bool $quit
147+
* @return int
146148
*/
147149
public function primary($messages, $quit = false)
148150
{
149-
$this->block($messages, 'IMPORTANT', Style::PRIMARY, $quit);
151+
return $this->block($messages, 'IMPORTANT', Style::PRIMARY, $quit);
150152
}
151153

152154
/**
153155
* @param mixed $messages
154156
* @param bool $quit
157+
* @return int
155158
*/
156159
public function success($messages, $quit = false)
157160
{
158-
$this->block($messages, 'SUCCESS', Style::SUCCESS, $quit);
161+
return $this->block($messages, 'SUCCESS', Style::SUCCESS, $quit);
159162
}
160163

161164
/**
162165
* @param mixed $messages
163166
* @param bool $quit
167+
* @return int
164168
*/
165169
public function info($messages, $quit = false)
166170
{
167-
$this->block($messages, 'INFO', Style::INFO, $quit);
171+
return $this->block($messages, 'INFO', Style::INFO, $quit);
168172
}
169173

170174
/**
171175
* @param mixed $messages
172176
* @param bool $quit
177+
* @return int
173178
*/
174179
public function note($messages, $quit = false)
175180
{
176-
$this->block($messages, 'NOTE', Style::INFO, $quit);
181+
return $this->block($messages, 'NOTE', Style::INFO, $quit);
177182
}
178183

179184
/**
180185
* @param mixed $messages
181186
* @param bool $quit
187+
* @return int
182188
*/
183189
public function notice($messages, $quit = false)
184190
{
185-
$this->block($messages, 'NOTICE', Style::COMMENT, $quit);
191+
return $this->block($messages, 'NOTICE', Style::COMMENT, $quit);
186192
}
187193

188194
/**
189195
* @param mixed $messages
190196
* @param bool $quit
197+
* @return int
191198
*/
192199
public function warning($messages, $quit = false)
193200
{
194-
$this->block($messages, 'WARNING', Style::WARNING, $quit);
201+
return $this->block($messages, 'WARNING', Style::WARNING, $quit);
195202
}
196203

197204
/**
198205
* @param mixed $messages
199206
* @param bool $quit
207+
* @return int
200208
*/
201209
public function danger($messages, $quit = false)
202210
{
203-
$this->block($messages, 'DANGER', Style::DANGER, $quit);
211+
return $this->block($messages, 'DANGER', Style::DANGER, $quit);
204212
}
205213

206214
/**
207215
* @param mixed $messages
208216
* @param bool $quit
217+
* @return int
209218
*/
210219
public function error($messages, $quit = false)
211220
{
212-
$this->block($messages, 'ERROR', Style::ERROR, $quit);
221+
return $this->block($messages, 'ERROR', Style::ERROR, $quit);
213222
}
214223
}

src/utils/Show.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class Show
5656
* @param string|null $type
5757
* @param string $style
5858
* @param int|boolean $quit If is int, setting it is exit code.
59+
* @return int
5960
*/
6061
public static function block($messages, $type = 'MESSAGE', $style = Style::NORMAL, $quit = false)
6162
{
@@ -74,47 +75,47 @@ public static function block($messages, $type = 'MESSAGE', $style = Style::NORMA
7475
}
7576

7677
// $this->write($text);
77-
self::write($text, true, $quit);
78+
return self::write($text, true, $quit);
7879
}
7980

8081
public static function primary($messages, $quit = false)
8182
{
82-
static::block($messages, 'IMPORTANT', Style::PRIMARY, $quit);
83+
return static::block($messages, 'IMPORTANT', Style::PRIMARY, $quit);
8384
}
8485

8586
public static function success($messages, $quit = false)
8687
{
87-
static::block($messages, 'SUCCESS', Style::SUCCESS, $quit);
88+
return static::block($messages, 'SUCCESS', Style::SUCCESS, $quit);
8889
}
8990

9091
public static function info($messages, $quit = false)
9192
{
92-
static::block($messages, 'INFO', Style::INFO, $quit);
93+
return static::block($messages, 'INFO', Style::INFO, $quit);
9394
}
9495

9596
public static function note($messages, $quit = false)
9697
{
97-
static::block($messages, 'NOTE', Style::INFO, $quit);
98+
return static::block($messages, 'NOTE', Style::INFO, $quit);
9899
}
99100

100101
public static function notice($messages, $quit = false)
101102
{
102-
static::block($messages, 'NOTICE', Style::COMMENT, $quit);
103+
return static::block($messages, 'NOTICE', Style::COMMENT, $quit);
103104
}
104105

105106
public static function warning($messages, $quit = false)
106107
{
107-
static::block($messages, 'WARNING', Style::WARNING, $quit);
108+
return static::block($messages, 'WARNING', Style::WARNING, $quit);
108109
}
109110

110111
public static function danger($messages, $quit = false)
111112
{
112-
static::block($messages, 'DANGER', Style::DANGER, $quit);
113+
return static::block($messages, 'DANGER', Style::DANGER, $quit);
113114
}
114115

115116
public static function error($messages, $quit = false)
116117
{
117-
static::block($messages, 'ERROR', Style::ERROR, $quit);
118+
return static::block($messages, 'ERROR', Style::ERROR, $quit);
118119
}
119120

120121
/////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)