Exemple #1
0
 public function __construct(Database &$db, $model_name)
 {
     $this->db =& $db;
     $this->model_name = $model_name;
     $this->field_prefix = strtolower($model_name);
     $this->table_name = property_exists($model_name, 'table_name') ? $model_name::$table_name : $this->tableNameFromEntity($model_name);
 }
Exemple #2
0
 public function __set($property, $value)
 {
     if (property_exists($this, $property)) {
         $this->{$property} = $value;
     }
     return $this;
 }
Exemple #3
0
 /**
  * Method to get a single record.
  *
  * @param   integer  $pk  The id of the primary key.
  *
  * @return  mixed  Object on success, false on failure.
  *
  * @since   1.6
  */
 public function getItem($pk = null)
 {
     $pk = !empty($pk) ? $pk : (int) $this->getState($this->getName() . '.id');
     $table = $this->getTable();
     if ($pk > 0) {
         // Attempt to load the row.
         $return = $table->load($pk);
         // Check for a table object error.
         if ($return === false && $table->getError()) {
             $this->setError($table->getError());
             return false;
         }
     }
     // Convert to the JObject before adding other data.
     $properties = $table->getProperties(1);
     $item = JArrayHelper::toObject($properties, 'JObject');
     if (property_exists($item, 'params')) {
         $registry = new JRegistry();
         $registry->loadString($item->params);
         $item->params = $registry->toArray();
     }
     if (property_exists($item, 'order_params')) {
         $registry = new JRegistry();
         $registry->loadString($item->order_params);
         $item->order_params = $registry->toArray();
     }
     return $item;
 }
Exemple #4
0
 /**
  * Log the user out of the application.
  *
  * @return \Illuminate\Http\Response
  */
 public function getLogout()
 {
     $user = \Auth::user()->name;
     \Auth::logout();
     \Session::flash('flash_message', $user . ': You have been logged out.');
     return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
 }
 /**
  * @param object $object
  * @return $this
  * @throws UnexpectedValueException
  */
 public function fromObject($object)
 {
     parent::fromObject($object);
     if (property_exists($object, 'isRecurring')) {
         $this->isRecurring = $object->isRecurring;
     }
     if (property_exists($object, 'locale')) {
         $this->locale = $object->locale;
     }
     if (property_exists($object, 'paymentProductFilters')) {
         if (!is_object($object->paymentProductFilters)) {
             throw new UnexpectedValueException('value \'' . print_r($object->paymentProductFilters, true) . '\' is not an object');
         }
         $value = new PaymentProductFiltersHostedCheckout();
         $this->paymentProductFilters = $value->fromObject($object->paymentProductFilters);
     }
     if (property_exists($object, 'returnUrl')) {
         $this->returnUrl = $object->returnUrl;
     }
     if (property_exists($object, 'showResultPage')) {
         $this->showResultPage = $object->showResultPage;
     }
     if (property_exists($object, 'tokens')) {
         $this->tokens = $object->tokens;
     }
     if (property_exists($object, 'variant')) {
         $this->variant = $object->variant;
     }
     return $this;
 }
