当前位置: 首页>>代码示例>>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;未经允许,请勿转载。