<?php

class iapiResponseEnvelope {
    public function __construct ($pJSONResponse) {
      
      $mResponse = json_decode ($pJSONResponse);

      if (! is_null ($mResponse)) {

        $mProperties = get_object_vars ($mResponse);
        
        foreach ($mProperties as $mKey=>$mItem) {
          $this->$mKey = $mItem;
        }
        
      } else {
        $this->error_state = 'json_parse_error';
        $this->error_message = "phpInfoAPI.iapiResponseEnvelope: Cannot parse response contents: '$pJSONResponse'";
      }
      
    }
    
    
    public function GetDataValue ($pPropertyName) {
      if (isset ($this->data->$pPropertyName)) {
        $mResult = $this->data->$pPropertyName;
      } else {
        $mResult = '';
      }
      return $mResult;
    }    
}

?>