PHP Class Psr7Middlewares\Utils\Helpers

Show file Open project: oscarotero/psr7-middlewares Class Usage Examples

Public Methods

Method Description
fixPath ( string $path ) : string helper function to fix paths '//' or '/./' or '/foo/.
getMimeType ( Psr\Http\Message\ResponseInterface $response ) : string Return the mime type.
getOutput ( integer $level ) : string Return the output buffer.
hashEquals ( string $a, string $b ) : boolean Very short timing attack safe string comparison for PHP < 5.6 http://php.net/manual/en/function.hash-equals.php#118384.
isAjax ( Psr\Http\Message\RequestInterface $request ) : boolean Check whether a request is or not ajax.
isPost ( Psr\Http\Message\RequestInterface $request ) : boolean Check if a request is post or any similar method.
isRedirect ( Psr\Http\Message\ResponseInterface $response ) : boolean Check whether a response is a redirection.
joinPath ( ) : string Join several pieces into a path.

Method Details

fixPath() public static method

./' in a path.
public static fixPath ( string $path ) : string
$path string Path to resolve
return string

getMimeType() public static method

Return the mime type.
public static getMimeType ( Psr\Http\Message\ResponseInterface $response ) : string
$response Psr\Http\Message\ResponseInterface
return string

getOutput() public static method

Return the output buffer.
public static getOutput ( integer $level ) : string
$level integer
return string

hashEquals() public static method

Very short timing attack safe string comparison for PHP < 5.6 http://php.net/manual/en/function.hash-equals.php#118384.
public static hashEquals ( string $a, string $b ) : boolean
$a string
$b string
return boolean

isAjax() public static method

Check whether a request is or not ajax.
public static isAjax ( Psr\Http\Message\RequestInterface $request ) : boolean
$request Psr\Http\Message\RequestInterface
return boolean

isPost() public static method

Check if a request is post or any similar method.
public static isPost ( Psr\Http\Message\RequestInterface $request ) : boolean
$request Psr\Http\Message\RequestInterface
return boolean

isRedirect() public static method

Check whether a response is a redirection.
public static isRedirect ( Psr\Http\Message\ResponseInterface $response ) : boolean
$response Psr\Http\Message\ResponseInterface
return boolean

joinPath() public static method

Join several pieces into a path.
public static joinPath ( ) : string
return string