You are here

class WebprofilerRequestMatcher in Devel 8

Same name and namespace in other branches
  1. 8.3 webprofiler/src/RequestMatcher/WebprofilerRequestMatcher.php \Drupal\webprofiler\RequestMatcher\WebprofilerRequestMatcher
  2. 8.2 webprofiler/src/RequestMatcher/WebprofilerRequestMatcher.php \Drupal\webprofiler\RequestMatcher\WebprofilerRequestMatcher
  3. 4.x webprofiler/src/RequestMatcher/WebprofilerRequestMatcher.php \Drupal\webprofiler\RequestMatcher\WebprofilerRequestMatcher

Class WebprofilerRequestMatcher

Hierarchy

  • class \Drupal\webprofiler\RequestMatcher\WebprofilerRequestMatcher implements \Symfony\Component\HttpFoundation\RequestMatcherInterface

Expanded class hierarchy of WebprofilerRequestMatcher

1 string reference to 'WebprofilerRequestMatcher'
webprofiler.services.yml in webprofiler/webprofiler.services.yml
webprofiler/webprofiler.services.yml
1 service uses WebprofilerRequestMatcher
webprofiler.matcher in webprofiler/webprofiler.services.yml
Drupal\webprofiler\RequestMatcher\WebprofilerRequestMatcher

File

webprofiler/src/RequestMatcher/WebprofilerRequestMatcher.php, line 13

Namespace

Drupal\webprofiler\RequestMatcher
View source
class WebprofilerRequestMatcher implements RequestMatcherInterface {

  /**
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  private $configFactory;

  /**
   * @var \Drupal\Core\Path\PathMatcherInterface
   */
  private $pathMatcher;

  /**
   * @param ConfigFactoryInterface $configFactory
   * @param \Drupal\Core\Path\PathMatcherInterface $pathMatcher
   */
  public function __construct(ConfigFactoryInterface $configFactory, PathMatcherInterface $pathMatcher) {
    $this->configFactory = $configFactory;
    $this->pathMatcher = $pathMatcher;
  }

  /**
   * {@inheritdoc}
   */
  public function matches(Request $request) {
    $path = $request
      ->getPathInfo();
    $patterns = $this->configFactory
      ->get('webprofiler.config')
      ->get('exclude');

    // never add Webprofiler to phpinfo page.
    $patterns .= "\r\n/admin/reports/status/php";

    // never add Webprofiler to uninstall confirm page.
    $patterns .= "\r\n/admin/modules/uninstall/*";
    return !$this->pathMatcher
      ->matchPath($path, $patterns);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
WebprofilerRequestMatcher::$configFactory private property
WebprofilerRequestMatcher::$pathMatcher private property
WebprofilerRequestMatcher::matches public function Decides whether the rule(s) implemented by the strategy matches the supplied request.
WebprofilerRequestMatcher::__construct public function