PHP Class Tollwerk\Squeezr\Css

Since: 1.0b
Author: Joschi Kuphal ([email protected])
Inheritance: extends Tollwerk\Squeezr
ファイルを表示 Open project: jkphl/squeezr Class Usage Examples

Protected Properties

Property Type Description
$_absoluteCacheCssDir string Parent directory of cached CSS file (absolute path)
$_absoluteCacheCssPath string Cached CSS file (absolute path)
$_absoluteCachePathBase string Base path for all cache files
$_absoluteCachePhpPath string Cached CSS file (absolute path)
$_absoluteCssPath string Requested CSS file (absolute path)
$_blocks array CSS Blocks
$_breakpointCatalog array Media Query condition catalog
$_breakpointIndex array Media Query condition index
$_breakpointTypes array Breakpoint types
$_importPatterns array Import at-rule patterns
$_lines array Line lengths
$_minifier Tollwerk\Squeezr\Css\Minifier Minification provider
$_relativeCssPath string Requested CSS file (relative path to document root)

Public Methods

Method Description
instance ( string $css ) : Css Instanciate a CSS proxy
send ( boolean $cache = true ) : void Parse, squeeze and send the CSS file to the client

Protected Methods

Method Description
__construct ( string $css ) Constructor
_breakpointIndex ( integer $type, array $condition ) : integer Determine / create and return a breakpoint index entry
_breakpoints ( string $mediaQuery ) : array | null Extract the relevant breakpoints out of a @media query
_compileCacheClassCode ( ) : string Compile a PHP cache class representing the loaded CSS stylesheet
_consumeDeclarationBlock ( string $css, integer $peek, integer $offset, integer &$declarationBlockStart ) : string Detect and consume a declaration block within the given CSS text
_minify ( string $css ) : string Minifiy a CSS block (in case a minification provider has been registered)
_parse ( ) Parse and analyze the requested CSS file
_peekToLine ( integer $peek ) : integer Find the line number corresponding with a peek position within the CSS file
_registerBlock ( string &$block, array $breakpoints = null ) Register block data

Method Details

__construct() protected method

Constructor
protected __construct ( string $css )
$css string Requested CSS file (relative to document root)

_breakpointIndex() protected method

Determine / create and return a breakpoint index entry
protected _breakpointIndex ( integer $type, array $condition ) : integer
$type integer Breakpoint type
$condition array Condition values
return integer Breakpoint index

_breakpoints() protected method

Extract the relevant breakpoints out of a @media query
protected _breakpoints ( string $mediaQuery ) : array | null
$mediaQuery string @media query
return array | null Breakpoint alternatives

_compileCacheClassCode() protected method

Compile a PHP cache class representing the loaded CSS stylesheet
protected _compileCacheClassCode ( ) : string
return string PHP class code

_consumeDeclarationBlock() protected method

Detect and consume a declaration block within the given CSS text
protected _consumeDeclarationBlock ( string $css, integer $peek, integer $offset, integer &$declarationBlockStart ) : string
$css string CSS text
$peek integer Current peek (for line number detection in case of an error)
$offset integer Optional: Offset position
$declarationBlockStart integer Set by reference: Declaration block start position within the CSS text
return string Declaration block (starting at the beginning of the CSS text)

_minify() protected method

Minifiy a CSS block (in case a minification provider has been registered)
protected _minify ( string $css ) : string
$css string CSS block
return string Minified CSS block

_parse() protected method

Parse and analyze the requested CSS file
protected _parse ( )

_peekToLine() protected method

Find the line number corresponding with a peek position within the CSS file
protected _peekToLine ( integer $peek ) : integer
$peek integer Peek position
return integer Line number

_registerBlock() protected method

Register block data
protected _registerBlock ( string &$block, array $breakpoints = null )
$block string Block data
$breakpoints array Breakpoints

instance() public static method

Instanciate a CSS proxy
public static instance ( string $css ) : Css
$css string CSS file
return Css Instance reference

send() public method

Parse, squeeze and send the CSS file to the client
public send ( boolean $cache = true ) : void
$cache boolean Cache a copy of the parsed CSS stylesheet
return void

Property Details

$_absoluteCacheCssDir protected_oe property

Parent directory of cached CSS file (absolute path)
protected string $_absoluteCacheCssDir
return string

$_absoluteCacheCssPath protected_oe property

Cached CSS file (absolute path)
protected string $_absoluteCacheCssPath
return string

$_absoluteCachePathBase protected_oe property

Base path for all cache files
protected string $_absoluteCachePathBase
return string

$_absoluteCachePhpPath protected_oe property

Cached CSS file (absolute path)
protected string $_absoluteCachePhpPath
return string

$_absoluteCssPath protected_oe property

Requested CSS file (absolute path)
protected string $_absoluteCssPath
return string

$_blocks protected_oe property

CSS Blocks
protected array $_blocks
return array

$_breakpointCatalog protected_oe property

Media Query condition catalog
protected array $_breakpointCatalog
return array

$_breakpointIndex protected_oe property

Media Query condition index
protected array $_breakpointIndex
return array

$_breakpointTypes protected_oe static_oe property

Breakpoint types
protected static array $_breakpointTypes
return array

$_importPatterns protected_oe static_oe property

Import at-rule patterns
protected static array $_importPatterns
return array

$_lines protected_oe property

Line lengths
protected array $_lines
return array

$_minifier protected_oe property

Minification provider
protected Minifier,Tollwerk\Squeezr\Css $_minifier
return Tollwerk\Squeezr\Css\Minifier

$_relativeCssPath protected_oe property

Requested CSS file (relative path to document root)
protected string $_relativeCssPath
return string