-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php namespace October\Rain\Validation; | ||
|
||
use Illuminate\Contracts\Validation\Rule as RuleContract; | ||
|
||
/** | ||
* Rule is an umbrella class for the Illuminate rule contract. | ||
* | ||
* @package october\validation | ||
* @author Alexey Bobkov, Samuel Georges | ||
*/ | ||
abstract class Rule implements RuleContract | ||
{ | ||
/** | ||
* passes determines if the validation rule passes. | ||
* @param string $attribute | ||
* @param mixed $value | ||
* @return bool | ||
*/ | ||
abstract public function passes($attribute, $value); | ||
|
||
/** | ||
* message gets the validation error message. | ||
* @return string | ||
*/ | ||
abstract public function message(); | ||
|
||
/** | ||
* validate callback method. | ||
* @param string $attribute | ||
* @param mixed $value | ||
* @param array $params | ||
* @return bool | ||
*/ | ||
public function validate($attribute, $value, $params) | ||
{ | ||
return $this->passes($attribute, $value); | ||
} | ||
|
||
/** | ||
* replacer defines custom placeholder replacements. | ||
* @param string $message | ||
* @param string $attribute | ||
* @param mixed $rule | ||
* @param array $params | ||
* @return string | ||
*/ | ||
public function replacer($message, $attribute, $rule, $params) | ||
{ | ||
return $message; | ||
} | ||
} |