Overview
  • Namespace
  • Class

Namespaces

  • yii2cdn

Classes

  • Cdn
  • Component
  • ConfigFile
  • ConfigLoader
  • ConfigParser
  • File
  • Section

Class ConfigParser

Class ComponentConfigParser Parse the component configuration array into components

Namespace: yii2cdn
Package: common\yii2cdn
Author: Junaid Atari mj.atari@gmail.com
Version: 0.1
Located at src/ConfigParser.php

Methods summary

public
# __construct( array $config )

ComponentConfigParser constructor.

ComponentConfigParser constructor.

Parameters

$config
Configuration
public static array
# touchComponentTags( array $components )

Replaces @component* tags from the components

Replaces @component* tags from the components

Parameters

$components
Pre Build Components data

Returns

array
Post components object

See

ComponentConfigParser::replaceComponentTagsFromFileName()
protected static array
# listFilesByRoot( array $components )

Get the components files list
Key=Value pair of [COMPONENT_ID/SECTION_ID/FILE_ID]=>FILE_URL

Get the components files list
Key=Value pair of [COMPONENT_ID/SECTION_ID/FILE_ID]=>FILE_URL

Parameters

$components
Pre Build Components data

Returns

array
protected static array
# replaceComponentTagsFromFileName( string $fileName, array $indexed )

Replaces @component* tags (case insensitive) from given filename Tags (starts with @component)

> componentUrl(ID)
   > componentFile(ID/SECTION/FILE_ID)

Replaces @component* tags (case insensitive) from given filename Tags (starts with @component)

> componentUrl(ID)
   > componentFile(ID/SECTION/FILE_ID)

Parameters

$fileName
File name replace from
$indexed
Indexed data object

Returns

array
Replaced tags object
public array|null
# getParsed( )

Get the parsed configuration

Get the parsed configuration

Returns

array|null
Component config | null when skipped
protected string
# getAttrOffline( )

Get @offline attribute value (empty when not exist/null)

Get @offline attribute value (empty when not exist/null)

Returns

string
protected string
# getUrl( )

Get @src attribute value (empty when not exist/null)

Get @src attribute value (empty when not exist/null)

Returns

string
protected string
# getAttrBaseUrl( )

Get @baseUrl attribute value (empty when not exist/null)

Get @baseUrl attribute value (empty when not exist/null)

Returns

string
protected string
# getAttrSrc( )

Get @src attribute value (empty when not exist/null)

Get @src attribute value (empty when not exist/null)

Returns

string
protected array
# getAttrOfflineSections( )

Get @offlineSections attribute value (empty when not exist/null)

Get @offlineSections attribute value (empty when not exist/null)

Returns

array
protected array
# getFilesBySection( $type )

Get the files of section by name

Get the files of section by name

Parameters

$type
Section name to get

Returns

array
protected array|null
# getFileName( string|array $file, string $type )

Get the file id and name

Get the file id and name

Parameters

$file
File name | file object
$type
Section name

Returns

array|null
Key=>Value pair (ID=>FILENAME) / File skipped

Throws

yii\base\InvalidParamException
when File first param must not string or empty
yii\base\InvalidParamException
when File attribute param not string or empty
protected string
# replaceFileNameTags( string $fileName )

Replaces tags (starts with @) from file name

Rules: (no url appends at beginning if)

> An actual url
   > starts with //


Supported tags (case insensitive)

> appUrl : current application url
   > baseUrl : component base url
   > url (*) : * = any url ends with /
   > alias (*) : * = CDN custom alias name
   > yiiAlias (*) : * = Yii alias name


Replaces tags (starts with @) from file name

Rules: (no url appends at beginning if)

> An actual url
   > starts with //


Supported tags (case insensitive)

> appUrl : current application url
   > baseUrl : component base url
   > url (*) : * = any url ends with /
   > alias (*) : * = CDN custom alias name
   > yiiAlias (*) : * = Yii alias name


Parameters

$fileName
Replace tags from filename

Returns

string

Properties summary

protected static array $sections

List of sections name

List of sections name

# []
protected string $_id

Component ID

Component ID

#
protected string $baseUrl

CDN Base URL

CDN Base URL

#
protected array $config

Component Configuration

Component Configuration

# []
protected array $aliases

CDN Custom aliases

CDN Custom aliases

# []
protected array $fileIds

Component file name id Configuration

Component file name id Configuration

# []
protected array $filesAttrs

Files attributes

Files attributes

# []
protected array $_props

Files attributes

Files attributes

# []
protected array $defFileAttrs

Predefined file attributes

Predefined file attributes

# ['id', 'cdn', 'offline', 'options']
API documentation generated by ApiGen