language: php

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

matrix:
    allow_failures:
        - php: 5.3.3
        - php: 5.6
        - php: hhvm

env:
    global:
        - secure: "Sq+6bVtnPsu0mWX8DWQ+9bGAjxMcGorksUiHc4YIXEJsuDfVmVlH8tTD547IeCjDAx9MxXerZ2Z4HSjxTB70VEnJPvZMHI/EZn4Ny31YLHEthdZbV5Gd1h0TGp8VOzPKGShvGrtGBX6MvMfgpK4zuieVWbSfdKeecm8ZNLMpUd4="

before_script:
    ## Packages
    - sudo apt-get -qq update > /dev/null
    - sudo apt-get -qq install graphviz > /dev/null
    ## Composer
    # - curl -s http://getcomposer.org/installer | php
    # - php composer.phar install --prefer-source
    - composer self-update
    - composer require dompdf/dompdf:0.6.*
    - composer install --prefer-source --dev
    ## PHP_CodeSniffer
    - pyrus install pear/PHP_CodeSniffer
    - phpenv rehash
    ## PHP Copy/Paste Detector
    - curl -o phpcpd.phar https://phar.phpunit.de/phpcpd.phar
    ## PHP Mess Detector
    - pear config-set preferred_state beta
    - printf "\n" | pecl install imagick
    - pear channel-discover pear.phpmd.org
    - pear channel-discover pear.pdepend.org
    - pear install --alldeps phpmd/PHP_PMD
    - phpenv rehash
    ## PHPLOC
    #- curl -o phploc.phar https://phar.phpunit.de/phploc.phar
    ## PHPDocumentor
    - mkdir -p build/docs
    - mkdir -p build/coverage

script:
    ## PHP_CodeSniffer
    - phpcs src/ tests/ --standard=PSR2 -n --ignore=src/PhpWord/Shared/PCLZip
    ## PHP Copy/Paste Detector
    - php phpcpd.phar src/ tests/ --verbose
    ## PHP Mess Detector
    - phpmd src/,tests/ text ./phpmd.xml.dist --exclude pclzip.lib.php
    ## PHPLOC
    #- php phploc.phar src/
    ## PHPUnit
    - phpunit -c ./ --coverage-text --coverage-html ./build/coverage
    ## PHPDocumentor
    - vendor/bin/phpdoc.php -d ./src -t ./build/docs --ignore "*/src/PhpWord/Shared/PCLZip/*" --template="responsive-twig"

after_script:
    ## PHPDocumentor
    - bash .travis_shell_after_success.sh
    ## Scrutinizer
    - wget https://scrutinizer-ci.com/ocular.phar
    - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
