/** * Asynchronous validation controller action * @return array Asynchronous response array */ public function __async_validate() { // Build current HTML page url and add internal URL if present $url = $_SERVER['HTTP_HOST'] . $this->urlSuffix . '/' . implode('/', func_get_args()); // Create W3C validator object $validator = new Validator($url); /** @var $validationResults */ $validationResults = $validator->validate()->toArray(); return array('status' => 1, 'html' => $this->view('panel')->set('status', $validationResults['validity'])->set('errors', $validationResults['errorsCount'])->set('warnings', $validationResults['warningsCount'])->set('invalid', $validationResults['validity'] == 0 ? 'invalid' : 'valid')->set('link', $validationResults['refferer'])->output()); }
public function testInvalidValidation() { $this->validator = new Validator($this->invalidUrl); $this->validator->validate(); }