示例#1
0
文件: Alnum.php 项目: nevvermind/zf2
 /**
  * Sets default option values for this instance
  *
  * @param  boolean $allowWhiteSpace
  * @return void
  */
 public function __construct($options = false)
 {
     if ($options instanceof Config) {
         $options = $options->toArray();
     } elseif (!is_array($options)) {
         $options = func_get_args();
         $temp = array();
         if (!empty($options)) {
             $temp['allowWhiteSpace'] = array_shift($options);
         }
         if (!empty($options)) {
             $temp['locale'] = array_shift($options);
         }
         $options = $temp;
     }
     if (null === self::$unicodeEnabled) {
         self::$unicodeEnabled = @preg_match('/\\pL/u', 'a') ? true : false;
     }
     if (array_key_exists('allowWhiteSpace', $options)) {
         $this->setAllowWhiteSpace($options['allowWhiteSpace']);
     }
     if (!array_key_exists('locale', $options)) {
         $options['locale'] = null;
     }
     $this->setLocale($options['locale']);
 }