【发布时间】:2018-12-14 17:45:38
【问题描述】:
我正在用 PHP 编写一个函数,而在编写函数时有一件事让我感到困惑。描述函数职责的最佳方式是什么?
function createWallet(int $userId) {
// validate if user exists
//create wallet
}
or
**client will validate if user exists then call createWalletFunction
function createWallet(int $userId) {
//create wallet
}
【问题讨论】:
标签: function oop single-responsibility-principle