'Password confirmation does not match', self::MISSING_FIELD_NAME => 'No confirm password field name', ); public function __construct($fieldName = null) { if (null !== $fieldName) { $this->setFieldName($fieldName); } } public function setFieldName($fieldName) { $this->_fieldName = (string) $fieldName; return $this; } public function getFieldName() { return $this->_fieldName; } public function isValid($value, $context = null) { $value = (string) $value; $this->_setValue($value); $fieldName = $this->getFieldName(); if (empty($fieldName)) { $this->_error(self::MISSING_FIELD_NAME); return false; } if (is_array($context)) { if (isset($context[$fieldName]) && ($value == $context[$fieldName])) { return true; } } elseif (is_string($context) && ($value == $context)) { return true; } $this->_error(self::NOT_MATCH); return false; } }