class SvgProcessor implements ValidatorInterface, PreProcessorInterface (View source)

Constants

ACTION_DISABLED

Processor action: do not perform any checks.

ACTION_CHECKVALIDITY

Processor action: check only that the SVG is a valid XML file.

ACTION_SANITIZE

Processor action: sanitize the file.

ACTION_REJECT

Processor action: reject the file.

ACTION_DEFAULT

Default processor action.

Properties

protected Sanitizer $sanitizer

The SVG sanitizer.

protected SanitizerOptions $sanitizerOptions

The SVG sanitizer options.

private string $action

The action that this processor should perform.

Methods

__construct(Sanitizer $sanitizer, SanitizerOptions $sanitizerOptions)

Initialize the instance.

$this
readConfiguration(Repository $config)

Initialize the processor from the configured values.

int
getValidationPriority()

Get the priority of this validator.

bool
shouldValidate(ImportingFile $file, ImportOptions $options)

Check if this validator should validate a file being imported.

validate(ImportingFile $file, ImportOptions $options)

Validate a file being imported.

int
getPreProcessPriority()

Get the priority of this pre-processor.

bool
shouldPreProcess(ImportingFile $file, ImportOptions $options)

Check if this pre-processor should process a file being imported.

preProcess(ImportingFile $file, ImportOptions $options)

Pre-process a file being imported.

string
getAction()

Get the action that should be taken.

$this
setAction(string $value)

Set the action that should be taken.

Details

__construct(Sanitizer $sanitizer, SanitizerOptions $sanitizerOptions)

Initialize the instance.

Parameters

Sanitizer $sanitizer
SanitizerOptions $sanitizerOptions

$this readConfiguration(Repository $config)

Initialize the processor from the configured values.

Parameters

Repository $config

Return Value

$this

See also

ProcessorInterface::readConfiguration

int getValidationPriority()

Get the priority of this validator.

bool shouldValidate(ImportingFile $file, ImportOptions $options)

Check if this validator should validate a file being imported.

Parameters

ImportingFile $file

the file being imported

ImportOptions $options

options to b used when importing the file

Return Value

bool

See also

ValidatorInterface::shouldValidate

validate(ImportingFile $file, ImportOptions $options)

Validate a file being imported.

Parameters

ImportingFile $file

the file being imported

ImportOptions $options

options to b used when importing the file

Exceptions

ImportException

See also

ValidatorInterface::validate

int getPreProcessPriority()

Get the priority of this pre-processor.

bool shouldPreProcess(ImportingFile $file, ImportOptions $options)

Check if this pre-processor should process a file being imported.

Parameters

ImportingFile $file

the file being imported

ImportOptions $options

options to b used when importing the file

Return Value

bool

See also

PreProcessorInterface::shouldPreProcess

preProcess(ImportingFile $file, ImportOptions $options)

Pre-process a file being imported.

Parameters

ImportingFile $file

the file being imported

ImportOptions $options

options to b used when importing the file

See also

PreProcessorInterface::preProcess

string getAction()

Get the action that should be taken.

Return Value

string

One of the ACTION_... constants

$this setAction(string $value)

Set the action that should be taken.

Parameters

string $value

Return Value

$this