Exemple #6
0
 public function createEvent(Request $request, $payload)
 {
     $newEvent = json_decode(urldecode($payload));
     if (!property_exists($newEvent, 'alert')) {
         return false;
     }
     $alert = $newEvent->alert;
     $event = new RawEvent();
     $event->setType('monitis');
     $system = str_replace('http://', '', $alert->url);
     $system = str_replace(' ', '', $system);
     $event->setSystem($system);
     if ($alert->alertType === self::STATUS_PROBLEM) {
         $event->setStatus(Event::STATUS_FAILURE);
         if (property_exists($alert, "errorString")) {
             $event->setMessage($alert->errorString);
         } else {
             $event->setMessage('Monitis found an error for ' . $alert->name . '.');
         }
     } else {
         $event->setStatus(Event::STATUS_SUCCESS);
         $event->setMessage("");
     }
     $event->setIdentifier("monitis_" . $system . "_" . $alert->type);
     $event->setUnique(false);
     $event->setUrl('http://dashboard.monitis.com/');
     if (property_exists($alert, 'stepDuration')) {
         $event->setValue($alert->stepDuration);
     }
     return $event;
 }
 /**
  * @param object $object
  * @return $this
  * @throws UnexpectedValueException
  */
 public function fromObject($object)
 {
     parent::fromObject($object);
     if (property_exists($object, 'isRecurring')) {
         $this->isRecurring = $object->isRecurring;
     }
     if (property_exists($object, 'paymentProduct809SpecificInput')) {
         if (!is_object($object->paymentProduct809SpecificInput)) {
             throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct809SpecificInput, true) . '\' is not an object');
         }
         $value = new RedirectPaymentProduct809SpecificInput();
         $this->paymentProduct809SpecificInput = $value->fromObject($object->paymentProduct809SpecificInput);
     }
     if (property_exists($object, 'paymentProduct816SpecificInput')) {
         if (!is_object($object->paymentProduct816SpecificInput)) {
             throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct816SpecificInput, true) . '\' is not an object');
         }
         $value = new RedirectPaymentProduct816SpecificInput();
         $this->paymentProduct816SpecificInput = $value->fromObject($object->paymentProduct816SpecificInput);
     }
     if (property_exists($object, 'paymentProduct882SpecificInput')) {
         if (!is_object($object->paymentProduct882SpecificInput)) {
             throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct882SpecificInput, true) . '\' is not an object');
         }
         $value = new RedirectPaymentProduct882SpecificInput();
         $this->paymentProduct882SpecificInput = $value->fromObject($object->paymentProduct882SpecificInput);
     }
     if (property_exists($object, 'returnUrl')) {
         $this->returnUrl = $object->returnUrl;
     }
     return $this;
 }
 /**
  * Gets the value of an OGNL expression in the given context.
  *
  * @param $expression the OGNL expression to evaluate
  * @param $context the context in which to evaluate the expression
  *
  * @return the value of the expression or null if the expression is invalid
  */
 public static function GetValue($expression, $context)
 {
     if (!isset($expression) || !isset($context)) {
         return null;
     }
     while (strlen($expression) > 0) {
         $matches = array();
         if (preg_match(self::$OGNL_TOKEN_REGEX, $expression, $matches)) {
             $token = array_shift($matches);
             $expression = substr($expression, strlen($token));
             // Remove empty matches.
             $matches = array_filter($matches, 'strlen');
             foreach ($matches as $field) {
                 if (is_object($context) && property_exists($context, $field)) {
                     $context = $context->{$field};
                 } else {
                     if (is_array($context) && array_key_exists($field, $context)) {
                         $context = $context[$field];
                     } else {
                         // Field doesn't evaluate in the context.
                         return null;
                     }
                 }
             }
         } else {
             // Invalid expression.
             return null;
         }
     }
     return $context;
 }
Exemple #9
0
 /**
  * @param string $property
  * @param mixed  $value
  */
 public function __set($property, $value)
 {
     if (!property_exists($this, $property)) {
         //$this->unknownProperties[$property] = $value;
         $this->{$property} = $value;
     }
 }
 public static function escape($value)
 {
     if (is_array($value)) {
         foreach ($value as &$ele) {
             self::escape($ele);
         }
         unset($ele);
         return $value;
     }
     if (is_object($value)) {
         $class_vars = get_class_vars(get_class($value));
         foreach ($class_vars as $name => $var) {
             if (!property_exists($value, $name) or !isset($value->{$name})) {
                 continue;
             }
             $value->{$name} = self::escape($value->{$name});
         }
         return $value;
     }
     $value = str_replace(array('javascript:'), '', $value);
     /*
     $value = str_replace(';', "&#59;", $value); 
     $value = str_replace('\\', "\", $value); 
     $value = str_replace('/', "/", $value); 
     $value = str_replace('=', "=", $value);
     */
     $value = htmlentities($value, ENT_QUOTES, 'UTF-8');
     return $value;
 }
Exemple #11
0
 /**
  * Function to get the value of a given property
  * @param <String> $propertyName
  * @return <Object>
  * @throws Exception
  */
 public function get($propertyName)
 {
     if (property_exists($this, $propertyName)) {
         return $this->{$propertyName};
     }
     return null;
 }
 protected static function extractProperty($element, $property)
 {
     if (!is_a($element, get_called_class()) || !property_exists($element, $property)) {
         throw new \InvalidArgumentException('property ' . $property . ' does not exists in class: ' . get_called_class());
     }
     return $element->{$property};
 }
 /**
  * Get status text.
  *
  * @return string
  */
 public function getStatusText()
 {
     if (property_exists($this, 'statusText')) {
         return $this->{'statusText'};
     }
     return null;
 }
