PHP Класс MiniAsset\AssetConfig

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_data array Parsed configuration data.
$_defaults array These defaults are used unless a key is redefined.
$_extensionTypes array handle.
$_filters array Filter configuration
$_modifiedTime integer The max modified time of all the config files loaded.
$_targets array Target configuration
$constantMap array A hash of constants that can be expanded when reading ini files.

Открытые методы

Метод Описание
__construct ( array $data = [], array $constants = [] ) Constructor, set some initial data for a AssetConfig object.
addExtension ( string $ext, array $config ) : void Add/Replace an extension configuration.
addTarget ( string $target, array $config ) Create a new build target.
allFilters ( ) : array Get configuration for all filters.
buildFromIniFile ( string $iniFile = null, $constants = [] ) Factory method
cachePath ( string $ext, string $path = null ) Accessor for getting the cachePath for a given extension.
constants ( ) : array Get the list of loaded constants.
extensions ( ) : array Get the list of extensions this config object supports.
files ( string $target ) : array Get the list of files that match the given build file.
filterConfig ( string $filter, array $settings = null ) : mixed. Get/Set filter Settings.
filters ( string $ext, array $filters = null ) : array Get/set filters for an extension
general ( string $key, mixed $value = null ) : mixed Get / set values from the General section. This is preferred to using get()/set() as you don't run the risk of making a mistake in General's casing.
get ( string $path ) Get values from the config data.
getExt ( string $file ) : string Get the extension for a filename.
hasTarget ( string $name ) : boolean Check if the named target exists.
isThemed ( string $target ) : boolean Check if a build target is themed.
load ( string $path, string $prefix = '' ) Load a config file into the current instance.
modifiedTime ( ) : integer Get the modified time of the loaded configuration files.
paths ( string $ext, string $target = null, array $paths = null ) : array Get/set paths for an extension. Setting paths will replace global or per target existing paths. Its only intended for testing.
requires ( string $target ) : array Get the required build targets for this target.
set ( string $path, string $value ) Set values into the config object, You can't modify targets, or filters with this. Use the appropriate methods for those settings.
targetFilters ( string $name ) : array Get the filters for a build target.
targets ( ) : array Get the build targets.
theme ( string $theme = null ) : mixed Set the active theme for building assets.

Защищенные методы

Метод Описание
_addConstants ( array $constants ) : void Add path based constants to the mapped constants.
_parseExtensionDef ( $target ) : array Parses paths in an extension definition
_replacePathConstants ( string $path ) : string Replaces the file path constants used in Config files.
readConfig ( string $filename ) : array Read the configuration file from disk
resolveExtends ( ) : void Once all targets have been built, resolve extend options.

Описание методов

__construct() публичный Метод

Any userland constants that resolve to file paths will automatically be added to the constants available in configuration files.
public __construct ( array $data = [], array $constants = [] )
$data array Initial data set for the object.
$constants array Additional constants that will be translated when parsing paths.

_addConstants() защищенный Метод

Add path based constants to the mapped constants.
protected _addConstants ( array $constants ) : void
$constants array The constants to map
Результат void

_parseExtensionDef() защищенный Метод

Parses paths in an extension definition
protected _parseExtensionDef ( $target ) : array
Результат array Array of build extension information with paths replaced.

_replacePathConstants() защищенный Метод

Will replace APP and WEBROOT
protected _replacePathConstants ( string $path ) : string
$path string Path to replace constants on
Результат string constants replaced

addExtension() публичный Метод

Add/Replace an extension configuration.
public addExtension ( string $ext, array $config ) : void
$ext string Extension name
$config array Configuration for the extension
Результат void

addTarget() публичный Метод

Create a new build target.
public addTarget ( string $target, array $config )
$target string Name of the target file. The extension will be inferred based on the last extension.
$config array Config data for the target. Should contain files, filters and theme key.

allFilters() публичный Метод

Useful for building FilterRegistry objects
public allFilters ( ) : array
Результат array Config data related to all filters.

buildFromIniFile() публичный статический Метод

Factory method
Устаревший: Use ConfigFinder::loadAll() instead.
public static buildFromIniFile ( string $iniFile = null, $constants = [] )
$iniFile string File path for the ini file to parse.

cachePath() публичный Метод

