Skip to content

Commit

Permalink
Implemented getDefinition method.
Browse files Browse the repository at this point in the history
  • Loading branch information
juanparati authored and JuanLeadSupply committed Nov 9, 2017
1 parent c5aae64 commit 2d40877
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Definitions/Contracts/MobileNumbers.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,12 @@ public function stripCountryCode($number) : string;
public function addCountryCode($number) : string;


/**
* Get definition info.
*
* @return array
*/
public function getDefinition() : array;


}
16 changes: 16 additions & 0 deletions src/Definitions/MobileNumbers.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,22 @@ public function addCountryCode($number): string
}


/**
* Return definition info.
*
* @return array
*/
public function getDefinition(): array
{
return [
'country_alpha_code' => $this->country_alpha_code,
'country_code' => '+' . $this->country_code,
'country_flag' => $this->country_flag,
'valid_prefix_codes' => $this->valid_prefix_codes
];
}


/**
* Validate phone number.
*
Expand Down
11 changes: 11 additions & 0 deletions src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,15 @@ public function addCountryCode($number) : string
return $this->definition->addCountryCode($number);
}


/**
* Return definition info.
*
* @return array
*/
public function getDefinition() : array
{
return $this->definition->getDefinition();
}

}

0 comments on commit 2d40877

Please sign in to comment.