PHP Classes

File: examples/websocket/app/models/client.php

Recommend this page to a friend!
  Classes of Haseeb Ahmad Basil   PHP Skeleton Framework   examples/websocket/app/models/client.php   Download  
File: examples/websocket/app/models/client.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Skeleton Framework
Extensive Web application development framework
Author: By
Last change:
Date: 8 years ago
Size: 475 bytes
 

Contents

Class file image Download
<?php

class client extends A_Model
{

    public function
__construct()
    {
       
$this->set('name', 'Guest' . rand(0, 100));
       
$this->set('joined_time', time());
       
$this->set('cid', base_convert(rand(1000, 9999), 10, 16));
    }

    public function
serialize()
    {
        return (object) array(
           
'name' => $this->get('name'),
           
'joined_time' => $this->get('joined_time'),
           
'cid' => $this->get('cid')
        );
    }

    public function
deserialize($data)
    {
       
$this->set('name', $data->name);
    }
}