Publisher
extends BaseConfig
in package
Publisher Configuration
Defines basic security restrictions for the Publisher class to prevent abuse by injecting malicious files into a project.
Table of Contents
Properties
- $override : bool
- Whether to override properties by Env vars and Registrars.
- $registrars : array<string|int, mixed>
- An optional array of classes that will act as Registrars for rapidly setting config class properties.
- $restrictions : array<string, string>
- A list of allowed destinations with a (pseudo-)regex of allowed files for each destination.
- $didDiscovery : bool
- Has module discovery happened yet?
- $moduleConfig : Modules|null
- The modules configuration.
Methods
- __construct() : mixed
- Will attempt to get environment variables with names that match the properties of the child class.
- __set_state() : mixed
- getEnvValue() : string|null
- Retrieve an environment-specific configuration setting
- initEnvValue() : void
- Initialization an environment-specific configuration setting
- registerProperties() : void
- Disables Registrars to prevent modules from altering the restrictions.
Properties
$override
Whether to override properties by Env vars and Registrars.
public
static bool
$override
= true
$registrars
An optional array of classes that will act as Registrars for rapidly setting config class properties.
public
static array<string|int, mixed>
$registrars
= []
$restrictions
A list of allowed destinations with a (pseudo-)regex of allowed files for each destination.
public
array<string, string>
$restrictions
= [ROOTPATH => '*', FCPATH => '#\.(?css|js|map|htm?|xml|json|webmanifest|tff|eot|woff?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)$#i']
Attempts to publish to directories not in this list will result in a PublisherException. Files that do no fit the pattern will cause copy/merge to fail.
$didDiscovery
Has module discovery happened yet?
protected
static bool
$didDiscovery
= false
$moduleConfig
The modules configuration.
protected
static Modules|null
$moduleConfig
Methods
__construct()
Will attempt to get environment variables with names that match the properties of the child class.
public
__construct() : mixed
The "shortPrefix" is the lowercase-only config class name.
__set_state()
public
static __set_state(array<string|int, mixed> $array) : mixed
Parameters
- $array : array<string|int, mixed>
getEnvValue()
Retrieve an environment-specific configuration setting
protected
getEnvValue(string $property, string $prefix, string $shortPrefix) : string|null
Parameters
- $property : string
- $prefix : string
- $shortPrefix : string
Return values
string|nullinitEnvValue()
Initialization an environment-specific configuration setting
protected
initEnvValue(array<string|int, mixed>|bool|float|int|string|null &$property, string $name, string $prefix, string $shortPrefix) : void
Parameters
- $property : array<string|int, mixed>|bool|float|int|string|null
- $name : string
- $prefix : string
- $shortPrefix : string
registerProperties()
Disables Registrars to prevent modules from altering the restrictions.
protected
final registerProperties() : void