| dist: trusty
language: php
cache:
  directories:
    - $HOME/.composer/cache
env:
  global:
    - RUN_PHPCS="no"
    - RUN_PHPMD="no"
    - RUN_COVERALLS="no"
matrix:
  fast_finish: true
  include:
    - php: 7.1
    - php: 7.2
      env: RUN_PHPCS="yes" RUN_PHPMD="yes" RUN_COVERALLS="yes"
    - php: 7.3
    - php: nightly
      env: COMPOSER_ARGS="--ignore-platform-reqs"
  allow_failures:
    - php: nightly
before_script:
  - rm composer.lock
  - composer self-update
  - composer install --prefer-dist --no-interaction $COMPOSER_ARGS
script:
  - mkdir -p build/logs
  - if [ "$RUN_PHPCS" == "yes" ];
    then vendor/bin/phpcs --report=full --extensions=php -p --standard=phpcs.xml ./src ./tests;
    fi
  - if [ "$RUN_PHPMD" == "yes" ];
    then vendor/bin/phpmd ./src text phpmd.xml;
    fi
  - if [ "$RUN_COVERALLS" == "yes" ];
    then vendor/bin/phpunit --coverage-clover build/logs/clover.xml;
    else vendor/bin/phpunit;
    fi
after_success:
  - if [ "$RUN_COVERALLS" == "yes" ];
    then php vendor/bin/php-coveralls -v;
    fi
 |