Skip to content

Commit

Permalink
Use native PHP to read IBAN files
Browse files Browse the repository at this point in the history
  • Loading branch information
slackero committed Jan 14, 2024
1 parent fe54841 commit 6207512
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions utils/obfuscation-test.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
<?php
require_once dirname(__DIR__) . '/php-iban.php';

$dir = dirname(__FILE__);
$ibans = `cat $dir/example-ibans/*`;
$lines = explode("\n", $ibans);
foreach ($lines as $iban) {
$example_iban_files = glob(__DIR__ . '/example-ibans/*');
if (count($example_iban_files) == 0) {
echo 'No example IBAN files found in "' . __DIR__ . '/example-ibans"' . "\n";
exit(1);
}

$ibans = [];
foreach ($example_iban_files as $file) {
if (is_readable($file)) {
$ibans += file($file);
}
}
foreach($ibans as $iban) {
$iban = iban_to_machine_format($iban);
print iban_to_human_format($iban) . "\n";
print iban_to_obfuscated_format($iban) . "\n";
echo iban_to_human_format($iban) . "\n";
echo iban_to_obfuscated_format($iban) . "\n";
}

0 comments on commit 6207512

Please sign in to comment.