public function test02() { ### startsWith($needle, $haystack) $this->assertTrue(Util::starts_with('Odd', 'Odd Greg')); $this->assertFalse(Util::starts_with('Greg', 'Odd Greg')); ### endsWith($needle, $haystack) $this->assertTrue(Util::ends_with('Greg', 'Odd Greg')); $this->assertFalse(Util::ends_with('Odd', 'Odd Greg')); ### stripTrailing($characters, $string) $this->assertEquals('All_The_Things', Util::strip_tail('_', "All_The_Things__")); $this->assertNotEquals('All_The_Things', Util::strip_tail('_', "All_The_Things--")); ### truncate($string, $endlength = "30", $end = "...") $this->assertEquals('A line tha...', Util::truncate("A line that is in need of shortening and I ain't talking about cooking.", $endlength = "10", $end = "...")); }
/** * Forget all of the queued listeners. * * @return void */ function forgetQueued() { foreach ($this->listeners as $key => $value) { if (Util::ends_with('_queue', $key)) { $this->forget($key); } } }