PHP Класс Contao\Combiner

Usage: $combiner = new Combiner(); $combiner->add('css/style.css'); $combiner->add('css/fonts.scss'); $combiner->add('css/print.less'); echo $combiner->getCombinedFile();
Наследование: extends System
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$arrFiles array Files
$strKey string Unique file key
$strMode string Operation mode

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

Метод Описание
__construct ( ) Public constructor required
add ( string $strFile, string $strVersion = null, string $strMedia = 'all' ) Add a file to the combined file
addMultiple ( array $arrFiles, string $strVersion = null, string $strMedia = 'screen' ) Add multiple files from an array
getCombinedFile ( string $strUrl = null ) : string Generate the combined file and return its path
getFileUrls ( ) : array Generates the files and returns the URLs.
hasEntries ( ) : boolean Check whether files have been added

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

Метод Описание
fixPaths ( string $content, array $arrFile ) : string Fix the paths
getCombinedFileUrl ( string $strUrl = null ) : string Generate the combined file and return its path
getDebugMarkup ( ) : string Generates the debug markup.
handleCss ( string $content, array $arrFile ) : string Handle CSS files
handleScssLess ( string $content, array $arrFile ) : string Handle SCSS/LESS files

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

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

Public constructor required
public __construct ( )

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

Add a file to the combined file
public add ( string $strFile, string $strVersion = null, string $strMedia = 'all' )
$strFile string The file to be added
$strVersion string An optional version number
$strMedia string The media type of the file (.css only)

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

Add multiple files from an array
public addMultiple ( array $arrFiles, string $strVersion = null, string $strMedia = 'screen' )
$arrFiles array An array of files to be added
$strVersion string An optional version number
$strMedia string The media type of the file (.css only)

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

Fix the paths
protected fixPaths ( string $content, array $arrFile ) : string
$content string The file content
$arrFile array The file array
Результат string The modified file content

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

Generate the combined file and return its path
public getCombinedFile ( string $strUrl = null ) : string
$strUrl string An optional URL to prepend
Результат string The path to the combined file

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

Generate the combined file and return its path
protected getCombinedFileUrl ( string $strUrl = null ) : string
$strUrl string An optional URL to prepend
Результат string The path to the combined file

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

Generates the debug markup.
protected getDebugMarkup ( ) : string
Результат string The debug markup

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

Generates the files and returns the URLs.
public getFileUrls ( ) : array
Результат array The file URLs

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

Handle CSS files
protected handleCss ( string $content, array $arrFile ) : string
$content string The file content
$arrFile array The file array
Результат string The modified file content

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

Handle SCSS/LESS files
protected handleScssLess ( string $content, array $arrFile ) : string
$content string The file content
$arrFile array The file array
Результат string The modified file content

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

Check whether files have been added
public hasEntries ( ) : boolean
Результат boolean True if there are files

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

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

Files
protected array $arrFiles
Результат array

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

Unique file key
protected string $strKey
Результат string

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

Operation mode
protected string $strMode
Результат string