| 1 | <?php  | 
            ||
| 22 | class PingKeepAlive extends Component  | 
            ||
| 23 | { | 
            ||
| 24 | /** @var float|int */  | 
            ||
| 25 | private $_interval = 15;  | 
            ||
| 26 | private $_timer;  | 
            ||
| 27 | |||
| 28 | /**  | 
            ||
| 29 | * PingKeepAlive constructor.  | 
            ||
| 30 | *  | 
            ||
| 31 | * @param float $interval Keep alive interval in seconds  | 
            ||
| 32 | */  | 
            ||
| 33 | public function __construct($interval = 15.)  | 
            ||
| 37 | |||
| 38 | public function setClient(XmppClient $client)  | 
            ||
| 44 | |||
| 45 | /**  | 
            ||
| 46 | * Starts keep alive timer  | 
            ||
| 47 | */  | 
            ||
| 48 | public function enable()  | 
            ||
| 54 | |||
| 55 | /**  | 
            ||
| 56 | * Stops keep alive timer  | 
            ||
| 57 | */  | 
            ||
| 58 | public function disable()  | 
            ||
| 62 | |||
| 63 | private function keepAlive()  | 
            ||
| 69 | }  | 
            ||
| 70 |