/** * @param string $version OnApp API version * @param object $obj wrapper object */ public function __construct($obj) { self::$obj = $obj; self::$APIVersion = $obj->getAPIVersion(); }
/** * Standard method to handle getting non-existent class' property * * @param string $name property name * * @return mixed */ public function __get($name) { // legacy getting errors // remove after rewriting the code to use getErrors() method // instead of direct access switch ($name) { case 'error': return $this->getErrorsAsArray(); break; case '_version': return $this->getAPIVersion(); break; } // legacy vars naming if (!isset($this->dynamicFields[$name])) { if (strpos($name, '_') === 0) { $tmpName = substr($name, 1); } else { $tmpName = '_' . $name; } if (isset($this->dynamicFields[$tmpName])) { return $this->dynamicFields[$tmpName]; } else { return null; } } if (is_object($this->dynamicFields[$name])) { if (get_class($this->dynamicFields[$name]) == 'DataHolder') { $this->dynamicFields[$name] = OnApp_Helper_Caster::unserializeNested($this->dynamicFields[$name]); } } return $this->dynamicFields[$name]; }