dousuie2222 2012-04-02 14:15
浏览 67
已采纳

PHP取决于代码度量分析

I am trying to compare two PHP projects using PHP Depend (http://pdepend.org). One is a page-based PHP application written by a group of students a year ago and the second is mine that I have worked on for the past year. The objective is to provide some quantitative statistics that might help validate that refactoring the project (introducing a MVC architecture and lots of refactoring to better apply OO principles) has led to lower complexity and coupling, among others.

The problem I am facing is that when analyzing the older project, PHP depend ignores the files that were written in a procedural programming style. It only picks up those files that have classes defined. I am not sure why the previous students chose to have this hybrid style of writing code but they did.

Is this how PHP Depend works or is there some setting I can use so that it analyzes all files. The site offers little help. If PHP Depend can only analyze files with defined classes and methods, how can I generate some code metrics to validate my project?

  • 写回答

1条回答 默认 最新

  • douou9786 2012-11-11 01:28
    关注

    Actually, PHP depends will generate empty reports for file that do not contain at least a class or a function. This is sadly the expected behavior before someone decides to patch it up.

    You can use PHP LoC, PHP Mess Detector or PHP Code Sniffer to generate some code metrics for both projects. At least PHP LoC will generate all its metrics for unstructured php files, and PHP Code Sniffer and PHP Mess Detector will generate at least some of their metrics.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥35 MIMO天线稀疏阵列排布问题
  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?
  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?