當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DataValidator::value_appears_in方法代碼示例

本文整理匯總了PHP中DataValidator::value_appears_in方法的典型用法代碼示例。如果您正苦於以下問題:PHP DataValidator::value_appears_in方法的具體用法?PHP DataValidator::value_appears_in怎麽用?PHP DataValidator::value_appears_in使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DataValidator的用法示例。


在下文中一共展示了DataValidator::value_appears_in方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: isValidSpecialForm

 /**
  * isValidSpecialForm: Tells us if the ffname supplied is a valid
  * special form for the current gateway.
  * @var string $ffname The form name we want to try
  * @return boolean True if this is a valid special form, otherwise false
  */
 public function isValidSpecialForm($ffname)
 {
     $defn = GatewayFormChooser::getFormDefinition($ffname);
     if (is_array($defn) && DataValidator::value_appears_in($this->getIdentifier(), $defn['gateway']) && array_key_exists('special_type', $defn)) {
         return true;
     }
     return false;
 }
開發者ID:wikimedia,項目名稱:wikimedia-fundraising-crm-vendor,代碼行數:14,代碼來源:gateway.adapter.php

示例2: value_appears_in

 /**
  * Test to determine if a value appears in a haystack. The haystack may have
  * explicit +/- rules (a - will take precedence over a +; if there is no
  * + rule, but there is a - rule everything is implicitly accepted); and may
  * also have an 'ALL' condition.
  *
  * @param mixed $needle Value, or array of values, to match
  * @param mixed $haystack Value, or array of values, that are acceptable
  * @return bool
  */
 public static function value_appears_in($needle, $haystack)
 {
     $needle = is_array($needle) ? $needle : array($needle);
     $haystack = is_array($haystack) ? $haystack : array($haystack);
     $plusCheck = array_key_exists('+', $haystack);
     $minusCheck = array_key_exists('-', $haystack);
     if ($plusCheck || $minusCheck) {
         // With +/- checks we will first explicitly deny anything in '-'
         // Then if '+' is defined accept anything there
         //    but if '+' is not defined we just let everything that wasn't denied by '-' through
         // Otherwise we assume both were defined and deny everything :)
         if ($minusCheck && DataValidator::value_appears_in($needle, $haystack['-'])) {
             return false;
         }
         if ($plusCheck && DataValidator::value_appears_in($needle, $haystack['+'])) {
             return true;
         } elseif (!$plusCheck) {
             // Implicit acceptance
             return true;
         }
         return false;
     }
     if (count($haystack) === 1 && in_array('ALL', $haystack)) {
         // If the haystack can accept anything, then whoo!
         return true;
     }
     $haystack = array_filter($haystack, function ($value) {
         return !is_array($value);
     });
     $result = array_intersect($haystack, $needle);
     if (!empty($result)) {
         return true;
     } else {
         return false;
     }
 }
開發者ID:wikimedia,項目名稱:wikimedia-fundraising-crm-vendor,代碼行數:46,代碼來源:DataValidator.php

示例3: prefAllowedBySpec

 protected static function prefAllowedBySpec($prefs, $prefKey, $form, $formKey)
 {
     // we only filter on keys that exist
     if (empty($prefs[$prefKey]) || empty($form[$formKey])) {
         return true;
     }
     $prefValue = $prefs[$prefKey];
     $formSetting = $form[$formKey];
     return DataValidator::value_appears_in($prefValue, $formSetting);
 }
開發者ID:wikimedia,項目名稱:wikimedia-fundraising-crm-vendor,代碼行數:10,代碼來源:GatewayFormChooser.php


注:本文中的DataValidator::value_appears_in方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。