Ejemplo n.º 1
0
 /**
  * Initialize this object's properties from an array.
  *
  * @param array $array Used to seed this object's properties.
  * @return void
  */
 protected function mapTypes($array)
 {
     // Hard initilise simple types, lazy load more complex ones.
     foreach ($array as $key => $val) {
         if (!property_exists($this, $this->keyType($key)) && property_exists($this, $key)) {
             $this->{$key} = $val;
             unset($array[$key]);
         } elseif (property_exists($this, $camelKey = IWP_google_Utils::camelCase($key))) {
             // This checks if property exists as camelCase, leaving it in array as snake_case
             // in case of backwards compatibility issues.
             $this->{$camelKey} = $val;
         }
     }
     $this->modelData = $array;
 }