Example #1
0
 /**
  * @param mixed $name property name
  * @return mixed|null value for the property
  */
 public function __get($name)
 {
     if (array_key_exists($name, $this->_cache['subs']) && !$this->_cache['subs'][$name]['dynamic']) {
         if (!isset($this->_subs[$name])) {
             $this->_subs[$name] = APISubFactory::factory($this->_cache['subs'][$name], $this->_auth);
         }
         return $this->_subs[$name];
     } else {
         trigger_error("Property " . $name . " does not exist.", E_USER_WARNING);
         return null;
     }
 }
 /**
  * @param mixed $name property name
  * @return mixed|null property value
  */
 public function __get($name)
 {
     if (isset($this->_cache['subs'][$name]) && !$this->_cache['subs'][$name]['dynamic']) {
         if (!isset($this->_subs[$name])) {
             $this->_subs[$name] = APISubFactory::factory($this->_cache['subs'][$name], $this->_auth, $this->_pathParams);
         }
         return $this->_subs[$name];
     } elseif (isset($this->_cache['params'][$name])) {
         if (!isset($this->_params[$name])) {
             $this->_params[$name] = ParameterFactory::factory($this->_cache['params'][$name]);
         }
         if ($this->_params[$name]->hasChilds() || $this->_params[$name] instanceof ParameterArrayType) {
             return $this->_params[$name];
         } else {
             return $this->_params[$name]->get();
         }
     } else {
         trigger_error("Property " . $name . " does not exist", E_USER_ERROR);
         return null;
     }
 }
 /**
  * @param mixed $offset
  * @return mixed returns the instance at this offset
  */
 public function offsetGet($offset)
 {
     if (!isset($this->_dynamicInstances[$offset])) {
         $pathParams = $this->_pathParams;
         $pathParams[$this->_dynamicSub] = $offset;
         $this->_dynamicInstances[$offset] = APISubFactory::factory($this->_cache['subs'][$this->_dynamicSub], $this->_auth, $pathParams);
     }
     return $this->_dynamicInstances[$offset];
 }
Example #4
0
 /**
  * @param mixed $name name of the property
  * @param mixed $value value to set for the property
  * @throws InvalidSwaggerFormatException
  * @throws NoResponseException
  * @throws RequirementsException
  */
 public function __set($name, $value)
 {
     if (array_key_exists($name, $this->_cache)) {
         if ($value instanceof API || is_subclass_of($value, API::class)) {
             $this->_subs[$name] = $value;
         } elseif (is_array($value)) {
             if (!isset($this->_subs[$name])) {
                 if (!is_array($this->_cache[$name])) {
                     $this->_cache[$name] = $this->proceedSubCache($this->_cache[$name], $name);
                 }
                 $this->_subs[$name] = APISubFactory::factory($this->_cache[$name], $this->_auth);
             }
             foreach ($value as $key => $v) {
                 $this->_subs[$name]->{$key} = $v;
             }
         }
     } else {
         trigger_error("Property " . $name . " does not exist", E_USER_ERROR);
     }
 }