Commit eed17f70 authored by Zéfling's avatar Zéfling 🎨
Browse files

Mise à jour PHP8 du script de conversion et màj de RangeMessage.xml

parent e91c243b
This diff is collapsed.
<?php
// chemin du ficher XML repris sur https://www.isbn-international.org/range_file_generation
// Pour générer : `php ./isbn13_xml2php.php > isbn_map.php`
$file = 'isbn13/RangeMessage.xml';
if (file_exists($file)) {
$xml = simplexml_load_file($file);
$messageDate = $xml->MessageDate;
$messageSerialNumber = $xml->MessageSerialNumber;
echo "<?php
/* ***** BEGIN LICENSE BLOCK *****
......@@ -25,7 +30,7 @@ License.
The Original Code is : EAN13.
The Initial Developer of the Original Code is Zéfling.
Portions created by the Initial Developer are Copyright (C) 2014
Portions created by the Initial Developer are Copyright (C) 2021
the Initial Developer. All Rights Reserved.
Contributor(s):
......@@ -36,19 +41,18 @@ Contributor(s):
/*
* Conversion PHP du tableau pour les tirets
*
* Source : <br>
* Generated from RangeMessage.xml with isbn13_xml2php.php <br>
* Available from https://www.isbn-international.org/range_file_generation <br>
* MessageDate => ${$xml['MessageDate']} <br>
* MessageSerialNumber=> ${$xml['MessageSerialNumber']}
* Source:
* - Generated from RangeMessage.xml with isbn13_xml2php.php
* - Available from https://www.isbn-international.org/range_file_generation
* - MessageDate => $messageDate <br>
* - MessageSerialNumber=> $messageSerialNumber
*/
/**
* Liste des groupes ISBN
* @author Zéfling (2019 - http://ikilote.net/fr/Blog/Techno-magis.html)
* @version 2019-12-25
* @author Zéfling (2021 - http://ikilote.net/fr/Blog/Techno-magis.html)
* @version 2021-07-04
*/
final class ISBN_Map {
public static \$groups_length = [\n";
......@@ -68,11 +72,10 @@ final class ISBN_Map {
for($j = 0; $j < $rules_count; $j++) {
list($min_str, $max_str) = explode('-', $rules[$j]->Range);
$length = $rules[$j]->Length;
$groups[] = [
min => intval($min_str),
max => intval($max_str),
length => each($rules[$j]->Length)['value'],
'min' => intval($min_str),
'max' => intval($max_str),
'length' => current($rules[$j]->Length),
];
}
......@@ -80,7 +83,7 @@ final class ISBN_Map {
return $a['max'] <=> $b['max'];
});
$list[each($ucc[$i]->Prefix)['value']] = $groups;
$list[current($ucc[$i]->Prefix)] = $groups;
}
krsort($list);
......@@ -124,9 +127,9 @@ final class ISBN_Map {
list($min_str, $max_str) = explode('-', $rules[$j]->Range);
$length = $rules[$j]->Length;
$groups[] = [
min => intval($min_str),
max => intval($max_str),
length => each($rules[$j]->Length)['value'],
'min' => intval($min_str),
'max' => intval($max_str),
'length' => current($rules[$j]->Length),
];
}
......@@ -134,7 +137,7 @@ final class ISBN_Map {
return $a['max'] <=> $b['max'];
});
$list[each($group[$i]->Prefix)['value']] = $groups;
$list[current($group[$i]->Prefix)] = $groups;
}
krsort($list);
......@@ -146,9 +149,9 @@ final class ISBN_Map {
$j_count = count( $groups );
foreach($groups as $group) {
echo " [
'max' => ${group['max']},
'max' => ${group['max']},
'length' => ${group['length']},
'min' => ${group['min']}
'min' => ${group['min']}
]";
echo $j !== $rules_count - 1 ? ",\n" : "\n";
}
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment