AbstractOptimize extends AbstractStep
AbstractYes
Abstract class for optimization steps. This class provides a base implementation for steps that optimize files of a specific type (e.g., CSS, JS). It handles the initialization of the optimization process, file processing, and caching of optimized files.
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.
- 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|nullinit()
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
abstract processFile(SplFileInfo $file) : string
Parameters
- $file : SplFileInfo
Return values
stringsetProcessor()
Set file processor object.
public
abstract setProcessor() : void