承接 degraciamathieu/php-arguments-detector 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

degraciamathieu/php-arguments-detector

Composer 安装命令:

composer require degraciamathieu/php-arguments-detector

包简介

Keep control over the complexity of your methods by checking that they do not have too many arguments.

README 文档

README

build packagist packagist

php arguments detector

The ideal number of arguments for a function is zero. ~ Robert C. Martin

Keep control over the complexity of your methods by checking that they do not have too many arguments with this package.

Installation

Requires >= PHP 7.3

composer require degraciamathieu/php-arguments-detector --dev

Usage

vendor/bin/phpargsdetector inspect {folder}

Options

options description
--min-args= Ignore methods with less than --min-args arguments.
--max-args= Ignore methods with more than --max-args arguments.
--min-weight= Ignore methods with less than --min-weight weight.
--max-weight= Ignore methods with more than --max-weight weight.
--limit= Number of methods displayed.
--without-constructor Ignore method constructors from detection.
--sort-by-weight Sort the results by the weight of methods.

Examples

vendor/bin/phpargsdetector inspect app/Services/Saml/

+------------------------------------------+------------------+-----------+--------+
| Files                                    | Methods          | Arguments | Weight |
+------------------------------------------+------------------+-----------+--------+
| app/Services/Saml/SamlMessageFactory.php | __construct      | 2         | 2      |
| app/Services/Saml/SamlMessageFactory.php | makeSamlResponse | 2         | 68     |
| app/Services/Saml/SamlSecurity.php       | checkSignature   | 2         | 18     |
| app/Services/Saml/SamlIssuer.php         | find             | 1         | 3      |
| app/Services/Saml/SamlKeeper.php         | keep             | 1         | 1      |
| app/Services/Saml/SamlMessageFactory.php | addAttributes    | 1         | 26     |
| app/Services/Saml/SamlMessageFactory.php | sign             | 1         | 12     |
| app/Services/Saml/SamlResponder.php      | launch           | 1         | 10     |
| app/Services/Saml/SamlKeeper.php         | has              | 0         | 0      |
| app/Services/Saml/SamlKeeper.php         | retrieve         | 0         | 0      |
+------------------------------------------+------------------+-----------+--------+
Total of methods : 10
vendor/bin/phpargsdetector inspect app/ --limit=3 --min-args=2 --without-constructor

+-------------------------------------------------+---------+-----------+--------+
| Files                                           | Methods | Arguments | Weight |
+-------------------------------------------------+---------+-----------+--------+
| app/Http/Middleware/RedirectIfAuthenticated.php | handle  | 3         | 27     |
| app/Http/Controllers/IssuerController.php       | update  | 2         | 24     |
| app/Http/Controllers/RestrictionController.php  | update  | 2         | 28     |
+-------------------------------------------------+---------+-----------+--------+
Total of methods : 3
vendor/bin/phpargsdetector inspect app/ --limit=3 --sort-by-weight

+-------------------------------------------------+------------------+-----------+--------+
| Files                                           | Methods          | Arguments | Weight |
+-------------------------------------------------+------------------+-----------+--------+
| app/Services/Saml/SamlMessageFactory.php        | makeSamlResponse | 2         | 68     |
| app/Http/Controllers/RestrictionController.php  | update           | 2         | 28     |
| app/Http/Middleware/RedirectIfAuthenticated.php | handle           | 3         | 27     |
+-------------------------------------------------+------------------+-----------+--------+
Total of methods : 3

Weight

The weight is the number of arguments multiplied by the number of lines of the method.

The weight of the foo method is 10 : 2 arguments * 5 lines.

class Bar {
    public function foo($a, $b)
    {
        if ($a) {
           //
        }

        return $b;
    }
}

You can use it as a complexity indicator.

degraciamathieu/php-arguments-detector 适用场景与选型建议

degraciamathieu/php-arguments-detector 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 891 次下载、GitHub Stars 达 13, 最近一次更新时间为 2022 年 08 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 degraciamathieu/php-arguments-detector 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 degraciamathieu/php-arguments-detector 我们能提供哪些服务?
定制开发 / 二次开发

基于 degraciamathieu/php-arguments-detector 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 891
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 13
  • 点击次数: 12
  • 依赖项目数: 6
  • 推荐数: 1

GitHub 信息

  • Stars: 13
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-08-03