定制 functional-php/named-parameters 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

functional-php/named-parameters

Composer 安装命令:

composer require functional-php/named-parameters

包简介

Named parameters for functions, methods and constructors.

README 文档

README

Build Status Scrutinizer Code Quality Code Coverage Average time to resolve an issue Percentage of issues still open Chat on Gitter

It is often useful to be able to call a function or methods using named parameters. For example to only pass a different value for the nth default parameter.

PHP does not allow to do that, this library ought to change that.

Installation

composer require functional-php/named-parameters

Basic Usage

Say you have the following function:

function return_array($a, $b, $c) {
    return [$a, $b, $c];
}

Any of the following call is equivalent:

use function FunctionalPHP\NamedParameters\call_user_func_array_np;

// traditional call with positional arguments
call_user_func_array_np('return_array', [1, 2, 3]);

// named arguments in the correct order
call_user_func_array_np('return_array', ['a' => 1, 'b' => 2, 'c' => 3]);

// named arguments in random order
call_user_func_array_np('return_array', ['c' => 3, 'a' => 1, 'b' => 2]);
call_user_func_array_np('return_array', ['c' => 3, 'b' => 2, 'a' => 1]);

Testing

You can run the test suite for the library using:

composer test

A test report will be available in the reports directory.

Contributing

Any contribution welcome :

  • Ideas
  • Pull requests
  • Issues

Inspiration

统计信息

  • 总下载量: 6.57k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2019-03-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固