public function filter($var) { $var = parent::filter($var); if (!preg_match($this->options['regex'], $var)) { return null; } return $var; }
/** * @dataProvider provideTestFilter */ public function testFilter($options, $raw, $filtered, $valid) { $int = new Strings($options); $this->assertEquals($filtered, $int->filter($raw)); $this->assertEquals($valid, $int->validate($raw)); }