PHP Class AssetCompress\Middleware\AssetCompressMiddleware

显示文件 Open project: markstory/asset_compress

Protected Properties

Property Type Description
$config MiniAsset\AssetConfig Object containing configuration settings for asset compressor

Public Methods

Method Description
__construct ( AssetConfig $config = null ) Constructor
__invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $next ) : Psr\Http\Message\ResponseInterface Get an asset or delegate to the next middleware

Protected Methods

Method Description
getName ( AssetConfig $config, string $url ) : boolean | string Returns the build name for a requested asset
mapType ( AssetTarget $build ) : string Map an extension to a content type
respond ( Psr\Http\Message\ResponseInterface $response, string $contents, AssetTarget $build ) : Psr\Http\Message\ResponseInterface Respond with the asset.

Method Details

__construct() public method

Constructor
public __construct ( AssetConfig $config = null )
$config MiniAsset\AssetConfig The config object to use. If null, \AssetCompress\ConfigFinder::loadAll() will be used.

__invoke() public method

Get an asset or delegate to the next middleware
public __invoke ( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, callable $next ) : Psr\Http\Message\ResponseInterface
$request Psr\Http\Message\ServerRequestInterface The request.
$response Psr\Http\Message\ResponseInterface The response.
$next callable Callback to invoke the next middleware.
return Psr\Http\Message\ResponseInterface A response

getName() protected method

Returns the build name for a requested asset
protected getName ( AssetConfig $config, string $url ) : boolean | string
$config MiniAsset\AssetConfig The config object to use.
$url string The url to get an asset name from.
return boolean | string false if no build can be parsed from URL with url path otherwise

mapType() protected method

Map an extension to a content type
protected mapType ( AssetTarget $build ) : string
$build MiniAsset\AssetTarget The build target.
return string The mapped content type.

respond() protected method

Respond with the asset.
protected respond ( Psr\Http\Message\ResponseInterface $response, string $contents, AssetTarget $build ) : Psr\Http\Message\ResponseInterface
$response Psr\Http\Message\ResponseInterface The response to augment
$contents string The asset contents.
$build MiniAsset\AssetTarget The build target.
return Psr\Http\Message\ResponseInterface

Property Details

$config protected_oe property

Object containing configuration settings for asset compressor
protected AssetConfig,MiniAsset $config
return MiniAsset\AssetConfig