PHP Class MiniAsset\Output\AssetCacher

Similar to AssetWriter except this class takes a more simplistic approach to writing cache files. It also provides ways to read existing cache files.
Inheritance: use trait FreshTrait
Datei anzeigen Open project: markstory/mini-asset Class Usage Examples

Protected Properties

Property Type Description
$path string The output path
$theme string The theme currently being built.

Public Methods

Method Description
__construct ( $path, $theme = null )
buildFileName ( AssetTarget $target ) : string Get the final build file name for a target.
ensureDir ( ) : void Create the output directory if it doesn't already exist.
outputDir ( AssetTarget $target ) : string Get the output dir
read ( AssetTarget $target ) : string Get the cached result for a build target.
write ( AssetTarget $target, $contents )

Method Details

__construct() public method

public __construct ( $path, $theme = null )

buildFileName() public method

Get the final build file name for a target.
public buildFileName ( AssetTarget $target ) : string
$target MiniAsset\AssetTarget The target to get a name for.
return string

ensureDir() public method

Create the output directory if it doesn't already exist.
public ensureDir ( ) : void
return void

outputDir() public method

Used to locate outputs when determining freshness.
public outputDir ( AssetTarget $target ) : string
$target MiniAsset\AssetTarget
return string The path

read() public method

Get the cached result for a build target.
public read ( AssetTarget $target ) : string
$target MiniAsset\AssetTarget The target to get content for.
return string

write() public method

public write ( AssetTarget $target, $contents )
$target MiniAsset\AssetTarget

Property Details

$path protected_oe property

The output path
protected string $path
return string

$theme protected_oe property

The theme currently being built.
protected string $theme
return string