public function matchesPath($requestPath)
    {
        $cookiePath = $this->getPath();

        // Match on exact matches or when path is the default empty "/"
        if ($cookiePath === '/' || $cookiePath == $requestPath) {
            return true;
        }

        // Ensure that the cookie-path is a prefix of the request path.
        if (0 !== strpos($requestPath, $cookiePath)) {
            return false;
        }

        // Match if the last character of the cookie-path is "/"
        if (substr($cookiePath, -1, 1) === '/') {
            return true;
        }

        // Match if the first character not included in cookie path is "/"
        return substr($requestPath, strlen($cookiePath), 1) === '/';
    }
public function matchesPath($requestPath)
    {
        $cookiePath = $this->getPath();

        // Match on exact matches or when path is the default empty "/"
        if ($cookiePath === '/' || $cookiePath == $requestPath) {
            return true;
        }

        // Ensure that the cookie-path is a prefix of the request path.
        if (0 !== strpos($requestPath, $cookiePath)) {
            return false;
        }

        // Match if the last character of the cookie-path is "/"
        if (substr($cookiePath, -1, 1) === '/') {
            return true;
        }

        // Match if the first character not included in cookie path is "/"
        return substr($requestPath, strlen($cookiePath), 1) === '/';
    }
public function matchesPath ( $ requestPath ) { $ cookiePath = $ this -> getPath ( ) ; // Match on exact matches or when path is the default empty "/" if ( $ cookiePath === '/' || $ cookiePath == $ requestPath ) { return true ; } // Ensure that the cookie-path is a prefix of the request path. if ( 0 !== strpos ( $ requestPath , $ cookiePath ) ) { return false ; } // Match if the last character of the cookie-path is "/" if ( substr ( $ cookiePath , - 1 , 1 ) === '/' ) { return true ; } // Match if the first character not included in cookie path is "/" return substr ( $ requestPath , strlen ( $ cookiePath ) , 1 ) === '/' ; }
Check if the cookie matches a path value.

A request-path path-matches a given cookie-path if at least one of
the following conditions holds:

- The cookie-path and the request-path are identical.
- The cookie-path is a prefix of the request-path, and the last
character of the cookie-path is %x2F ("/").
- The cookie-path is a prefix of the request-path, and the first
character of the request-path that is not included in the cookie-
path is a %x2F ("/") character.

@param string $requestPath Path to check against

@return bool
Check if the cookie matches a path value .