Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ composer.lock

/build
/vendor

/.idea/
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
],
"require": {
"php": ">=5.3.0",
"php": ">=5.6.0",
"lib-pcre": ">=7.3"
},
"require-dev": {
Expand Down
13 changes: 13 additions & 0 deletions src/CreditCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ class CreditCard
'cvcLength' => array(3),
'luhn' => true,
),
'mir' => array(
'type' => 'mir',
'pattern' => '/^220[0-4]/',
'length' => array(16),
'cvcLength' => array(3),
'luhn' => true,
),
// Credit cards
'visa' => array(
'type' => 'visa',
Expand Down Expand Up @@ -119,6 +126,12 @@ public static function validCreditCard($number, $type = null)
);
}

$ret['validation'] = array(
'pattern' => !empty($type) && self::validPattern($number, $type),
'length' => !empty($type) && self::validLength($number, $type),
'luhn' => !empty($type) && self::validLuhn($number, $type),
);

return $ret;
}

Expand Down
7 changes: 7 additions & 0 deletions tests/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ class Test extends PHPUnit_Framework_TestCase
'dankort' => array(
'5019717010103742',
),
'mir' => array(
'2200524572467853',
'2201338708835472',
'2202410737880339',
'2203027541752030',
'2204500360586886',
),

// Credit cards
'visa' => array(
Expand Down