public function onTick(ServerClient $client) { $time = (int) $client->getAttribute('tick'); if ($time == time()) { return; } $client->setAttribute('tick', time()); $this->output->writeln(sprintf('<info>Client[%s:%d]</info> :: <comment>%s</comment>', $client->getHost(), $client->getPort(), __METHOD__)); }
public function onTick(ServerClient $client) { static $time; $time = isset($time) ? $time : 0; if ($time == time()) { return; } $time = time(); $this->output->writeln(sprintf('<info>Client[%s:%d]</info> :: <comment>%s</comment>', $client->getHost(), $client->getPort(), __METHOD__)); }