Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

验证逻辑优化,使得可以直接检查元素本身,而不需要用户自己来构造一个数组 #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cyrnicolase
Copy link

  1. 我认为 \Owl\Parameter\Validator 是一个工具类,且本身是没有什么属性的,那么我认为可以被声明为一个单例类,这样保证在一个生命周期只会有一个对象出现,减少开支。
  2. 在 Validator::execute() 方法增加三个参数, string $key。 如果我们想直接检查数据格式,那么就不用在代码中手工的构造数组逻辑。只需要告知Validator 当报错的时候,使用什么key 来进行名字报错即可。这样可以达到直接检查传入数据的目的。

@zqsds zqsds mentioned this pull request Mar 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant