#!/usr/bin/env bash

echo -e "\nPHPLINT src/:"
find src/ -iname "*.php" -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null || exit $?
echo -e "\nPHPLINT tests/:"
find tests/ -iname "*.php" -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null || exit $?
echo -e "\nPHPUNIT:"
phpunit --stop-on-error --stop-on-failure || exit $?
echo -e "\nPHPCS src/:"
phpcs --warning-severity=0 --standard=PSR2 src/ || exit $?
echo -e "\nPHPCS tests/:"
phpcs --warning-severity=0 --standard=PSR2 tests/ || exit $?
echo -e "\nPHPMD src/:"
phpmd src/ text phpmd.xml || exit $?
echo -e "\nPHPMD tests/:"
phpmd tests/ text phpmd-tests.xml || exit $?
echo -e "\nPHPCPD src/:"
phpcpd --min-lines=5 --min-tokens=20  --fuzzy -v src/ || exit $?
echo -e "\nPHPCPD tests/:"
phpcpd --min-lines=5 --min-tokens=20  --fuzzy tests/ #|| exit $?
