Skip to content

Commit

Permalink
added dockblock in code
Browse files Browse the repository at this point in the history
  • Loading branch information
rakibdevs committed Jun 30, 2022
1 parent 0acf42e commit 8dd5c35
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
29 changes: 25 additions & 4 deletions src/Parser/PassportMrzParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class PassportMrzParser implements ParserInterface
*
* PTUNKKONI<<MARTINA<<<<<<<<<<<<<<<<<<<<<<<<<<
* K0503499<8UNK9701241F06022201170650553<<<<10
*
* @param string $text
* @return self
*/
protected function setText(string $text): self
{
Expand All @@ -36,6 +39,8 @@ protected function setText(string $text): self

/**
* Set Name String
*
* @return self
*/
protected function setNameString(): self
{
Expand All @@ -46,6 +51,8 @@ protected function setNameString(): self

/**
* Extract information
*
* @return self
*/
protected function extract(): self
{
Expand All @@ -59,6 +66,8 @@ protected function extract(): self

/**
* Second row first 9 character alpha+num+< Passport number
*
* @return null|string
*/
protected function getCardNo(): ?string
{
Expand All @@ -70,6 +79,8 @@ protected function getCardNo(): ?string

/**
* Get Passport Issuer
*
* @return null|string
*/
protected function getIssuer(): ?string
{
Expand All @@ -81,6 +92,8 @@ protected function getIssuer(): ?string
/**
* Get Date of Expiry
* Second row 22–27 character: (YYMMDD)
*
* @return null|string
*/
protected function getDateOfExpiry(): ?string
{
Expand All @@ -92,6 +105,8 @@ protected function getDateOfExpiry(): ?string
/**
* Get Date of Birth
* Second row 14–19 character: (YYMMDD)
*
* @return null|string
*/
protected function getDateOfBirth(): ?string
{
Expand All @@ -102,8 +117,9 @@ protected function getDateOfBirth(): ?string

/**
* Get First Name from Name String
* For Ex, MARTINA<<<<<<<<<<<<<<<<<<<<<<<<<<
*
* MARTINA<<<<<<<<<<<<<<<<<<<<<<<<<<
* @return null|string
*/
protected function getFirstName(): ?string
{
Expand All @@ -113,15 +129,17 @@ protected function getFirstName(): ?string
/**
* Get Last Name from Name String
*
* @return null|string
*/
protected function getLastName(): ?string
{
return $this->nameString[0] ?? null;
}

/**
* Get Gender
* Position 21, M/F/<
* Get Gender from Position 21, M/F/<
*
* @return null|string
*
*/
protected function getGender(): ?string
Expand All @@ -131,8 +149,9 @@ protected function getGender(): ?string

/**
* Get Personal Number
*
* 29–42 alpha+num+< (may be used by the issuing country as it desires)
*
* @return null|string
*/
protected function getPersonalNumber(): ?string
{
Expand All @@ -141,6 +160,8 @@ protected function getPersonalNumber(): ?string

/**
* Get Nationality
*
* @return null|string
*/
protected function getNationality(): ?string
{
Expand Down
6 changes: 6 additions & 0 deletions src/Traits/CountryMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,12 @@ trait CountryMapper
"GBS" => "United Kingdom of Great Britain and Northern Ireland Subject", // British Subject
];

/**
* Map country name based on code
*
* @param string|null $code
* @return string|null
*/
public function mapCountry(string $code = null): ?string
{
$allCountry = array_merge(
Expand Down
6 changes: 6 additions & 0 deletions src/Traits/GenderMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

trait GenderMapper
{
/**
* Map Gender based on Code (M/F)
*
* @param string|null $code
* @return string|null
*/
public function mapGender(string $code = null): ?string
{
return match ($code) {
Expand Down

0 comments on commit 8dd5c35

Please sign in to comment.