C.52 PHPLocTask
Prev | Appendix C. Optional tasks | Next

## C.52 PHPLocTask

This task runs phploc, a tool for measuring the size of PHP projects. You need an installed version of this tool (installable via PEAR) to use this task.

Table C.72: Attributes

Name | Type | Description | Default | Required
--- | --- | --- | --- | ---
`reportType` | `String` | The type of the report. Available types are cli|csv|txt|xml. | cli | No
`reportName` | `String` | The name of the report type without a file extension. | phploc-report | No
`reportDirectory` | `String` | The directory to write the report file to. | false | Yes, when report type csv, txt or xml is defined.
`countTests` | `Boolean` | Flag to count the projects tests or not. | false | No
`file` | `String` | The name of the file to check. | n/a | Yes, when no nested fileset is defined.
`suffixes` | `String` | A comma-separated list of file suffixes to check. | php | No

### C.52.1 Examples

    <target name="-measure-and-log" description="Measures and logs the size of the project" hidden="true">
                      <tstamp>
                        <format property="check.date.time" pattern="%Y%m%d-%H%M%S" locale="en_US"/>
                      </tstamp>
                      <phploc reportType="txt" reportName="${check.date.time}-report"
                              reportDirectory="phploc-reports">
                        <fileset dir=".">
                          <include name="**/*.php" />
                          <include name="*.php" />
                        </fileset>
                      </phploc>
                    </target>

Checks the size of the project living in ${project.basedir} and writes the result as a txt report to ${project.basedir}/phploc-reports/${check.date.time}-report.txt.

    <target name="project-size-and-tests" description="Measures the size of the project and count it's tests">
                      <phploc countTests="true">
                        <fileset dir=".">
                          <include name="**/*.php" />
                          <include name="*.php" />
                        </fileset>
                      </phploc>
                    </target>

Checks the size of the project living in ${project.basedir}, counts the project tests and writes/logs the result to the CLI.

### C.52.2 Supported Nested Tags

- `fileset`

Prev | Up | Next
C.51 PHPCPDTask | Home | C.53 PHPMDTask