function _once($function) { return Underscore::once($function); }
/** * @tags functions */ public function testOnce() { // it should trigger function execution only once $count = 0; $fn = _::once(function () use(&$count) { $count++; }); // call the function 3 times for ($i = 0; $i < 3; $i++, $fn()) { } $this->integer($count)->isEqualTo(1); }