/** * 验证数据 * * @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; }
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'); }); }
protected function dump() { return String::dump('Hello'); }