File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed
Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -22,33 +22,28 @@ public function createValidators(array $rules): array
2222 }
2323
2424 return array_map (function ($ rule ) {
25- return new ($ this ->matchedRule ($ rule ))($ rule );
25+ return new ($ this ->matchedStrategy ($ rule ))($ rule );
2626 }, $ rules );
2727 }
2828
2929 private function areRulesValid ($ rules )
3030 {
3131 foreach ($ rules as $ rule ) {
32- $ matched = false ;
33- foreach ($ this ->validationStrategies as $ strategy ) {
34- if ($ strategy ::isRuleMatched ($ rule )) {
35- $ matched = true ;
36- break ;
37- }
38- }
32+ $ matched = $ this ->matchedStrategy ($ rule );
3933 if (!$ matched ) {
4034 return false ;
4135 }
4236 }
4337 return true ;
4438 }
4539
46- private function matchedRule ($ rule )
40+ private function matchedStrategy ($ rule )
4741 {
4842 foreach ($ this ->validationStrategies as $ strategy ) {
4943 if ($ strategy ::isRuleMatched ($ rule )) {
5044 return $ strategy ;
5145 }
5246 }
47+ return null ;
5348 }
5449}
You can’t perform that action at this time.
0 commit comments