HCE Project PHP language client API bindings OOP style  1.1.1
Hierarchical Cluster Engine PHP Client Interface API OOP style
 All Classes Namespaces Files Functions Variables Pages
Response.inc.php
Go to the documentation of this file.
1 <?php
2 
14 namespace HCE\transport {
15 
19  class Response {
23  protected $responseData = array ();
24 
28  protected $error = 0;
29 
36  public function addResponseItem($responseItem) {
37  if ($responseItem !== NULL) {
38  $this->responseData [] = $responseItem;
39  }
40  }
41 
48  public function deleteResponseItem($index) {
49  if (isset ( $this->{$responseData} [$index] )) {
50  unset ( $this->responseData [$index] );
51  }
52  }
53 
60  public function setResponses($responses) {
61  $this->responseData = $responses;
62  }
63 
71  public function getResponseItem($index = NULL) {
72  if ($index === NULL) {
73  return count ( $this->$responseData );
74  } else {
75  return $this->responseData [$index];
76  }
77  }
78 
82  public function getResponses() {
83  return $this->responseData;
84  }
85 
93  public function setErrorCode($errorCode) {
94  $this->error = $errorCode;
95  }
96 
102  public function getErrorCode() {
103  return $this->error;
104  }
105 
115  public function getResponseItemField($index = NULL, $fieldName = NULL) {
116  if ($index === NULL) {
117  return count ( $this->responseData );
118  } else {
119  if (isset ( $this->responseData [$index] [$fieldName] )) {
120  return $this->responseData [$index] [$fieldName];
121  } else {
122  return NULL;
123  }
124  }
125  }
126 
133  public function __construct($responseItem = null) {
134  $this->addResponseItem ( $responseItem );
135  }
136 
140  public function __destruct() {
141  $this->responseData = NULL;
142  }
143  }
144 }
145 
146 ?>