ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# C.72 PHPLocTask This task runs [phploc](http://github.com/sebastianbergmann/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. **NB:** if you have installed the PHPLOC PHAR, make sure you set the `pharlocation` attribute! Table C.95:聽Attributes NameTypeDescriptionDefaultRequired`reportType``String`The type of the report. Available types are cli|csv|txt|xml.cliNo`reportName``String`The name of the report type without a file extension.phploc-reportNo`reportDirectory``String`The directory to write the report file to.falseYes, when report type csv, txt or xml is defined.`countTests``Boolean`Flag to count the projects tests or not.falseNo`file``String`The name of the file to check.n/aYes, when no nested fileset is defined.`suffixes``String`A comma-separated list of file suffixes to check.phpNo`pharlocation``String`Location of the PHPLOC PHAR package.n/aNo C.72.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 counts the 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.72.2 Supported Nested Tags - `fileset` - `formatter` The results of the analysis can be printed in different formats. A `formatter` is required when `reportType` is not set. Table C.96:聽Attributes NameTypeDescriptionDefaultRequired`type``String`The output format. Accepts the same values as the `reportType` attribute (`xml`, `csv`, `text`, `cli`).n/aYes`usefile``Boolean`Boolean that determines whether output should be sent to a file.`true`No`outfile``String`Path to write output file to.n/aYes, if `usefile>` is `true`