X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Flanguage%2FgenerateNormalizerDataAr.php;h=90ca41e2a6eee95292e6ce790a58d6f4cbc15133;hb=fdb07d74e63ed3f0c09e548ae43b23b147bb54e6;hp=52ed81fbdcea201f52a11063493f2ef396e4cbbf;hpb=4618f70793d1178ca4c646ef397cf17b1cc70b44;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/language/generateNormalizerDataAr.php b/maintenance/language/generateNormalizerDataAr.php index 52ed81fbdc..90ca41e2a6 100644 --- a/maintenance/language/generateNormalizerDataAr.php +++ b/maintenance/language/generateNormalizerDataAr.php @@ -33,7 +33,7 @@ require_once __DIR__ . '/../Maintenance.php'; class GenerateNormalizerDataAr extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = 'Generate the normalizer data file for Arabic'; + $this->addDescription( 'Generate the normalizer data file for Arabic' ); $this->addOption( 'unicode-data-file', 'The local location of the data file ' . 'from http://unicode.org/Public/UNIDATA/UnicodeData.txt', false, true ); } @@ -46,26 +46,23 @@ class GenerateNormalizerDataAr extends Maintenance { if ( !$this->hasOption( 'unicode-data-file' ) ) { $dataFile = 'UnicodeData.txt'; if ( !file_exists( $dataFile ) ) { - $this->error( "Unable to find UnicodeData.txt. Please specify " . + $this->fatalError( "Unable to find UnicodeData.txt. Please specify " . "its location with --unicode-data-file=" ); - exit( 1 ); } } else { $dataFile = $this->getOption( 'unicode-data-file' ); if ( !file_exists( $dataFile ) ) { - $this->error( 'Unable to find the specified data file.' ); - exit( 1 ); + $this->fatalError( 'Unable to find the specified data file.' ); } } $file = fopen( $dataFile, 'r' ); if ( !$file ) { - $this->error( 'Unable to open the data file.' ); - exit( 1 ); + $this->fatalError( 'Unable to open the data file.' ); } // For the file format, see http://www.unicode.org/reports/tr44/ - $fieldNames = array( + $fieldNames = [ 'Code', 'Name', 'General_Category', @@ -81,9 +78,9 @@ class GenerateNormalizerDataAr extends Maintenance { 'Simple_Uppercase_Mapping', 'Simple_Lowercase_Mapping', 'Simple_Titlecase_Mapping' - ); + ]; - $pairs = array(); + $pairs = []; $lineNum = 0; while ( false !== ( $line = fgets( $file ) ) ) { @@ -97,7 +94,7 @@ class GenerateNormalizerDataAr extends Maintenance { # Split fields $numberedData = explode( ';', $line ); - $data = array(); + $data = []; foreach ( $fieldNames as $number => $name ) { $data[$name] = $numberedData[$number]; } @@ -130,5 +127,5 @@ class GenerateNormalizerDataAr extends Maintenance { } } -$maintClass = 'GenerateNormalizerDataAr'; +$maintClass = GenerateNormalizerDataAr::class; require_once RUN_MAINTENANCE_IF_MAIN;