This repository has been archived by the owner on Jul 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from anetwork/develop
Added new validation
- Loading branch information
Showing
3 changed files
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 |
---|---|---|
|
@@ -320,4 +320,20 @@ public function Less($attribute, $value, $parameters) | |
|
||
} | ||
|
||
/** | ||
* iran phone number | ||
* @param $attribute $value | ||
* @author Shahrokh Niakan <[email protected]> | ||
* @since Agu 24, 2016 | ||
* @return boolean | ||
*/ | ||
public function IranPhone($attribute, $value) | ||
{ | ||
|
||
$this->status = preg_match('/^((0)([1-9]{2})([0-9]{8}))+$/', $value) ; | ||
|
||
return ( $this->status ? true : false ); | ||
|
||
} | ||
|
||
} |
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 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 |
---|---|---|
|
@@ -415,4 +415,27 @@ public function testLess() | |
$this->assertEquals(false, $this->PersianValidation->Less($this->attribute, $this->value, $this->parameters)); | ||
|
||
} | ||
|
||
/** | ||
* iran phone number | ||
* @author Shahrokh Niakan <[email protected]> | ||
* @since Agu 24, 2016 | ||
* @return void | ||
*/ | ||
public function testIranPhone() | ||
{ | ||
|
||
$this->value = '08337236555'; | ||
|
||
$this->assertEquals(true, $this->PersianValidation->IranPhone($this->attribute, $this->value)); | ||
|
||
$this->value = '21372365544'; | ||
|
||
$this->assertEquals(false, $this->PersianValidation->IranPhone($this->attribute, $this->value)); | ||
|
||
$this->value = '021372365541'; | ||
|
||
$this->assertEquals(false, $this->PersianValidation->IranPhone($this->attribute, $this->value)); | ||
|
||
} | ||
} |