# wp-optimize/4.7.0/vendor/mrclay/minify/lib/Minify/DebugDetector.php

WP-Optimize – Cache, Compress images, Minify &amp; Clean database to boost page speed &amp; performance, version 4.7.0. 31 lines.

- Page: https://pluginprobe.com/plugins/wp-optimize/4.7.0/code/vendor/mrclay/minify/lib/Minify/DebugDetector.php
- Raw: https://pluginprobe.com/plugins/wp-optimize/4.7.0/raw/vendor/mrclay/minify/lib/Minify/DebugDetector.php
- Modified: 2021-06-07T22:42:16+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wp-optimize/4.7.0/code/vendor/mrclay/minify/lib/Minify/DebugDetector.php#L10-L20`.

```php
<?php

/**
 * Detect whether request should be debugged
 *
 * @package Minify
 * @author Stephen Clay <steve@mrclay.org>
 */
class Minify_DebugDetector
{
    public static function shouldDebugRequest(Minify_Env $env)
    {
        if ($env->get('debug') !== null) {
            return true;
        }

        $cookieValue = $env->cookie('minifyDebug');
        if ($cookieValue) {
            foreach (preg_split('/\\s+/', $cookieValue) as $debugUri) {
                $pattern = '@' . preg_quote($debugUri, '@') . '@i';
                $pattern = str_replace(array('\\*', '\\?'), array('.*', '.'), $pattern);
                if (preg_match($pattern, $env->getRequestUri())) {
                    return true;
                }
            }
        }

        return false;
    }
}

```