Accessor for getting the cachePath for a given extension.
public cachePath ( string $ext, string $path = null )
$ext string Extension to get paths for.
$path string The path to cache files using $ext to.

constants() публичный Метод

Get the list of loaded constants.
public constants ( ) : array
Результат array

extensions() публичный Метод

Get the list of extensions this config object supports.
public extensions ( ) : array
Результат array Extension list.

files() публичный Метод

Get the list of files that match the given build file.
public files ( string $target ) : array
$target string The build file with extension.
Результат array An array of files for the chosen build.

filterConfig() публичный Метод

Get/Set filter Settings.
public filterConfig ( string $filter, array $settings = null ) : mixed.
$filter string The filter name
$settings array The settings to set, leave null to get
Результат mixed.

filters() публичный Метод

Get/set filters for an extension
public filters ( string $ext, array $filters = null ) : array
$ext string Name of an extension
$filters array Filters to replace either the global or per target filters.
Результат array Filters for extension.

general() публичный Метод

Get / set values from the General section. This is preferred to using get()/set() as you don't run the risk of making a mistake in General's casing.
public general ( string $key, mixed $value = null ) : mixed
$key string The key to read/write
$value mixed The value to set.
Результат mixed Null when writing. Either a value or null when reading.

get() публичный Метод

Get values from the config data.
public get ( string $path )
$path string The path you want.

getExt() публичный Метод

Get the extension for a filename.
public getExt ( string $file ) : string
$file string
Результат string

hasTarget() публичный Метод

Check if the named target exists.
public hasTarget ( string $name ) : boolean
$name string The name of the target to check.
Результат boolean

isThemed() публичный Метод

Check if a build target is themed.
public isThemed ( string $target ) : boolean
$target string A build target.
Результат boolean

load() публичный Метод

Load a config file into the current instance.
public load ( string $path, string $prefix = '' )
$path string The config file to load.
$prefix string The string to prefix all targets in $path with.

modifiedTime() публичный Метод

Get the modified time of the loaded configuration files.
public modifiedTime ( ) : integer
Результат integer

paths() публичный Метод

Get/set paths for an extension. Setting paths will replace global or per target existing paths. Its only intended for testing.
public paths ( string $ext, string $target = null, array $paths = null ) : array
$ext string Extension to get paths for.
$target string A build target. If provided the target's paths (if any) will also be returned.
$paths array Paths to replace either the global or per target paths.
Результат array An array of paths to search for assets on.

readConfig() защищенный Метод

Read the configuration file from disk
protected readConfig ( string $filename ) : array
$filename string Name of the inifile to parse
Результат array Inifile contents

requires() публичный Метод

Required builds differ from extends in that the compiled asset is merged into the named target. In extends, the source files & filter for an asset are merged into a target.
public requires ( string $target ) : array
$target string The target to get requirements for.
Результат array A list of required builds.

resolveExtends() защищенный Метод

Once all targets have been built, resolve extend options.
protected resolveExtends ( ) : void
Результат void

set() публичный Метод

Set values into the config object, You can't modify targets, or filters with this. Use the appropriate methods for those settings.
public set ( string $path, string $value )
$path string The path to set.
$value string The value to set.

targetFilters() публичный Метод

Get the filters for a build target.
public targetFilters ( string $name ) : array
$name string The build target to get filters for.
Результат array

targets() публичный Метод

Get the build targets.
public targets ( ) : array
Результат array An array of build targets.

theme() публичный Метод

Set the active theme for building assets.
public theme ( string $theme = null ) : mixed
$theme string The theme name to set. Null to get
Результат mixed Either null on set, or theme on get

Описание свойств

$_data защищенное свойство

Parsed configuration data.
protected array $_data
Результат array

$_defaults защищенное статическое свойство

These defaults are used unless a key is redefined.
protected static array $_defaults
Результат array

$_extensionTypes защищенное статическое свойство

handle.
protected static array $_extensionTypes
Результат array

$_filters защищенное свойство

Filter configuration
protected array $_filters
Результат array

$_modifiedTime защищенное свойство

The max modified time of all the config files loaded.
protected int $_modifiedTime
Результат integer

$_targets защищенное свойство

Target configuration
protected array $_targets
Результат array

$constantMap защищенное свойство

A hash of constants that can be expanded when reading ini files.
protected array $constantMap
Результат array