Html extends AbstractOptimize
Html optimization step. This class extends the AbstractOptimize class and provides functionality to optimize HTML files. It uses the voku\helper\HtmlMin library to minify HTML files, reducing their size and improving load times. It initializes with the type 'html' and processes files by minifying them. It also provides methods to encode and decode content for caching purposes.
Table of Contents
Properties
- $builder : Builder
- $canProcess : bool
- $config : Config
- $options : Builder::OPTIONS
- $canProcess : bool
- Configuration options for the step.
- $processor : mixed
- $type : string
Methods
- __construct() : mixed
- StepInterface constructor.
- canProcess() : bool
- Method to know if the step can be processed.
- decode() : string|null
- Decode file content.
- encode() : string|null
- Encode file content.
- getName() : string
- Returns the step name.
- init() : void
- This method is called before the step is processed to initialize the step with necessary options and to determine if it can be executed.
- process() : void
- Process implementation.
- processFile() : string
- Process a file.
- setProcessor() : void
- Set file processor object.
Properties
$builder
protected
Builder
$builder
$canProcess
protected
bool
$canProcess
= false
$config
protected
Config
$config
$options
Configuration options for the step.
protected
Builder::OPTIONS
$options
$processor
protected
mixed
$processor
File processor
$type
protected
string
$type
File type (ie: 'css')
Methods
__construct()
StepInterface constructor.
public
__construct(Builder $builder) : mixed
Parameters
- $builder : Builder
canProcess()
Method to know if the step can be processed.
public
canProcess() : bool
If init() is used, true by default.
Return values
booldecode()
Decode file content.
public
decode([string|null $content = null ]) : string|null
Parameters
- $content : string|null = null
Return values
string|nullencode()
Encode file content.
public
encode([string|null $content = null ]) : string|null
Parameters
- $content : string|null = null
Return values
string|nullgetName()
Returns the step name.
public
getName() : string
Return values
stringinit()
This method is called before the step is processed to initialize the step with necessary options and to determine if it can be executed.
public
init(array<string|int, mixed> $options) : void
Parameters
- $options : array<string|int, mixed>
process()
Process implementation.
public
process() : void
Tags
processFile()
Process a file.
public
processFile(SplFileInfo $file) : string
Parameters
- $file : SplFileInfo
Return values
stringsetProcessor()
Set file processor object.
public
setProcessor() : void