Check if path should be excluded.

@param string $path

@return bool True if path has matched pattern
4964
protected function exclude(string $path): bool
    {
        foreach ($this->exclude as $pattern) {
            $replacements = [
                '\\,' => ',',
                '*' => '.*',
            ];

            $pattern = strtr($pattern, $replacements);

            if (preg_match("|{$pattern}|i", $path) === 1) {
                return true;
            }
        }

        return false;
    }
564458
public function has(string $path): bool
    {
        $keys = $this->explode($path);
        $array = $this->items;
        foreach ($keys as $key) {
            if (!array_key_exists($key, $array)) {
                return false;
            }
            $array = $array[$key];
        }
        return true;
    }
5891
public static function isAbsolute($path)
    {
        if (($position = strpos($path, './')) !== false && $position <= 2) {
            return false;
        }
        if (strpos($path, ':') !== false) {
            return true;
        }
        if (substr($path, 0, 1) === '/') {
            return true;
        }
        return false;
    }
108116
public function isValidSolrPath($path)
    {
        $path = trim($path);

        if ((!empty($path)) && (preg_match('/^[^*?"<>|:#]*$/', $path))) {
            return true;
        }

        return false;
    }
1161298
protected function checkPath($path)
    {
        if (is_dir($path)) {
            return true;
        }
        if (mkdir($path, 0755, true)) {
            return true;
        } else {
            return false;
        }
    }
1244681
public function includeFileAllowed($path)
    {
        if (!$this->includeAllowed) {
            return false;
        }
        if (!@is_readable($path)) {
            return false;
        }
        if (empty($this->includeRoot)) {
            return true;
        }
        $real = realpath($path);
        foreach (explode(':', $this->includeRoot) as $root) {
            if (strpos($real, $root) === 0) {
                return true;
            }
        }
        return false;
    }
595248
public static function isAbsolute($path)
    {
        return ((isset($path[0])
                ? ($path[0] == '/'
                    || (ctype_alpha($path[0]) && ($path[1] == ':')))
                : '')
            || (parse_url($path, PHP_URL_SCHEME) === true))
            ? true
            : false;
    }
466022
public static function isFile($path): bool
    {
        $path = self::clean($path);
        return file_exists($path) && is_file($path);
    }
609107
public function hasDir($path)
    {
        $meta = $this->getMetadata($path);
        return ($meta && isset($meta['hasdir'])) ? $meta : [
            'hasdir' => true
        ];
    }
1020383
public function isPathCovered($path)
    {
        foreach ($this->patterns as $pattern) {
            if (1 === preg_match('{'.$pattern.'}', $path)) {
                return true;
            }
        }
        return false;
    }
424835
public boolean isAllowed(String path) {
    for (String filter : STARTS_WITH_FILTER) {
      if (path.startsWith(filter)) {
        return false;
      }
    }
    for (String filter : CONTAINS_FILTER) {
      if (path.contains(filter)) {
        return false;
      }
    }
    return true;
  }
821139
public function dontSeeBrowsePath($path)
    {
        $found = true;
        try {
            $this->clickOnBrowsePath($path);
        } catch (\Exception $e) {
            $found = false;
        }

        if ($found) {
            throw new \Exception("Browse path '$path' was found");
        }

        return true;
    }
702487
public function isAbsolute($path)
    {
        $firstChar = substr($path, 0, 1);
        if ('/' === $firstChar || '\\' === $firstChar) {
            return true;
        }
        $isLetter = (
            ($firstChar >= 'A' && $firstChar <= 'Z') ||
            ($firstChar >= 'a' && $firstChar <= 'z')
        );
        $path = substr($path, 1, 2);
        return $isLetter && (':/' === $path || ':\\' === $path);
    }
724327
protected static function isValidPath(string $path): bool
    {
        // http://tools.ietf.org/html/rfc3986#section-3
        // The scheme and path components are required, though the path may be
        // empty (no characters)
        if ($path === '') {
            return true;
        }

        // http://tools.ietf.org/html/rfc3986#section-3.3
        // path          = path-abempty    ; begins with "/" or is empty
        //               / path-absolute   ; begins with "/" but not "//"
        //               / path-noscheme   ; begins with a non-colon segment
        //               / path-rootless   ; begins with a segment
        //               / path-empty      ; zero characters
        //
        // path-abempty  = *( "/" segment )
        // path-absolute = "/" [ segment-nz *( "/" segment ) ]
        // path-noscheme = segment-nz-nc *( "/" segment )
        // path-rootless = segment-nz *( "/" segment )
        // path-empty    = 0<pchar>
        // segment       = *pchar
        // segment-nz    = 1*pchar
        // segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" )
        //               ; non-zero-length segment without any colon ":"
        // pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"
        $pattern = sprintf(
            '/\A(?:(?:[%s%s:@]|(?:%s))*\/?)*\z/',
            static::UNRESERVED_SET,
            static::SUB_DELIMS_SET,
            static::PCT_ENCODED_SET
        );

        return !!preg_match($pattern, $path);
    }
212396
private function isAllowedPath($path) {
    $unallowed_paths = [
      '/user/logout',
      '/ajax',
    ];
    foreach ($unallowed_paths as $unallowed_path) {
      if ($unallowed_path === substr($path, 0, strlen($unallowed_path))) {
        return FALSE;
      }
    }
    return TRUE;
  }
369184
protected function checkPath($path)
    {
        foreach ($this->chroots as $chroot) {
            if (StringHelper::contains($path, $chroot)) {
                return true;
            }
        }
        return false;
    }
872107
public function matches($path)
    {
        if (preg_match($this->expr, $path, $this->matches) &&
            in_array($_SERVER['REQUEST_METHOD'], $this->methods)) {
            return true;
        }

        return false;
    }