#!/usr/bin/php title("title", function ($msg) { $msg->desc("desc"); $msg->print("print"); $msg->desc("action avec step"); $msg->action("action avec step", function ($msg) { $msg->step("step"); $msg->asuccess("action success"); }); $msg->action("action avec step", function ($msg) { $msg->step("step"); $msg->afailure("action failure"); }); $msg->action("action avec step", function ($msg) { $msg->step("step"); $msg->adone("action done"); }); $msg->desc("actions sans step"); $msg->action("action sans step", function ($msg) { $msg->asuccess("action success"); }); $msg->action("action sans step", function ($msg) { $msg->afailure("action failure"); }); $msg->action("action sans step", function ($msg) { $msg->adone("action done"); }); $msg->desc("actions imbriquées"); $msg->action("action0", function ($msg) { $msg->action("action1", function ($msg) { $msg->action("action2", function ($msg) { $msg->asuccess("action2 success"); }); $msg->asuccess("action1 success"); }); $msg->asuccess("action0 success"); }); $msg->desc("action avec step, sans messages"); $msg->action("action avec step, sans messages, success", function ($msg) { $msg->step("step"); $msg->asuccess(); }); $msg->action("action avec step, sans messages, failure", function ($msg) { $msg->step("step"); $msg->afailure(); }); $msg->action("action avec step, sans messages, done", function ($msg) { $msg->step("step"); $msg->adone(); }); $msg->desc("action sans step, sans messages"); $msg->action("action sans step, sans messages, success", function ($msg) { $msg->asuccess(); }); $msg->action("action sans step, sans messages, failure", function ($msg) { $msg->afailure(); }); $msg->action("action sans step, sans messages, done", function ($msg) { $msg->adone(); }); $msg->desc("actions imbriquées, sans messages"); $msg->action("action0", function ($msg) { $msg->action("action1", function ($msg) { $msg->action("action2", function ($msg) { $msg->asuccess(); }); $msg->asuccess(); }); $msg->asuccess(); }); $msg->desc("action avec step, avec code de retour"); $msg->action("action avec step, avec code de retour true", function ($msg) { $msg->step("step"); return true; }); $msg->action("action avec step, avec code de retour false", function ($msg) { $msg->step("step"); return false; }); $msg->action("action avec step, avec code de retour autre", function ($msg) { $msg->step("step"); return "autre"; }); $msg->action("action avec step, avec code de retour null", function ($msg) { $msg->step("step"); }); $msg->desc("action sans step, avec code de retour"); $msg->action("action sans step, avec code de retour true", function ($msg) { return true; }); $msg->action("action sans step, avec code de retour false", function ($msg) { return false; }); $msg->action("action sans step, avec code de retour autre", function ($msg) { return "autre"; }); # ici, il n'y aura pas de message du tout $msg->action("action sans step, avec code de retour null", function ($msg) { }); $msg->info("info"); $msg->note("note"); $msg->warn("warn"); $msg->error("error"); }); }); msg::section("multi-line\nsection", function ($msg) { $msg->title("multi-line\ntitle"); $msg->title("another\ntitle"); $msg->print("multi-line\nprint"); $msg->info("multi-line\ninfo"); $msg->action("multi-line\naction"); $msg->asuccess(); $msg->action("multi-line\naction"); $msg->step("multi-line\nstep"); $msg->afailure(); $msg->action("multi-line\naction"); $msg->step("multi-line\nstep"); $msg->asuccess("multi-line\nsuccess"); $msg->action("multi-line\naction"); $msg->step("multi-line\nstep"); $msg->adone("multi-line\ndone"); $msg->end(); $msg->end(); }); msg::section("Exceptions", function ($msg) { $e = new Exception("message"); $u1 = new UserException("userMessage"); $u2 = new UserException("userMessage", "techMessage"); $msg->title("avec message", function ($msg) use ($e, $u1, $u2) { $msg->info(["exception", $e]); $msg->info(["userException1", $u1]); $msg->info(["userException2", $u2]); }); $msg->title("sans message", function ($msg) use ($e, $u1, $u2) { $msg->info($e); $msg->info($u1); $msg->info($u2); }); }); } });