Exemple #14
0
 public function __get($prop)
 {
     if (property_exists($this, $prop)) {
         return $this->{$prop};
     }
     throw new Exception\UpgradeException(sprintf('Property "%s" does not exist for the class "%s".', $prop, get_class($this)));
 }
Exemple #15
0
 /**
  * Update object attribute
  *
  * @param  string $attribute
  * @param  string|boolean|integer $value
  *
  * @return object
  */
 private function updateAttribute($attribute, $value)
 {
     if (property_exists($this, $attribute)) {
         $this->{$attribute} = $value;
     }
     return $this;
 }
 public function __get($var)
 {
     if (property_exists(__CLASS__, $var)) {
         return $this->{$var};
     }
     return NULL;
 }
 /**
  * Add the insert user's roles to the comment data so we can visually
  * identify different roles in the view.
  */
 public function DiscussionController_Render_Before($Sender)
 {
     $Session = Gdn::Session();
     if ($Session->IsValid()) {
         $JoinUser = array($Session->User);
         RoleModel::SetUserRoles($JoinUser, 'UserID');
     }
     if (property_exists($Sender, 'Discussion')) {
         $JoinDiscussion = array($Sender->Discussion);
         RoleModel::SetUserRoles($JoinDiscussion, 'InsertUserID');
         $Comments = $Sender->Data('Comments');
         RoleModel::SetUserRoles($Comments->Result(), 'InsertUserID');
         $Answers = $Sender->Data('Answers');
         if (is_array($Answers)) {
             RoleModel::SetUserRoles($Answers, 'InsertUserID');
         }
         // And add the css class to the discussion
         if (is_array($Sender->Discussion->Roles)) {
             if (count($Sender->Discussion->Roles)) {
                 $CssRoles = GetValue('Roles', $Sender->Discussion);
                 foreach ($CssRoles as &$RawRole) {
                     $RawRole = $this->_FormatRoleCss($RawRole);
                 }
                 $Sender->Discussion->_CssClass = GetValue('_CssClass', $Sender->Discussion, '') . ' ' . implode(' ', $CssRoles);
             }
         }
     }
 }
 public function run($params = array())
 {
     // And array of conditions to pass to the database
     $conditions = array();
     // If the filter has any parameters specified
     if (property_exists($this->info, 'params')) {
         foreach ($this->info->params as $param) {
             $name = dash($param->name);
             // If no value for the parameter was passed in, use the
             // filters's specified default value
             if (array_key_exists($name, $params)) {
                 $conditions[$name] = $params[$name];
             } else {
                 $conditions[$name] = $param->default;
             }
         }
     }
     $result = $this->contentType->find($conditions);
     // See if we were just retrieving a single record
     // TODO: Fix the SQL so we do a LIMIT 1, to hopfully same on memory
     if (property_exists($this->info, 'single') && $this->info->single) {
         if (count($result) > 0) {
             $result = $result[0];
         } else {
             $result = NULL;
         }
     }
     return $result;
 }
