This repository has been archived by the owner on Apr 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Alphametric
committed
Apr 8, 2019
1 parent
7a5cdcf
commit d33c6f5
Showing
9 changed files
with
67 additions
and
376 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,40 @@ | ||
<?php | ||
|
||
// Namespace | ||
namespace Alphametric\Validation\Rules; | ||
|
||
// Mac address rule | ||
class MacAddress extends Rule | ||
{ | ||
|
||
/** | ||
* Determine if the validation rule passes. | ||
* | ||
* @param string $attribute. | ||
* @param mixed $value. | ||
* @return bool. | ||
* | ||
**/ | ||
public function passes($attribute, $value) | ||
{ | ||
return preg_match("/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/", $value); | ||
} | ||
|
||
|
||
|
||
/** | ||
* Get the validation error message. | ||
* | ||
* @param none. | ||
* @return string. | ||
* | ||
**/ | ||
public function message() | ||
{ | ||
return Helper::getLocalizedErrorMessage( | ||
'mac_address', | ||
'The :attribute must be a valid MAC address' | ||
); | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.