support overrideLevel pour a*
This commit is contained in:
parent
02df911059
commit
3ad2859710
|
@ -54,21 +54,21 @@ interface IMessenger {
|
|||
*
|
||||
* démarrer une action le cas échéant (et la terminer aussitôt)
|
||||
*/
|
||||
function asuccess($content=null): void;
|
||||
function asuccess($content=null, ?int $overrideLevel=null): void;
|
||||
|
||||
/**
|
||||
* terminer l'action courante avec le résultat "échec"
|
||||
*
|
||||
* démarrer une action le cas échéant (et la terminer aussitôt)
|
||||
*/
|
||||
function afailure($content=null): void;
|
||||
function afailure($content=null, ?int $overrideLevel=null): void;
|
||||
|
||||
/**
|
||||
* terminer l'action courante avec le résultat "neutre"
|
||||
*
|
||||
* démarrer une action le cas échéant (et la terminer aussitôt)
|
||||
*/
|
||||
function adone($content=null): void;
|
||||
function adone($content=null, ?int $overrideLevel=null): void;
|
||||
|
||||
/** afficher une donnée non structurée */
|
||||
function print($content, ?int $level=null): void;
|
||||
|
|
|
@ -59,9 +59,9 @@ abstract class _messenger {
|
|||
static function desc($content, ?int $level=null): void { static::get()->desc($content, $level); }
|
||||
static function action($content, ?callable $func=null, ?int $level=null): void { static::get()->action($content, $func, $level); }
|
||||
static function step($content, ?int $level=null): void { static::get()->step($content, $level); }
|
||||
static function asuccess($content=null): void { static::get()->asuccess($content); }
|
||||
static function afailure($content=null): void { static::get()->afailure($content); }
|
||||
static function adone($content=null): void { static::get()->adone($content); }
|
||||
static function asuccess($content=null, ?int $override_level=null): void { static::get()->asuccess($content, $override_level); }
|
||||
static function afailure($content=null, ?int $override_level=null): void { static::get()->afailure($content, $override_level); }
|
||||
static function adone($content=null, ?int $override_level=null): void { static::get()->adone($content, $override_level); }
|
||||
static function print($content, ?int $level=null): void { static::get()->print($content, $level); }
|
||||
static function info($content, ?int $level=null): void { static::get()->info($content, $level); }
|
||||
static function note($content, ?int $level=null): void { static::get()->note($content, $level); }
|
||||
|
|
|
@ -88,9 +88,9 @@ class ProxyMessenger implements IMessenger {
|
|||
}
|
||||
}
|
||||
function step($content, ?int $level=null): void { foreach ($this->msgs as $msg) { $msg->step($content, $level); } }
|
||||
function asuccess($content=null): void { foreach ($this->msgs as $msg) { $msg->asuccess($content); } }
|
||||
function afailure($content=null): void { foreach ($this->msgs as $msg) { $msg->afailure($content); } }
|
||||
function adone($content=null): void { foreach ($this->msgs as $msg) { $msg->adone($content); } }
|
||||
function asuccess($content=null, ?int $overrideLevel=null): void { foreach ($this->msgs as $msg) { $msg->asuccess($content, $overrideLevel); } }
|
||||
function afailure($content=null, ?int $overrideLevel=null): void { foreach ($this->msgs as $msg) { $msg->afailure($content, $overrideLevel); } }
|
||||
function adone($content=null, ?int $overrideLevel=null): void { foreach ($this->msgs as $msg) { $msg->adone($content, $overrideLevel); } }
|
||||
function print($content, ?int $level=null): void { foreach ($this->msgs as $msg) { $msg->print($content, $level); } }
|
||||
function info($content, ?int $level=null): void { foreach ($this->msgs as $msg) { $msg->info($content, $level); } }
|
||||
function note($content, ?int $level=null): void { foreach ($this->msgs as $msg) { $msg->note($content, $level); } }
|
||||
|
|
|
@ -590,7 +590,7 @@ class StdMessenger implements _IMessenger {
|
|||
}
|
||||
}
|
||||
|
||||
function printActions(bool $endAction=false): void {
|
||||
function printActions(bool $endAction=false, ?int $overrideLevel=null): void {
|
||||
$this->printTitles();
|
||||
$err = $this->err;
|
||||
$indentLevel = $this->getIndentLevel(false);
|
||||
|
@ -599,7 +599,7 @@ class StdMessenger implements _IMessenger {
|
|||
foreach ($this->actions as &$action) {
|
||||
$mergeResult = $index++ == $lastIndex && $endAction;
|
||||
$linePrefix = $action["line_prefix"];
|
||||
$level = $action["level"];
|
||||
$level = $overrideLevel?? $action["level"];
|
||||
$content = $action["content"];
|
||||
$printContent = $action["print_content"];
|
||||
$rsuccess = $action["result_success"];
|
||||
|
@ -628,25 +628,25 @@ class StdMessenger implements _IMessenger {
|
|||
$this->_printGenericOrException($level, "step", $content, $this->getIndentLevel(), $this->err);
|
||||
}
|
||||
|
||||
function asuccess($content=null): void {
|
||||
function asuccess($content=null, ?int $overrideLevel=null): void {
|
||||
if (!$this->actions) $this->action(null);
|
||||
$this->action["result_success"] = true;
|
||||
$this->action["result_content"] = $content;
|
||||
$this->printActions(true);
|
||||
$this->printActions(true, $overrideLevel);
|
||||
}
|
||||
|
||||
function afailure($content=null): void {
|
||||
function afailure($content=null, ?int $overrideLevel=null): void {
|
||||
if (!$this->actions) $this->action(null);
|
||||
$this->action["result_success"] = false;
|
||||
$this->action["result_content"] = $content;
|
||||
$this->printActions(true);
|
||||
$this->printActions(true, $overrideLevel);
|
||||
}
|
||||
|
||||
function adone($content=null): void {
|
||||
function adone($content=null, ?int $overrideLevel=null): void {
|
||||
if (!$this->actions) $this->action(null);
|
||||
$this->action["result_success"] = null;
|
||||
$this->action["result_content"] = $content;
|
||||
$this->printActions(true);
|
||||
$this->printActions(true, $overrideLevel);
|
||||
}
|
||||
|
||||
function _endAction(?int $until=null): void {
|
||||
|
|
Loading…
Reference in New Issue