示例#1
0
 /**
  * 验证数据
  *
  * @param string $value
  * @return boolean
  */
 public function validate($value)
 {
     if (!is_scalar($value)) {
         return false;
     }
     $value = (string) $value;
     $len = String::strlen($value);
     return $len >= $this->min_len && $len <= $this->max_len;
 }
示例#2
0
 public function testLength()
 {
     $string = new String('Hello, world');
     $this->assertEquals(12, $string->length());
 }
 protected function dump()
 {
     \filter\Filter::on(isset($this) ? $this : get_called_class(), __FUNCTION__, func_get_args(), function ($chain) {
         return String::dump('Hello');
     });
 }
示例#4
0
 protected function dump()
 {
     return String::dump('Hello');
 }