PHP Class Bolt\Config

Author: Bob den Otter, [email protected]
Afficher le fichier Open project: bolt/bolt Class Usage Examples

Méthodes publiques

Свойство Type Description
$fields Bolt\Storage\Field\Manager Will be made protected in Bolt 3.0.
$notify_update boolean @deprecated Deprecated since 3.2, to be removed in 4.0

Protected Properties

Свойство Type Description
$app Silex\Application
$cachetimestamp integer
$data array
$defaultConfig array
$reservedFieldNames array
$yamlParser Symfony\Component\Yaml\Parser

Méthodes publiques

Méthode Description
__construct ( Silex\Application $app )
cacheConfig ( boolean $force = false )
checkConfig ( ) : boolean Sanity checks for doubles in in contenttypes.
doReplacements ( mixed $value = null ) : mixed Replaces placeholders in config values %foo% will be resolved to $app['foo'] from the container
get ( string $path, string | array | boolean $default = null ) : mixed Get a config value, using a path.
getConfig ( ) : array Load the configuration from the various YML files.
getCurrentTimestamp ( ) : string Get the current timestamp, corrected to the timezone.
getExceptions ( ) : array | null
getFields ( ) : Manager A getter to access the fields manager.
getTimestamp ( $when ) : string Get a timestamp, corrected to the timezone.
getTwigPath ( ) : string[] Build an array of Twig paths.
getWhichEnd ( ) : string Use {@see Zone} instead with a {@see Request}.
initialize ( )
set ( string $path, mixed $value ) : boolean Set a config value, using a path.
setCKPath ( )

Méthodes protégées

Méthode Description
checkValidCache ( )
getDefaults ( ) Assume sensible defaults for a number of options.
loadCache ( ) : array | null Attempt to load cached configuration files.
parseConfigYaml ( string $filename, string $path = null ) : array Read and parse a YAML configuration file
parseConnectionParams ( array | string $params, array $defaults = [] ) : array Parses params to valid connection parameters: - Defaults are merged into the params - Bolt keys are converted to Doctrine keys - Invalid keys are filtered out
parseContentType ( string $key, array $contentType, array $generalConfig ) : array Parse a single Contenttype configuration array.
parseContentTypes ( array $generalConfig ) : array Read and parse the contenttypes.yml configuration file.
parseDatabase ( array $options ) : array Parse and fine-tune the database configuration.
parseFieldsAndGroups ( array $fields, array $generalConfig ) : array Parse a Contenttype's filed and determine the grouping
parseGeneral ( ) : array Read and parse the config.yml and config_local.yml configuration files.
parseSqliteOptions ( array $config ) : array Fine-tune Sqlite configuration parameters.
parseTaxonomy ( ) : array Read and parse the taxonomy.yml configuration file.
parseTemplatefields ( ) This method pulls the templatefields config from the theme config and appends it to the contenttypes configuration.
parseTheme ( string $themePath, array $generalConfig ) : array Read and parse the current theme's config.yml configuration file.
saveCache ( )

Private Methods

Méthode Description
checkTaxonomy ( ) : boolean Sanity check for slashes in in taxonomy slugs.
determineZone ( )
invalidateCache ( ) Invalidate (remove) the cache file.
isCacheValid ( ) : boolean Check if the cached config file exists, and is newer than the authoritative source.
isThemeCacheValid ( ) : boolean Check if the cache is still valid with theme file as well.
loadTheme ( ) Checks if cache is valid for theme; if not invalidate and load it.
parseFieldRepeaters ( array $fields, string $key ) : array Basic validation of repeater fields.

Method Details

__construct() public méthode

public __construct ( Silex\Application $app )
$app Silex\Application

cacheConfig() public méthode

public cacheConfig ( boolean $force = false )
$force boolean

checkConfig() public méthode

Sanity checks for doubles in in contenttypes.
public checkConfig ( ) : boolean
Résultat boolean

checkValidCache() protected méthode

Deprecation: Deprecated since 3.2, to be removed in 4.0.
protected checkValidCache ( )

doReplacements() public méthode

Replaces placeholders in config values %foo% will be resolved to $app['foo'] from the container
public doReplacements ( mixed $value = null ) : mixed
$value mixed
Résultat mixed

get() public méthode

For example: $var = $config->get('general/wysiwyg/ck/contentsCss');
public get ( string $path, string | array | boolean $default = null ) : mixed
$path string
$default string | array | boolean
Résultat mixed

getConfig() public méthode

Load the configuration from the various YML files.
public getConfig ( ) : array
Résultat array

getCurrentTimestamp() public méthode

Get the current timestamp, corrected to the timezone.
public getCurrentTimestamp ( ) : string
Résultat string Current timestamp

