Example #1
0
 public function __construct($parameters)
 {
     foreach ($parameters as $key => $value) {
         if (property_exits($this, $key)) {
             $this->{$key} = $value;
         }
     }
 }
 /**
  * Copy the country properties from a stdClass object to this class object.  Needed when retrieving
  * objects from the database, but could be useful elsewhere in WPeC?
  *
  * @access public
  *
  * @since 3.8.14
  *
  * @param stdClass	$currency	the stdClass having properties that will be used to create a currency
  *
  * @return self			for method chaining
  */
 public function _copy_properties_from_stdclass($currency)
 {
     // no properties are really required, so we will check that they exist before we copy them
     // into our object
     if (property_exits($currency, 'code')) {
         $this->code = $currency->code;
     }
     if (property_exits($currency, 'symbol')) {
         $this->symbol = $currency->symbol;
     }
     if (property_exits($currency, 'symbol_html')) {
         $this->symbol_html = $currency->symbol_html;
     }
     // We check for name and currency for the currency name, a backwards compatibility feature name is preferred
     if (property_exits($currency, 'currency')) {
         $this->name = $currency->currency;
     }
     if (property_exits($currency, 'name')) {
         $this->name = $currency->name;
     }
     return $this;
 }