Skip to content

Instantly share code, notes, and snippets.

@Opus1no2
Created November 30, 2012 16:27
Show Gist options
  • Save Opus1no2/4176797 to your computer and use it in GitHub Desktop.
Save Opus1no2/4176797 to your computer and use it in GitHub Desktop.
CD Form Data
<?php
/**
*
* Usage:
*
* $dist = new DistributorData($_REQUEST);
*/
class DistributorData
{
/**
* @var string $sid
*/
public $sid;
/**
* @var int $dnis
*/
public $dnis;
/**
* @var int $agentId
*/
public $agentId;
/**
* @var int $callerId
*/
public $callerId;
/**
*
* Class constructor
*
* @param array $options
*
* @return void
*/
public function __construct(array $options)
{
$this->_setOptions($options);
}
/**
*
* Set post data
*
* @param array $options
*
* @return void
*/
protected function _setOptions(array $options)
{
if (array_key_exists('callerid', $options)) {
$this->setCallerId($options['callerid'];
}
if (array_key_exists('AGENTID', $options)) {
$this->setAgentId($options['AGENTID']);
}
if (array_key_exists('SID', $options) {
$this->setSid($options['SID']);
}
if (array_key_exists('DNIS', $options)) {
$this->setDnis($options['DNIS']);
}
}
/**
*
* Set Caller Id
*
* @param int $id
*
* @return void
*/
public function setCallerId($id)
{
$this->callerId = $id;
return $this;
}
/**
*
* Set Agent Id
*
* @param int $id
*
* @return void
*/
public function setAgentId($id)
{
$this->agentId = $id;
return $this;
}
/**
*
* Set session Id
*
* @param string $sid
*
* @return void
*/
public function setSid($sid)
{
$this->sid = $sid;
return $this;
}
/**
*
* Set Dnis (number called)
*
* @param int $dnis
*
* @return void
*/
public function setDnis($dnis)
{
$this->dnis = $dnis;
return $this;
}
/**
*
* Get Caller Id
*
* @return int
*/
public function getCallerId()
{
return (int)$this->callerId;
}
/**
*
* Get Agent Id
*
* @return int
*/
public function getAgentId()
{
return (int)$this->agentId;
}
/**
*
* Get Session Id
*
* @return string
*/
public function getSid()
{
return (string)$this->sid;
}
/**
*
* Get Dnis
*
* @return int
*/
public function getDnis()
{
return (int)$this->dnis;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment