public function matches($pattern, $failMessage = null) { if (preg_match($pattern, $this->valueIsSet()->value) === 1) { $this->pass(); } else { $this->fail($failMessage ?: $this->_('%s does not match %s', $this, $pattern)); } return $this; }