MediaWiki  REL1_23
CLDRPluralRuleConverter_Fragment.php
Go to the documentation of this file.
00001 <?php
00002 
00017 class CLDRPluralRuleConverter_Fragment {
00018     public $parser, $pos, $length, $end;
00019 
00020     function __construct( $parser, $pos, $length ) {
00021         $this->parser = $parser;
00022         $this->pos = $pos;
00023         $this->length = $length;
00024         $this->end = $pos + $length;
00025     }
00026 
00027     public function error( $message ) {
00028         $text = $this->getText();
00029         throw new CLDRPluralRuleError( "$message at position " . ( $this->pos + 1 ) . ": \"$text\"" );
00030     }
00031 
00032     public function getText() {
00033         return substr( $this->parser->rule, $this->pos, $this->length );
00034     }
00035 }