getDefaults() protected méthode

Assume sensible defaults for a number of options.
protected getDefaults ( )

getExceptions() public méthode

public getExceptions ( ) : array | null
Résultat array | null

getFields() public méthode

A getter to access the fields manager.
public getFields ( ) : Manager
Résultat Bolt\Storage\Field\Manager

getTimestamp() public méthode

Get a timestamp, corrected to the timezone.
public getTimestamp ( $when ) : string
Résultat string Timestamp

getTwigPath() public méthode

Build an array of Twig paths.
public getTwigPath ( ) : string[]
Résultat string[]

getWhichEnd() public méthode

Going forward, decisions determined by current request should be done in an app or route middleware. Application should be setup agnostic to the current request. Route middlewares apply only to a certain route or group of routes. See {@see \Bolt\Controller\Async\AsyncBase::before} for an example. App middlewares apply to all routes. See classes in \Bolt\EventListener for examples of these. These middlewares could also be filtered by checking for Zone inside of listener.
Deprecation: Deprecated since 3.0, to be removed in 4.0.
public getWhichEnd ( ) : string
Résultat string

initialize() public méthode

public initialize ( )

loadCache() protected méthode

Attempt to load cached configuration files.
protected loadCache ( ) : array | null
Résultat array | null

parseConfigYaml() protected méthode

Read and parse a YAML configuration file
protected parseConfigYaml ( string $filename, string $path = null ) : array
$filename string The name of the YAML file to read
$path string The (optional) path to the YAML file
Résultat array

parseConnectionParams() protected méthode

Parses params to valid connection parameters: - Defaults are merged into the params - Bolt keys are converted to Doctrine keys - Invalid keys are filtered out
protected parseConnectionParams ( array | string $params, array $defaults = [] ) : array
$params array | string
$defaults array
Résultat array

parseContentType() protected méthode

Parse a single Contenttype configuration array.
protected parseContentType ( string $key, array $contentType, array $generalConfig ) : array
$key string
$contentType array
$generalConfig array
Résultat array

parseContentTypes() protected méthode

Read and parse the contenttypes.yml configuration file.
protected parseContentTypes ( array $generalConfig ) : array
$generalConfig array
Résultat array

parseDatabase() protected méthode

Parse and fine-tune the database configuration.
protected parseDatabase ( array $options ) : array
$options array
Résultat array

parseFieldsAndGroups() protected méthode

Parse a Contenttype's filed and determine the grouping
protected parseFieldsAndGroups ( array $fields, array $generalConfig ) : array
$fields array
$generalConfig array
Résultat array

parseGeneral() protected méthode

Read and parse the config.yml and config_local.yml configuration files.
protected parseGeneral ( ) : array
Résultat array

parseSqliteOptions() protected méthode

Fine-tune Sqlite configuration parameters.
protected parseSqliteOptions ( array $config ) : array
$config array
Résultat array

parseTaxonomy() protected méthode

Read and parse the taxonomy.yml configuration file.
protected parseTaxonomy ( ) : array
Résultat array

parseTemplatefields() protected méthode

This method pulls the templatefields config from the theme config and appends it to the contenttypes configuration.
protected parseTemplatefields ( )

parseTheme() protected méthode

Read and parse the current theme's config.yml configuration file.
protected parseTheme ( string $themePath, array $generalConfig ) : array
$themePath string
$generalConfig array
Résultat array

saveCache() protected méthode

Deprecation: Deprecated since 3.2, to be removed in 4.0. Now handled in a listener.
protected saveCache ( )

set() public méthode

For example: $app['config']->set('general/branding/name', 'Bolt');
public set ( string $path, mixed $value ) : boolean
$path string
$value mixed
Résultat boolean

setCKPath() public méthode

Deprecation: Deprecated since 3.3, to be removed in 4.0.
public setCKPath ( )

Property Details

$app protected_oe property

protected Application,Silex $app
Résultat Silex\Application

$cachetimestamp protected_oe property

protected int $cachetimestamp
Résultat integer

$data protected_oe property

protected array $data
Résultat array

$defaultConfig protected_oe property

protected array $defaultConfig
Résultat array

$fields public_oe property

Will be made protected in Bolt 3.0.
public Manager,Bolt\Storage\Field $fields
Résultat Bolt\Storage\Field\Manager

$notify_update public_oe property

@deprecated Deprecated since 3.2, to be removed in 4.0
public bool $notify_update
Résultat boolean

$reservedFieldNames protected_oe property

protected array $reservedFieldNames
Résultat array

$yamlParser protected_oe property

protected Parser,Symfony\Component\Yaml $yamlParser
Résultat Symfony\Component\Yaml\Parser