Can create a call

This commit is contained in:
2019-01-24 09:22:50 +01:00
parent 3786c5c4e9
commit e41cf0161e
5 changed files with 424 additions and 0 deletions

View File

@ -0,0 +1,55 @@
<?php
/**
* Call information object
*
* @author Pierre HUBERT
*/
class CallInformation extends BaseUniqueObject {
//Private fields
private $conversation_id;
private $last_active;
private $members;
public function __construct(){
parent::__construct();
$this->members = array();
}
//Conversations ID
public function set_conversation_id(int $conversation_id){
$this->conversation_id = $conversation_id;
}
public function has_conversation_id() : bool {
return $this->conversation_id > -1;
}
public function get_conversation_id() : int {
return $this->conversation_id;
}
//Last activity
public function set_last_active(int $last_active){
$this->last_active = $last_active;
}
public function has_last_active() : bool {
return $this->last_active > -1;
}
public function get_last_active() : int {
return $this->last_active;
}
//Call members list
public function add_member(CallMemberInformation $member) {
$this->members[] = $member;
}
public function get_members() : array {
return $this->members;
}
}

View File

@ -0,0 +1,67 @@
<?php
/**
* Information about two members call
*
* @author Pierre HUBERT
*/
class CallMemberInformation extends BaseUniqueObjectFromUser {
/**
* Possible user responses
*/
public const USER_ACCEPTED = 1;
public const USER_REJECTED = 0;
public const USER_UNKNOWN = -1;
//Private fields
private $call_id;
private $user_call_id;
private $accepted;
//Call ID
public function set_call_id(int $call_id){
$this->call_id = $call_id;
}
public function has_call_id() : bool {
return $this->call_id > -1;
}
public function get_call_id() : int {
return $this->call_id;
}
//User Call ID
public function set_user_call_id(string $user_call_id){
$this->user_call_id = $user_call_id == "" ? null : $user_call_id;
}
public function has_user_call_id() : bool {
return $this->user_call_id != null;
}
public function get_user_call_id() : string {
return $this->user_call_id != null ? $this->user_call_id : "null";
}
//User response to call
public function set_accepted(int $accepted){
$this->accepted = $accepted;
}
public function has_accepted() : bool {
return $this->accepted > -1;
}
public function get_accepted() : int {
return $this->accepted;
}
}