\Cake\Routing\MiddlewareAssetMiddleware

Handles serving plugin assets in development mode.

This should not be used in production environments as it has sub-optimal performance when compared to serving files with a real webserver.

Summary

Methods
Properties
Constants
__construct()
__invoke()
No public properties found
No constants found
isNotModified()
_getAssetFile()
deliverAsset()
getType()
$cacheTime
$typeMap
N/A
No private methods found
No private properties found
N/A

Properties

$cacheTime

$cacheTime : string

The amount of time to cache the asset.

Type

string

$typeMap

$typeMap : array

A extension to content type mapping for plain text types.

Because finfo doesn't give useful information for plain text types, we have to handle that here.

Type

array

Methods

__construct()

__construct(array  $options = array()) 

Constructor.

Parameters

array $options

The options to use

isNotModified()

isNotModified(\Psr\Http\Message\ServerRequestInterface  $request, \Cake\Filesystem\File  $file) : boolean

Check the not modified header.

Parameters

\Psr\Http\Message\ServerRequestInterface $request

The request to check.

\Cake\Filesystem\File $file

The file object to compare.

Returns

boolean

_getAssetFile()

_getAssetFile(string  $url) : string|null

Builds asset file path based off url

Parameters

string $url

Asset URL

Returns

string|null —

Absolute path for asset file, null on failure

deliverAsset()

deliverAsset(\Psr\Http\Message\ServerRequestInterface  $request, \Psr\Http\Message\ResponseInterface  $response, \Cake\Filesystem\File  $file) : \Psr\Http\Message\ResponseInterface

Sends an asset file to the client

Parameters

\Psr\Http\Message\ServerRequestInterface $request

The request object to use.

\Psr\Http\Message\ResponseInterface $response

The response object to use.

\Cake\Filesystem\File $file

The file wrapper for the file.

Returns

\Psr\Http\Message\ResponseInterface

The response with the file & headers.

getType()

getType(\Cake\Filesystem\File  $file) : string

Return the type from a File object

Parameters

\Cake\Filesystem\File $file

The file from which you get the type

Returns

string