PHP 클래스 MiniAsset\AssetConfig

파일 보기 프로젝트 열기: markstory/mini-asset 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_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