Skip to content

Commit 3882b81

Browse files
committed
update ....
1 parent b15716d commit 3882b81

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/io/Output.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use inhere\console\style\Style;
1212
use inhere\console\traits\FormatOutputTrait;
1313
use inhere\console\utils\Helper;
14+
use inhere\console\utils\Show;
1415

1516
/**
1617
* Class Output
@@ -99,7 +100,7 @@ public function printVars(...$args)
99100
public function getStyle(): Style
100101
{
101102
if (!$this->style) {
102-
$this->style = new Style;
103+
$this->style = Show::getStyle();
103104
}
104105

105106
return $this->style;

src/traits/FormatOutputTrait.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ public function __call($method, array $args = [])
187187
return Show::block($msg, $style === 'primary' ? 'IMPORTANT' : $style, $style, $quit);
188188
}
189189

190-
throw new \LogicException("Call a not exists method: $method");
190+
if (method_exists(Show::class, $method)) {
191+
return Show::$method(...$args);
192+
}
193+
194+
throw new \LogicException("Call a not exists method: $method of the " . static::class);
191195
}
192196
}

src/traits/SimpleEventStaticTrait.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ public static function on($event, callable $handler, $once = false)
4949
{
5050
if (self::isSupportedEvent($event)) {
5151
self::$eventHandlers[$event][] = $handler;
52-
self::$events[$event] = (bool)$once;
52+
53+
if (!isset(self::$events[$event])) {
54+
self::$events[$event] = (bool)$once;
55+
}
5356
}
5457
}
5558

0 commit comments

Comments
 (0)