language: php

php:
  - 5.3
  - 5.4
  - 5.5
  - 5.6
  - 7.0
  - hhvm

matrix:
  fast_finish: true
  include:
    - php: 5.3
      env: PHPCS=1

before_script:
  - composer self-update
  - composer install
  - if [[ "$PHPCS" != "1" && "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then mkdir -p build/logs; fi
  - if [[ "$PHPCS" != "1" && "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then wget https://scrutinizer-ci.com/ocular.phar; fi

script:
  - if [[ "$PHPCS" != "1" && "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml; fi
  - if [[ "$PHPCS" != "1" && "$TRAVIS_PHP_VERSION" == "hhvm" ]]; then ./vendor/bin/phpunit --coverage-text; fi
  - if [[ "$PHPCS" == "1" ]]; then ./vendor/bin/phpcs --standard=PSR2 -np src/ tests/; fi

after_script:
  - if [[ "$PHPCS" != "1" && "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml; fi
