fixed documentation + typo

This commit is contained in:
César Rodríguez 2013-11-28 15:45:55 +01:00
parent 63695ad7d1
commit cf791cdf9f

View File

@ -41,7 +41,7 @@ class Validator
} }
} }
// set lang in the follow order: constructor param, static::$_lang, defaul to en // set lang in the follow order: constructor param, static::$_lang, default to en
$lang = $lang ?: static::lang(); $lang = $lang ?: static::lang();
// set langDir in the follow order: constructor param, static::$_langDir, default to package lang dir // set langDir in the follow order: constructor param, static::$_langDir, default to package lang dir
$langDir = $langDir ?: static::langDir(); $langDir = $langDir ?: static::langDir();
@ -78,7 +78,11 @@ class Validator
} }
/** /**
* Required field validator * Required field validator
*
* @param $field
* @param $value
* @return bool
*/ */
protected function validateRequired($field, $value) protected function validateRequired($field, $value)
{ {
@ -93,10 +97,11 @@ class Validator
/** /**
* Validate that two values match * Validate that two values match
* *
* @param string $field * @param string $field
* @param mixed $value * @param mixed $value
* @param array $fields * @param array $params
* @return void * @internal param array $fields
* @return bool
*/ */
protected function validateEquals($field, $value, array $params) protected function validateEquals($field, $value, array $params)
{ {
@ -107,9 +112,10 @@ class Validator
/** /**
* Validate that a field is different from another field * Validate that a field is different from another field
* *
* @param string $field * @param string $field
* @param mixed $value * @param mixed $value
* @param array $fields * @param array $params
* @internal param array $fields
* @return bool * @return bool
*/ */
protected function validateDifferent($field, $value, array $params) protected function validateDifferent($field, $value, array $params)
@ -160,9 +166,10 @@ class Validator
/** /**
* Validate the length of a string * Validate the length of a string
* *
* @param string $field * @param string $field
* @param mixed $value * @param mixed $value
* @param array $fields * @param $params
* @internal param array $fields
* @return bool * @return bool
*/ */
protected function validateLength($field, $value, $params) protected function validateLength($field, $value, $params)
@ -193,9 +200,10 @@ class Validator
/** /**
* Validate the size of a field is greater than a minimum value. * Validate the size of a field is greater than a minimum value.
* *
* @param string $field * @param string $field
* @param mixed $value * @param mixed $value
* @param array $fields * @param $params
* @internal param array $fields
* @return bool * @return bool
*/ */
protected function validateMin($field, $value, $params) protected function validateMin($field, $value, $params)
@ -206,9 +214,10 @@ class Validator
/** /**
* Validate the size of a field is less than a maximum value * Validate the size of a field is less than a maximum value
* *
* @param string $field * @param string $field
* @param mixed $value * @param mixed $value
* @param array $fields * @param $params
* @internal param array $fields
* @return bool * @return bool
*/ */
protected function validateMax($field, $value, $params) protected function validateMax($field, $value, $params)
@ -219,9 +228,10 @@ class Validator
/** /**
* Validate a field is contained within a list of values * Validate a field is contained within a list of values
* *
* @param string $field * @param string $field
* @param mixed $value * @param mixed $value
* @param array $fields * @param $params
* @internal param array $fields
* @return bool * @return bool
*/ */
protected function validateIn($field, $value, $params) protected function validateIn($field, $value, $params)
@ -236,9 +246,10 @@ class Validator
/** /**
* Validate a field is not contained within a list of values * Validate a field is not contained within a list of values
* *
* @param string $field * @param string $field
* @param mixed $value * @param mixed $value
* @param array $fields * @param $params
* @internal param array $fields
* @return bool * @return bool
*/ */
protected function validateNotIn($field, $value, $params) protected function validateNotIn($field, $value, $params)
@ -364,8 +375,9 @@ class Validator
/** /**
* Validate that a field passes a regular expression check * Validate that a field passes a regular expression check
* *
* @param string $field * @param string $field
* @param mixed $value * @param mixed $value
* @param $params
* @return bool * @return bool
*/ */
protected function validateRegex($field, $value, $params) protected function validateRegex($field, $value, $params)
@ -388,9 +400,10 @@ class Validator
/** /**
* Validate that a field matches a date format * Validate that a field matches a date format
* *
* @param string $field * @param string $field
* @param mixed $value * @param mixed $value
* @param array $fields * @param $params
* @internal param array $fields
* @return bool * @return bool
*/ */
protected function validateDateFormat($field, $value, $params) protected function validateDateFormat($field, $value, $params)
@ -403,9 +416,10 @@ class Validator
/** /**
* Validate the date is before a given date * Validate the date is before a given date
* *
* @param string $field * @param string $field
* @param mixed $value * @param mixed $value
* @param array $fields * @param $params
* @internal param array $fields
* @return bool * @return bool
*/ */
protected function validateDateBefore($field, $value, $params) protected function validateDateBefore($field, $value, $params)
@ -418,9 +432,10 @@ class Validator
/** /**
* Validate the date is after a given date * Validate the date is after a given date
* *
* @param string $field * @param string $field
* @param mixed $value * @param mixed $value
* @param array $fields * @param $params
* @internal param array $fields
* @return bool * @return bool
*/ */
protected function validateDateAfter($field, $value, $params) protected function validateDateAfter($field, $value, $params)
@ -451,7 +466,10 @@ class Validator
} }
/** /**
* Get array of error messages * Get array of error messages
*
* @param null|string $field
* @return array|bool
*/ */
public function errors($field = null) public function errors($field = null)
{ {
@ -462,7 +480,11 @@ class Validator
} }
/** /**
* Add an error to error messages array * Add an error to error messages array
*
* @param $field
* @param $msg
* @param array $params
*/ */
public function error($field, $msg, array $params = array()) public function error($field, $msg, array $params = array())
{ {
@ -489,6 +511,9 @@ class Validator
/** /**
* Specify validation message to use for error for the last validation rule * Specify validation message to use for error for the last validation rule
*
* @param string $msg
* @return $this
*/ */
public function message($msg) public function message($msg)
{ {
@ -558,6 +583,11 @@ class Validator
/** /**
* Register new validation rule callback * Register new validation rule callback
*
* @param string $name
* @param $callback
* @param string $message
* @throws \InvalidArgumentException
*/ */
public static function addRule($name, $callback, $message = self::ERROR_DEFAULT) public static function addRule($name, $callback, $message = self::ERROR_DEFAULT)
{ {
@ -597,7 +627,8 @@ class Validator
} }
/** /**
* @param array $labels * @param $value
* @internal param array $labels
* @return $this * @return $this
*/ */
public function label($value) public function label($value)
@ -620,6 +651,8 @@ class Validator
/** /**
* @param $field * @param $field
* @param $msg
* @param $params
* @return array * @return array
*/ */
private function checkAndSetLabel($field, $msg, $params) private function checkAndSetLabel($field, $msg, $params)
@ -645,6 +678,7 @@ class Validator
/** /**
* Convenience method to add multiple validation rules with an array * Convenience method to add multiple validation rules with an array
* @param array $rules
*/ */
public function rules($rules) public function rules($rules)
{ {