Exemple #19
0
 public function getItem($pk = null)
 {
     // Initialise variables.
     $pk = !empty($pk) ? $pk : (int) $this->getState($this->getName() . '.id');
     $table = $this->getTable();
     if ($pk > 0) {
         // Attempt to load the row.
         $return = $table->load($pk);
         // Check for a table object error.
         if ($return === false && $table->getError()) {
             $this->setError($table->getError());
             return false;
         }
     }
     // Convert to the JObject before adding other data.
     $properties = $table->getProperties(1);
     $item = JArrayHelper::toObject($properties, 'JObject');
     $item->title = htmlspecialchars(strip_tags($item->title));
     if (property_exists($item, 'params')) {
         $registry = new JRegistry();
         $registry->loadString($item->params);
         $item->params = $registry->toArray();
     }
     if ($item) {
         $arr = str_replace('[', '', $item->value);
         $arr = str_replace(']', '', $arr);
         if (preg_match('/.*\\},{\\.*?/s', $arr, $match)) {
             //var_dump($match);
             $values = str_replace('},', '}///', $arr);
             $values = explode('///', $values);
         } else {
             $values = (array) $arr;
         }
         //            $artOptFields   = $this -> _checkArticleFields($item -> id);
         if (count($values) > 0) {
             $list = array();
             $i = 0;
             foreach ($values as $value) {
                 $list[$i] = new stdClass();
                 $param = new JRegistry($value);
                 $list[$i]->type = $item->type;
                 if (!empty($item->default_value)) {
                     $list[$i]->default_value = explode(',', $item->default_value);
                 } else {
                     $list[$i]->default_value = array();
                 }
                 $list[$i]->name = $param->get('name');
                 $list[$i]->value = $param->get('value');
                 $list[$i]->target = $param->get('target');
                 $list[$i]->editor = $param->get('editor');
                 $list[$i]->image = $param->get('image');
                 $list[$i]->ordering = $param->get('ordering');
                 $i++;
             }
             $item->defvalue = $list;
         }
         $item->groups = $this->getGroups();
     }
     return $item;
 }
Exemple #20
0
 function getProtectedProperty($item)
 {
     if (property_exists($this, $item)) {
         return $this->{$item};
     }
     throw new Exception("Property does not exist!");
 }
Exemple #21
0
 /**
  * dynamic get method 
  * 
  * @param $var
  * 
  * @return $var
  */
 public static function get($var)
 {
     if (!property_exists(self::$instance, $var)) {
         return false;
     }
     return self::$instance->{$var};
 }
Exemple #22
0
 /**
  * Function to get the value of a given property
  * @param <String> $propertyName
  * @return <Object>
  * @throws Exception
  */
 public function get($propertyName)
 {
     if (property_exists($this, $propertyName)) {
         return $this->{$propertyName};
     }
     throw new Exception($propertyName . ' doest not exists in class ' . get_class($this));
 }
