3 namespace Drupal\webprofiler\RequestMatcher;
5 use Drupal\Core\Config\ConfigFactoryInterface;
6 use Drupal\Core\Path\PathMatcherInterface;
7 use Symfony\Component\HttpFoundation\Request;
8 use Symfony\Component\HttpFoundation\RequestMatcherInterface;
11 * Class WebprofilerRequestMatcher
13 class WebprofilerRequestMatcher implements RequestMatcherInterface {
16 * @var \Drupal\Core\Config\ConfigFactoryInterface
18 private $configFactory;
21 * @var \Drupal\Core\Path\PathMatcherInterface
26 * @param ConfigFactoryInterface $configFactory
27 * @param \Drupal\Core\Path\PathMatcherInterface $pathMatcher
29 public function __construct(ConfigFactoryInterface $configFactory, PathMatcherInterface $pathMatcher) {
30 $this->configFactory = $configFactory;
31 $this->pathMatcher = $pathMatcher;
37 public function matches(Request $request) {
38 $path = $request->getPathInfo();
40 $patterns = $this->configFactory->get('webprofiler.config')->get('exclude');
42 // never add Webprofiler to phpinfo page.
43 $patterns .= "\r\n/admin/reports/status/php";
45 // never add Webprofiler to uninstall confirm page.
46 $patterns .= "\r\n/admin/modules/uninstall/*";
48 return !$this->pathMatcher->matchPath($path, $patterns);