self::$items->attach($e); return $e; } /** * Clear the specified interval */ public static function clearInterval(Timer $timer) { self::$items->detach($timer); $timer->__destruct(); } /** * Attach the specified callback on the specified descriptor * @return Event */ public static function stop() { self::$run = false; event_base_loopexit(self::$base, 1000); } /** * Check if the loop is started */ public static function isStarted() { return self::$run; } /** * Starts the event loop */ public static function start()
<?php function autoLoad($method) { $method = str_replace('\\', '/', strtolower($method)); chdir(__DIR__); require $method . '.php'; } spl_autoload_register('autoLoad'); $plane = new Plane(0, 0, 1000, 100); Loop::start($plane);