Exemple #23
0
 public function _resolve_lookup($context)
 {
     $current = $context;
     foreach ($this->lookups as $bit) {
         if (is_array($current) && array_key_exists($bit, $current)) {
             $current = $current[$bit];
         } else {
             if (is_object($current)) {
                 if ($current instanceof ArrayAccess && isset($current[$bit])) {
                     $current = $current[$bit];
                 } else {
                     if (property_exists($current, $bit)) {
                         $current = $current->{$bit};
                     } else {
                         if (method_exists($current, $bit)) {
                             $current = $current->{$bit}();
                         } else {
                             throw new Shine_Exception_VariableDoesNotExist("Failed lookup for key" . $bit);
                         }
                     }
                 }
             } else {
                 throw new Shine_Exception_VariableDoesNotExist("Failed lookup for key" . $bit);
             }
         }
     }
     return $current;
 }
 /**
  * Create the markup to start an element.
  *
  * @see Walker::start_el() for description of parameters.
  *
  * @param string $output Passed by reference. Used to append additional
  *        content.
  * @param object $item Menu item data object.
  * @param int $depth Depth of menu item. Used for padding.
  * @param object $args See {@Walker::start_el()}.
  * @param int $id See {@Walker::start_el()}.
  */
 public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     global $_nav_menu_placeholder;
     $_nav_menu_placeholder = 0 > $_nav_menu_placeholder ? intval($_nav_menu_placeholder) - 1 : -1;
     $possible_object_id = isset($item->post_type) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder;
     $possible_db_id = !empty($item->ID) && 0 < $possible_object_id ? (int) $item->ID : 0;
     $indent = $depth ? str_repeat("\t", $depth) : '';
     $output .= $indent . '<li>';
     $output .= '<label class="menu-item-title">';
     $output .= '<input type="checkbox" class="menu-item-checkbox';
     if (property_exists($item, 'label')) {
         $title = $item->label;
     }
     $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="' . esc_attr($item->object_id) . '" /> ';
     $output .= isset($title) ? esc_html($title) : esc_html($item->title);
     $output .= '</label>';
     if (empty($item->url)) {
         $item->url = $item->guid;
     }
     if (!in_array(array('umnm-menu', 'umnm-' . $item->post_excerpt . '-nav'), $item->classes)) {
         $item->classes[] = 'umnm-menu';
         $item->classes[] = 'umnm-' . $item->post_excerpt . '-nav';
     }
     // Menu item hidden fields
     $output .= '<input type="hidden" class="menu-item-db-id" name="menu-item[' . $possible_object_id . '][menu-item-db-id]" value="' . $possible_db_id . '" />';
     $output .= '<input type="hidden" class="menu-item-object" name="menu-item[' . $possible_object_id . '][menu-item-object]" value="' . esc_attr($item->object) . '" />';
     $output .= '<input type="hidden" class="menu-item-parent-id" name="menu-item[' . $possible_object_id . '][menu-item-parent-id]" value="' . esc_attr($item->menu_item_parent) . '" />';
     $output .= '<input type="hidden" class="menu-item-type" name="menu-item[' . $possible_object_id . '][menu-item-type]" value="custom" />';
     $output .= '<input type="hidden" class="menu-item-title" name="menu-item[' . $possible_object_id . '][menu-item-title]" value="' . esc_attr($item->title) . '" />';
     $output .= '<input type="hidden" class="menu-item-url" name="menu-item[' . $possible_object_id . '][menu-item-url]" value="' . esc_attr($item->url) . '" />';
     $output .= '<input type="hidden" class="menu-item-target" name="menu-item[' . $possible_object_id . '][menu-item-target]" value="' . esc_attr($item->target) . '" />';
     $output .= '<input type="hidden" class="menu-item-attr_title" name="menu-item[' . $possible_object_id . '][menu-item-attr_title]" value="' . esc_attr($item->attr_title) . '" />';
     $output .= '<input type="hidden" class="menu-item-classes" name="menu-item[' . $possible_object_id . '][menu-item-classes]" value="' . esc_attr(implode(' ', $item->classes)) . '" />';
     $output .= '<input type="hidden" class="menu-item-xfn" name="menu-item[' . $possible_object_id . '][menu-item-xfn]" value="' . esc_attr($item->xfn) . '" />';
 }
 /**
  * Call external Method
  *
  * @param \Smarty_Internal_Data $data
  * @param string                $name external method names
  * @param array                 $args argument array
  *
  * @return mixed
  * @throws SmartyException
  */
 public function _callExternalMethod(Smarty_Internal_Data $data, $name, $args)
 {
     /* @var Smarty $data ->smarty */
     $smarty = isset($data->smarty) ? $data->smarty : $data;
     if (!isset($smarty->ext->{$name})) {
         $class = 'Smarty_Internal_Method_' . ucfirst($name);
         if (preg_match('/^(set|get)([A-Z].*)$/', $name, $match)) {
             if (!isset($this->_property_info[$prop = $match[2]])) {
                 // convert camel case to underscored name
                 $this->resolvedProperties[$prop] = $pn = strtolower(join('_', preg_split('/([A-Z][^A-Z]*)/', $prop, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE)));
                 $this->_property_info[$prop] = property_exists($data, $pn) ? 1 : ($data->_objType == 2 && property_exists($smarty, $pn) ? 2 : 0);
             }
             if ($this->_property_info[$prop]) {
                 $pn = $this->resolvedProperties[$prop];
                 if ($match[1] == 'get') {
                     return $this->_property_info[$prop] == 1 ? $data->{$pn} : $data->smarty->{$pn};
                 } else {
                     return $this->_property_info[$prop] == 1 ? $data->{$pn} = $args[0] : ($data->smarty->{$pn} = $args[0]);
                 }
             } elseif (!class_exists($class)) {
                 throw new SmartyException("property '{$pn}' does not exist.");
             }
         }
         if (class_exists($class)) {
             $callback = array($smarty->ext->{$name} = new $class(), $name);
         }
     } else {
         $callback = array($smarty->ext->{$name}, $name);
     }
     array_unshift($args, $data);
     if (isset($callback) && $callback[0]->objMap | $data->_objType) {
         return call_user_func_array($callback, $args);
     }
     return call_user_func_array(array(new Smarty_Internal_Undefined(), $name), $args);
 }
 function __construct(stdClass $data)
 {
     $this->status = $data->status;
     if (property_exists($data, 'errorDescription')) {
         $this->errorDescription = $data->errorDescription;
     }
 }
