C.66 PhpDependTask

This task runs PHP_Depend, a software analyzer and metric tool for PHP Code. You need an installed version of this software to use this task.

NB: if you have installed the PHP_Depend Phar file, make sure you set the pharLocation attribute!

Table C.87: Attributes

NameTypeDescriptionDefaultRequired
fileStringPath to source file or pathn/aOnly when there are no nested fileset elements
configFileStringPath to PHP_Depend configuration filen/aNo
allowedFileExtensionsStringComma-separated list of valid file extensions (without dot) for analyzed files.php,php5No
excludeDirectoriesStringComma-separated list of directory patterns to ignore..git, .svn, CVSNo
excludePackagesStringComma-separated list of packages to ignore.n/aNo
withoutAnnotationsBooleanShould the parse ignore doc comment annotations?falseNo
supportBadDocumentationBooleanShould PHP_Depend treat +global as a regular project package?falseNo
debugBooleanEnable debug output?falseNo
haltonerrorBooleanStop the build process if errors occurred during the run.falseNo
pharlocationStringLocation of the PHP_Depend Phar file.n/aNo

C.66.1 Example

<phpdepend file="path/to/source">
                <logger type="phpunit-xml" outfile="reports/metrics.xml"/>
                </phpdepend>

Running code analysis for source files in the given path.

<phpdepend>
                <fileset dir="${builddir}">
                <include name="apps/**/*.php" />
                <include name="lib/de/**/*.php" />
                </fileset>
                <logger type="jdepend-xml" outfile="reports/jdepend.xml"/>
                <analyzer type="coderank-mode" value="method"/>
                </phpdepend>

Running code analysis for source files in the fileset pathes with CodeRank strategy method.

C.66.2 Supported Nested Tags

  • fileset

    This nested tag is required when the file attribute is not set.

  • logger

    The results of the analysis can be parsed by differed loggers. At least one logger is required. Output will always be sent to a file.

    Table C.88: Attributes

    NameTypeDescriptionDefaultRequired
    typeStringThe name of the logger. Valid loggers are: jdepend-chart, jdepend-xml, overview-pyramid, phpunit-xml and summary-xml.n/aYes
    outfileStringPath to write output file to.n/aYes

  • analyzer

    Some additional analyzers can be added to the runner.

    Table C.89: Attributes

    NameTypeDescriptionDefaultRequired
    typeStringThe name of the analyzer. Valid analyzers are: coderank-mode.n/aYes
    valueStringThe value for the analyzer.n/aYes