public function validate($context = 'default', array $data = [])
    {
        if (!empty($data)) {
            $this->setData($data);
        }

        $this->setContext($context);
        $rules = $this->buildRulesArray();
        $validator = $this->factory->make($this->filterArray($rules, $this->data), $rules);
        if ($validator->passes()) {
            return $validator->getData();
        }
        throw new ValidationException($validator);
    }
public function validate($context = 'default', array $data = [])
    {
        if (!empty($data)) {
            $this->setData($data);
        }

        $this->setContext($context);
        $rules = $this->buildRulesArray();
        $validator = $this->factory->make($this->filterArray($rules, $this->data), $rules);
        if ($validator->passes()) {
            return $validator->getData();
        }
        throw new ValidationException($validator);
    }
public function validate ( $ context = 'default' , array $ data = [ ] ) { if ( ! empty ( $ data ) ) { $ this -> setData ( $ data ) ; } $ this -> setContext ( $ context ) ; $ rules = $ this -> buildRulesArray ( ) ; $ validator = $ this -> factory -> make ( $ this -> filterArray ( $ rules , $ this -> data ) , $ rules ) ; if ( $ validator -> passes ( ) ) { return $ validator -> getData ( ) ; } throw new ValidationException ( $ validator ) ; }
Validate passed data

@param string $context Validation context
@param array  $data    Data to validate

@throws InvalidArgumentException
@throws ValidationException

@return array
Validate passed data