diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index 855272a..0000000
--- a/.gitattributes
+++ /dev/null
@@ -1,7 +0,0 @@
-# *.php diff=php
-
-#/.gitattributes export-ignore
-#/.gitignore export-ignore
-#/.php_cs export-ignore
-#/.travis.ini export-ignore
-#/.travis.yml export-ignore
diff --git a/.gitignore b/.gitignore
index 8394ebf..4395ff4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+/bin/
+!/bin/.gitkeep
/build/
/vendor/
composer.lock
@@ -5,7 +7,8 @@ composer.lock
/.php_cs.cache
/nbproject/
/res/protected/
-/.idea
+/.idea/*.*
+!/.idea/codeStyles/*
/doc/api/*
/libpairtwo-*-dist.zip
@@ -13,3 +16,5 @@ composer.lock
/dist/vendor/
/dist/composer.json
/dist/doc/
+
+/.phpdoc
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..35629c3
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ GETTERS_AND_SETTERS
+ KEEP
+
+
+
+
+
+
+ true
+
+ BY_NAME
+
+
+
+
+
+ true
+
+ BY_NAME
+
+
+
+
+
+ true
+
+ BY_NAME
+
+
+
+
+
+ true
+
+ BY_NAME
+
+
+
+
+
+
+
+ true
+
+ BY_NAME
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..79ee123
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..cd4ed5a
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.php_cs b/.php_cs
deleted file mode 100644
index 3357476..0000000
--- a/.php_cs
+++ /dev/null
@@ -1,12 +0,0 @@
-exclude(['build', 'vendor'])
- ->in(__DIR__);
-
-return PhpCsFixer\Config::create()
- ->setFinder($finder)
- ->setUsingCache(true)
- ->setRules([
- '@PSR2' => true,
- ]);
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 47e576e..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-language: php
-
-matrix:
- fast_finish: true
- include:
- - php: 7.2
- - php: 7.2
- env: 'COMPOSER_FLAGS="--prefer-stable --prefer-lowest"'
-
-cache:
- directories:
- - $HOME/.composer/cache
-
-install:
- - composer update ${COMPOSER_FLAGS} --no-interaction
-
-script:
- - make tests
diff --git a/Makefile b/Makefile
index bcc9b8f..59761c7 100644
--- a/Makefile
+++ b/Makefile
@@ -6,14 +6,54 @@ VERSION := $(if $(TAG),$(TAG),dev-$(BRANCH))
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-12s\033[0m %s\n", $$1, $$2}'
-tests: ## Executes the test suite
- vendor/bin/phpunit
+install-dev: ## Installs the required common devtools
+ @echo "Downloading phpdoc"
+ @wget https://phpdoc.org/phpDocumentor.phar -O bin/phpdoc 2> /dev/null
+ @echo "Downloading phpcs"
+ @wget https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar -O bin/phpcs 2> /dev/null
+ @wget https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar -O bin/phpcbf 2> /dev/null
+ @echo "Adding execution rights on the binaries"
+ @chmod +x bin/phpcs bin/phpcbf bin/phpdoc
+ @echo "Installation of devtools finished"
+ @echo "Please add $(shell echo $(PWD))/bin to your PATH"
-coverage: ## Executes the test suite and creates code coverage reports
- vendor/bin/phpunit --coverage-html build/coverage
+docs: ## Generates api-docs
+ phpdoc -d ./src -t ./doc/api
-view-coverage: ## Shows the code coverage report
- open build/coverage/index.html
+dist: ## Generates distribution
+ cp dist/composer* res/
+ mv dist/composer-dist.json dist/composer.json
+ sed -i -e "s%//VERSION//%$(VERSION)%g" dist/composer.json
+ cd dist && composer install
+ rm dist/composer.json
+ rm dist/composer.lock
+ mv dist/composer-dist-installed.json dist/composer.json
+ make api
+ mkdir -p dist/doc
+ cp -r doc/api dist/doc
+ cd dist && zip -r ../libpairtwo-$(VERSION)-dist.zip *
+ git reset --hard HEAD
+ mv res/composer* dist/
+
+clean: clean-dist clean-dev clean-repo ## Cleans all assets
+
+clean-dev: ## Cleans dev assets
+ rm -rf doc/api
+ rm -rf .idea
+ rm -rf .libpairtwo-distro
+ rm -rf vendor
+ rm -rf composer.lock
+
+clean-dist: ## Cleans distribution assets
+ rm -rf dist/doc
+ rm -rf dist/vendor
+ rm -rf dist/composer.json
+ rm -rf libpairtwo-*-dist.zip
+
+clean-repo: ## Cleans the git repository
+ git fsck
+ git prune
+ git gc
api: ## Generates api-docs
phpdoc -d ./src -t ./doc/api
@@ -54,7 +94,7 @@ clean-repo: ## Cleans the git repository
git gc
cs: ## Fixes coding standard problems
- vendor/bin/php-cs-fixer fix || true
+ php bin/phpcs || true
tag: ## Creates a new signed git tag
$(if $(TAG),,$(error TAG is not defined. Pass via "make tag TAG=X.X.X"))
diff --git a/README.md b/README.md
index aa48978..5b254e2 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# libpairtwo
-![logo](https://raw.githubusercontent.com/JeroenED/libpairtwo/master/res/logo-lightback-250px.png "Logo libpairtwo")
+![logo](https://raw.githubusercontent.com/JeroenED/libpairtwo/develop/res/logo-lightback-250px.png "Logo libpairtwo")
Copyright 2018- (c) Jeroen De Meerleer
diff --git a/bin/.gitkeep b/bin/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/composer.json b/composer.json
index adde7bd..5b8dbf7 100644
--- a/composer.json
+++ b/composer.json
@@ -2,7 +2,10 @@
"name": "jeroened/libpairtwo",
"type": "library",
"description": "Export chess tournaments directly on the web",
- "keywords": ["chess", "pairing"],
+ "keywords": [
+ "chess",
+ "pairing"
+ ],
"license": "AGPL-3.0-or-later",
"authors": [
{
@@ -18,7 +21,6 @@
"ext-iconv": "*"
},
"require-dev": {
- "friendsofphp/php-cs-fixer": "^2.16"
},
"autoload": {
"psr-4": {
diff --git a/dist/composer-dist.json b/dist/composer-dist.json
index 7de20d9..7de9466 100644
--- a/dist/composer-dist.json
+++ b/dist/composer-dist.json
@@ -5,8 +5,8 @@
"url": "../"
}
],
- "require": {
+ "require": {
"jeroened/libpairtwo": "//VERSION//"
},
"minimum-stability": "dev"
-}
\ No newline at end of file
+}
diff --git a/dist/template.php b/dist/template.php
index 9cd3e19..986bc3b 100644
--- a/dist/template.php
+++ b/dist/template.php
@@ -27,7 +27,10 @@ use JeroenED\Libpairtwo\IOFactory;
require_once 'vendor/autoload.php';
if (!file_exists($pairingfile)) {
- trigger_error('Your file is not set or doesn\'t exist! Edit the file: ' . __FILE__ . ' and try again', E_USER_ERROR);
+ trigger_error(
+ 'Your file is not set or doesn\'t exist! Edit the file: ' . __FILE__ . ' and try again',
+ E_USER_ERROR
+ );
}
$reader = IOFactory::createReader($fileformat);
@@ -49,8 +52,18 @@ foreach ($reader->Tournament->Rounds as $round) {
foreach ($round->GamesByBoard as $game) {
echo '' . PHP_EOL;
echo '' . ($game->Board + 1) . ' | ' . PHP_EOL;
- echo '' . $game->White->Player->Name . ' | ' . PHP_EOL;
- echo '' . $game->Black->Player->Name . ' | ' . PHP_EOL;
+ echo '' .
+ $game->White->Player->Name .
+ ' (' .
+ $game->White->Player->getElo($reader->Tournament->PriorityElo) .
+ ') | ' .
+ PHP_EOL;
+ echo '' .
+ $game->Black->Player->Name .
+ ' (' .
+ $game->Black->Player->getElo($reader->Tournament->PriorityElo) .
+ ') | ' .
+ PHP_EOL;
echo '' . $game->Result->getValue() . ' | ' . PHP_EOL;
echo '
' . PHP_EOL;
}
@@ -73,11 +86,11 @@ foreach ($reader->Tournament->Rounds as $round) {
echo '
' . PHP_EOL;
}
-echo 'Rankings
' . PHP_EOL;
+echo 'Global Rankings
' . PHP_EOL;
echo '' . PHP_EOL;
echo '' . PHP_EOL;
-echo ' | Name (elo) | ' . PHP_EOL;
-foreach ($reader->Tournament->TieBreaks as $tiebreak) {
+echo '
---|
| Name (elo) | Category | ' . PHP_EOL;
+foreach ($reader->Tournament->Tiebreaks as $tiebreak) {
echo '' . $tiebreak->getValue() . ' | ' . PHP_EOL;
}
echo '
' . PHP_EOL;
@@ -88,7 +101,8 @@ $rank = 1;
foreach ($reader->Tournament->Ranking as $player) {
echo '' . PHP_EOL;
echo '' . $rank . ' | ' . PHP_EOL;
- echo '' . $player->Name . '(' . $player->getElo($reader->Tournament->PriorityElo) . ') | ' . PHP_EOL;
+ echo '' . $player->Name . ' (' . $player->getElo($reader->Tournament->PriorityElo) . ') | ' . PHP_EOL;
+ echo '' . $player->Category . ' | ' . PHP_EOL;
echo '' . implode(' | ', $player->Tiebreaks) . ' | ' . PHP_EOL;
echo '
' . PHP_EOL;
$rank++;
@@ -96,6 +110,35 @@ foreach ($reader->Tournament->Ranking as $player) {
echo '' . PHP_EOL;
echo '
' . PHP_EOL;
?>
-
+
+Rankings per Category' . PHP_EOL;
+
+foreach ($reader->Tournament->Categories as $category) {
+ echo '' . PHP_EOL;
+ echo '' . $category . '';
+ echo '' . PHP_EOL;
+ echo ' | Name (elo) | ' . PHP_EOL;
+ foreach ($reader->Tournament->Tiebreaks as $tiebreak) {
+ echo '' . $tiebreak->getValue() . ' | ' . PHP_EOL;
+ }
+ echo '
' . PHP_EOL;
+ echo '' . PHP_EOL;
+ echo '' . PHP_EOL;
+
+ $rank = 1;
+ foreach ($reader->Tournament->RankingForCategory($category) as $player) {
+ echo '' . PHP_EOL;
+ echo '' . $rank . ' | ' . PHP_EOL;
+ echo '' . $player->Name . ' (' . $player->getElo($reader->Tournament->PriorityElo) . ') | ' . PHP_EOL;
+ echo '' . implode(' | ', $player->Tiebreaks) . ' | ' . PHP_EOL;
+ echo '
' . PHP_EOL;
+ $rank++;
+ }
+ echo '' . PHP_EOL;
+ echo '
' . PHP_EOL;
+}
+?>
+