Example #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 = W3TCG_Google_Utils::camelCase($key))) {
             // For backwards compatibility, this checks if property exists as camelCase, leaving
             // it in array as snake_case
             $this->{$camelKey} = $val;
         }
     }
     $this->modelData = $array;
 }