Наследование: implements Youshido\GraphQL\Validator\ConfigValidator\Rules\ValidationRuleInterface
 public function validate($data, $ruleInfo)
 {
     if (!is_string($ruleInfo)) {
         return false;
     }
     if ($ruleInfo == TypeService::TYPE_CALLABLE && (is_callable($data) || is_array($data) && count($data) == 2 && substr($data[0], 0, 1) == '@')) {
         return true;
     }
     return parent::validate($data, $ruleInfo);
 }
Пример #2
0
 /**
  * @param      $ruleInfo
  * @param      $data
  * @param bool $isValid
  *
  * @dataProvider complexRuleProvider
  */
 public function testComplexRules($ruleInfo, $data, $isValid = true)
 {
     $this->assertEquals($isValid, $this->rule->validate($data, $ruleInfo));
 }