当前位置: 首页>>代码示例>>PHP>>正文


PHP property_exists函数代码示例

本文整理汇总了PHP中property_exists函数的典型用法代码示例。如果您正苦于以下问题:PHP property_exists函数的具体用法?PHP property_exists怎么用?PHP property_exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了property_exists函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 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);
 }
开发者ID:wst,项目名称:spindash,代码行数:7,代码来源:model-manager.inc.php

示例2: __set

 public function __set($property, $value)
 {
     if (property_exists($this, $property)) {
         $this->{$property} = $value;
     }
     return $this;
 }
开发者ID:omusico,项目名称:RentSquare,代码行数:7,代码来源:BankCard.php

示例3: getItem

 /**
  * 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;
 }
开发者ID:sankam-nikolya,项目名称:lptt,代码行数:37,代码来源:edit.php

示例4: getLogout

 /**
  * 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 : '/');
 }
开发者ID:dmorgorg,项目名称:photos,代码行数:12,代码来源:AuthController.php

示例5: fromObject

 /**
  * @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;
 }
开发者ID:Ingenico-ePayments,项目名称:connect-sdk-php,代码行数:35,代码来源:HostedCheckoutSpecificInput.php

示例6: createEvent

 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;
 }
开发者ID:phmLabs,项目名称:Koalamon,代码行数:31,代码来源:MonitisFormat.php

示例7: fromObject

 /**
  * @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;
 }
开发者ID:Ingenico-ePayments,项目名称:connect-sdk-php,代码行数:37,代码来源:RedirectPaymentMethodSpecificInput.php

示例8: GetValue

 /**
  * 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;
 }
开发者ID:antonsmolin,项目名称:google-ads-api-namespaced,代码行数:39,代码来源:OgnlUtils.php

示例9: __set

 /**
  * @param string $property
  * @param mixed  $value
  */
 public function __set($property, $value)
 {
     if (!property_exists($this, $property)) {
         //$this->unknownProperties[$property] = $value;
         $this->{$property} = $value;
     }
 }
开发者ID:uaktags,项目名称:ngcsv1,代码行数:11,代码来源:AbstractEntity.php

示例10: escape

 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;
 }
开发者ID:joseph-montanez,项目名称:Website-IDE,代码行数:29,代码来源:Template.php

示例11: get

 /**
  * 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;
 }
开发者ID:noclav,项目名称:UpdatePackages,代码行数:13,代码来源:Field.php

示例12: extractProperty

 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};
 }
开发者ID:maniaplanet,项目名称:dedicated-server-api,代码行数:7,代码来源:AbstractStructure.php

示例13: getStatusText

 /**
  * Get status text.
  *
  * @return string
  */
 public function getStatusText()
 {
     if (property_exists($this, 'statusText')) {
         return $this->{'statusText'};
     }
     return null;
 }
开发者ID:borobudur-php,项目名称:borobudur-http,代码行数:12,代码来源:HttpStatusTrait.php

示例14: __get

 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)));
 }
开发者ID:mheydt,项目名称:scalr,代码行数:7,代码来源:AbstractGetter.php

示例15: updateAttribute

 /**
  * 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;
 }
开发者ID:Gameonn,项目名称:uber-php,代码行数:15,代码来源:GetSetTrait.php


注:本文中的property_exists函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。