[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/languages/utils/ -> CLDRPluralRuleConverterFragment.php (source)

   1  <?php
   2  /**
   3   * @author Niklas Laxström, Tim Starling
   4   *
   5   * @copyright Copyright © 2010-2012, Niklas Laxström
   6   * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
   7   *
   8   * @file
   9   * @since 1.20
  10   */
  11  
  12  /**
  13   * Helper for CLDRPluralRuleConverter.
  14   * The base class for operators and expressions, describing a region of the input string.
  15   */
  16  class CLDRPluralRuleConverterFragment {
  17      public $parser, $pos, $length, $end;
  18  
  19  	function __construct( $parser, $pos, $length ) {
  20          $this->parser = $parser;
  21          $this->pos = $pos;
  22          $this->length = $length;
  23          $this->end = $pos + $length;
  24      }
  25  
  26  	public function error( $message ) {
  27          $text = $this->getText();
  28          throw new CLDRPluralRuleError( "$message at position " . ( $this->pos + 1 ) . ": \"$text\"" );
  29      }
  30  
  31  	public function getText() {
  32          return substr( $this->parser->rule, $this->pos, $this->length );
  33      }
  34  }


Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1