Skip to content

Commit 2b623a4

Browse files
committed
Initial import
Extracted from MediaWiki Change-Id: Iefcb14e6a0d07fe18e1b621cbd767d986db0dcc1
1 parent 7812f9a commit 2b623a4

File tree

16 files changed

+1441
-0
lines changed

16 files changed

+1441
-0
lines changed

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.gitattributes export-ignore
2+
.gitignore export-ignore
3+
.gitreview export-ignore
4+
.jshintrc export-ignore
5+
composer.json export-ignore
6+
phpcs.xml export-ignore
7+
phpunit.xml.dist export-ignore
8+
tests/ export-ignore
9+
Doxyfile export-ignore

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/vendor
2+
/composer.lock

COPYING

Lines changed: 339 additions & 0 deletions
Large diffs are not rendered by default.

Doxyfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Configuration file for Doxygen
2+
3+
PROJECT_NAME = CLDR Plural Rule Parser
4+
PROJECT_BRIEF = Parses CLDR plural rules
5+
OUTPUT_DIRECTORY = doc
6+
JAVADOC_AUTOBRIEF = YES
7+
QT_AUTOBRIEF = YES
8+
WARN_NO_PARAMDOC = YES
9+
INPUT = README.md src/
10+
FILE_PATTERNS = *.php
11+
RECURSIVE = YES
12+
USE_MDFILE_AS_MAINPAGE = README.md
13+
HTML_DYNAMIC_SECTIONS = YES
14+
GENERATE_TREEVIEW = YES
15+
TREEVIEW_WIDTH = 250
16+
GENERATE_LATEX = NO
17+
HAVE_DOT = YES
18+
DOT_FONTNAME = Helvetica
19+
DOT_FONTSIZE = 10
20+
TEMPLATE_RELATIONS = YES
21+
CALL_GRAPH = NO
22+
CALLER_GRAPH = NO
23+
DOT_MULTI_TARGETS = YES

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
CLDRPluralRuleParser
2+
=============
3+
4+
CLDRPluralRuleParser is a PHP library for parsing
5+
[http://cldr.unicode.org/index/cldr-spec/plural-rules](plural rules) specified in the
6+
[http://cldr.unicode.org/index](CLDR project).
7+
8+
This library does not contain the rules from the CLDR project, you have to get them yourself.
9+
10+
Here is how you use it:
11+
12+
<pre lang="php">
13+
use CLDRPluralRuleParser\Evaluator;
14+
15+
// Example for English
16+
$rules = ['i = 1 and v = 0'];
17+
$forms = ['syntax error', 'syntax errors'];
18+
19+
for ( $i = 0; $i < 3; $i++ ) {
20+
$index = Evaluator::evaluate( $i, $rules );
21+
echo "This code has $i {$forms[$i]}\n";
22+
}
23+
24+
// This code has 0 syntax errors
25+
// This code has 1 syntax error
26+
// This code has 2 syntax errors
27+
</pre>
28+
29+
License
30+
-------
31+
32+
The project is licensed under the GPL license 2 or later.

composer.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "wikimedia/cldr-plural-rule-parser",
3+
"description": "Evaluates plural rules specified in the CLDR project notation.",
4+
"license": "GPL-2.0+",
5+
"homepage": "https://www.mediawiki.org/wiki/CLDRPluralRuleParser",
6+
"authors": [
7+
{
8+
"name": "Tim Starling",
9+
"email": "tstarling@wikimedia.org"
10+
},
11+
{
12+
"name": "Niklas Laxström",
13+
"email": "niklas.laxstrom@gmail.com"
14+
}
15+
],
16+
"autoload": {
17+
"psr-4": {
18+
"CLDRPluralRuleParser\\": "src/"
19+
}
20+
},
21+
"autoload-dev": {
22+
"psr-4": {
23+
"CLDRPluralRuleParser\\Test\\": "tests/"
24+
}
25+
},
26+
"require": {
27+
"php": ">=5.3.3"
28+
},
29+
"require-dev": {
30+
"jakub-onderka/php-parallel-lint": "^0.9.0.0",
31+
"phpunit/phpunit": "^4.7.7.0",
32+
"mediawiki/mediawiki-codesniffer": "^0.3.0.0"
33+
},
34+
"scripts": {
35+
"test": [
36+
"parallel-lint . --exclude vendor",
37+
"phpunit $PHPUNIT_ARGS",
38+
"phpcs -p"
39+
]
40+
}
41+
}

phpcs.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0"?>
2+
<ruleset>
3+
<rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki"/>
4+
5+
<file>.</file>
6+
<arg name="encoding" value="UTF-8"/>
7+
<arg name="extensions" value="php"/>
8+
<exclude-pattern>coverage</exclude-pattern>
9+
<exclude-pattern>vendor</exclude-pattern>
10+
<exclude-pattern>doc/html</exclude-pattern>
11+
</ruleset>

phpunit.xml.dist

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<phpunit colors="true"
2+
beStrictAboutTestsThatDoNotTestAnything="true"
3+
beStrictAboutOutputDuringTests="true">
4+
<testsuites>
5+
<testsuite name="CLDRPluralRuleParser Tests">
6+
<directory>./tests</directory>
7+
</testsuite>
8+
</testsuites>
9+
<filter>
10+
<whitelist addUncoveredFilesFromWhitelist="true">
11+
<directory suffix=".php">./src</directory>
12+
</whitelist>
13+
</filter>
14+
</phpunit>

0 commit comments

Comments
 (0)