/** * @inheritdoc */ public function collect(Request $request, Response $response, \Exception $exception = null) { $content = $response->getContent(); $checker = new CoreChecker($content, $request->getLocale()); if (!$checker->hasHTML()) { return; } $this->typos = $checker->getErrors(); }
protected function checkTemplate($fullName, $locale) { if (!strpos($fullName, ".html.twig")) { return; } $contents = file_get_contents($fullName); $contents = preg_replace('/\\{\\{.*\\}\\}/sU', ' ', $contents); $contents = preg_replace('/\\{\\%.*\\%\\}/sU', ' ', $contents); $contents = preg_replace('/\\{\\#.*\\#\\}/sU', ' ', $contents); $contents = "<br/>" . $contents; $checker = new CoreChecker($contents, $locale); $hasErrors = $checker->hasErrors(); if ($hasErrors) { print $fullName . "\n"; foreach ($checker->getErrors() as $error) { print "> " . $error . "\n"; } } }