Exemple #27
0
 /**
  * Generic getter/setter
  * 
  * @param string $name Name of property
  * @param array  $args Function arguments
  *
  * @throws \Exception
  * 
  * @return void 
  */
 public function __call($name, $args = array())
 {
     // This call method is only for accessors
     if (strlen($name) > 3) {
         // Get the property
         $property = substr($name, 3, strlen($name));
         // All properties will be camelcase, make first, letter lowercase
         $property[0] = strtolower($property[0]);
         // Accessor method
         $accessor = substr($name, 0, 3);
         // Only run code for setters and getters
         if (in_array($accessor, array('set', 'get'))) {
             // Check if property is publically accessible
             if (property_exists($this, $property)) {
                 // Only allow protected variables to be accessed
                 $reflector = new \ReflectionClass(get_class($this));
                 $prop = $reflector->getProperty($property);
                 if ($prop->isPrivate()) {
                     throw new \Exception(sprintf('Unable to %s, property is private: %s:%s', $accessor, __CLASS__, $property));
                 }
             } else {
                 throw new \Exception('Unknown method called: ' . __CLASS__ . ':' . $name);
             }
             switch ($accessor) {
                 case 'set':
                     $this->{$property} = $args[0];
                     return $this;
                 case 'get':
                     return $this->{$property};
             }
         }
     }
 }
 /**
  * Constructor
  *
  * Add a default initializer to ensure the plugin is valid after instance
  * creation.
  *
  * Additionally, the constructor provides forwards compatibility with v3 by
  * overloading the initial argument. v2 usage expects either null or a
  * ConfigInterface instance, and will ignore any other arguments. v3 expects
  * a ContainerInterface instance, and will use an array of configuration to
  * seed the current instance with services. In most cases, you can ignore the
  * constructor unless you are writing a specialized factory for your plugin
  * manager or overriding it.
  *
  * @param null|ConfigInterface|ContainerInterface $configOrContainerInstance
  * @param array $v3config If $configOrContainerInstance is a container, this
  *     value will be passed to the parent constructor.
  * @throws Exception\InvalidArgumentException if $configOrContainerInstance
  *     is neither null, nor a ConfigInterface, nor a ContainerInterface.
  */
 public function __construct($configOrContainerInstance = null, array $v3config = [])
 {
     if (null !== $configOrContainerInstance && !$configOrContainerInstance instanceof ConfigInterface && !$configOrContainerInstance instanceof ContainerInterface) {
         throw new Exception\InvalidArgumentException(sprintf('%s expects a ConfigInterface instance or ContainerInterface instance; received %s', get_class($this), is_object($configOrContainerInstance) ? get_class($configOrContainerInstance) : gettype($configOrContainerInstance)));
     }
     if ($configOrContainerInstance instanceof ContainerInterface) {
         if (property_exists($this, 'serviceLocator')) {
             if (!empty($v3config)) {
                 parent::__construct(new Config($v3config));
             }
             $this->serviceLocator = $configOrContainerInstance;
         }
         if (property_exists($this, 'creationContext')) {
             if (!empty($v3config)) {
                 parent::__construct($v3config);
             }
             $this->creationContext = $configOrContainerInstance;
         }
     }
     if ($configOrContainerInstance instanceof ConfigInterface) {
         parent::__construct($configOrContainerInstance);
     }
     $this->addInitializer(function ($instance) {
         if ($instance instanceof ServiceLocatorAwareInterface) {
             $instance->setServiceLocator($this);
         }
     });
 }
 /**
  * Expose protected entity's properties
  * @param string $propertyName
  * @param mixed  $propertyValue
  */
 public function __set($propertyName, $propertyValue)
 {
     if (!property_exists($this, $propertyName)) {
         return;
     }
     $this->{$propertyName} = $propertyValue;
 }
Exemple #30
0
 function set($properties, $desc = '')
 {
     if (!isset($properties)) {
         return;
     }
     if (is_array($properties)) {
         foreach ($properties as $k => $v) {
             $key = strtolower($k);
             if (floatval(phpversion()) > 5.3) {
                 if (property_exists($this, $key)) {
                     $this->{$key} = $v;
                 }
             } else {
                 if (array_key_exists($key, $this)) {
                     $this->{$key} = $v;
                 }
             }
         }
     } else {
         $this->value = $properties;
         if (!empty($desc)) {
             $this->desc = $desc;
         }
     }
 }