Documentation

Linter
in package

Table of Contents

Constants

CONTEXT_NESTED_SELECTOR_CONTENT  = 'nested selector content'
CONTEXT_PROPERTY_CONTENT  = 'property content'
CONTEXT_PROPERTY_NAME  = 'property name'
CONTEXT_SELECTOR  = 'selector'
CONTEXT_SELECTOR_CONTENT  = 'selector content'

Properties

$charNumber  : int
Current char number
$comment  : bool
Tells if the linter is parsing a comment
$context  : string|null
Current context of parsing (must be a constant starting by CONTEXT_...)
$contextContent  : string
Current content of parse. Ex: the selector name, the property name or the property content
$cssLintProperties  : Properties|null
Class to provide css properties knowledge
$errors  : array<string|int, mixed>|null
Errors occurred during the lint process
$lineNumber  : int
Current line number
$nestedSelector  : bool
Tells if the linter is parsing a nested selector. Ex: @media, @keyframes.
$previousChar  : string|null
The previous linted char

Methods

__construct()  : mixed
Constructor
getCssLintProperties()  : Properties
Return an instance of the "\CssLint\Properties" helper, initialize a new one if not define already
getErrors()  : array<string|int, mixed>
Return the errors occurred during the lint process
lintFile()  : bool
Performs lint for a given file path
lintString()  : bool
Performs lint on a given string
setCssLintProperties()  : void
Set an instance of the "\CssLint\Properties" helper
addContextContent()  : Linter
Append new value to context content
addError()  : Linter
Add a new error message to the errors property, it adds extra infos to the given error message
assertContext()  : bool
Assert that current context is the same as given
assertPreviousChar()  : bool
Assert that previous char is the same as given
getCharNumber()  : int
Return the current char number
getContextContent()  : string
Return context content
getLineNumber()  : int
Return the current line number
incrementCharNumber()  : Linter
Add 1 to the current char number
incrementLineNumber()  : Linter
Add 1 to the current line number
initLint()  : Linter
Initialize linter, reset all process properties
isComment()  : bool
Tells if the linter is parsing a comment
isEndOfLine()  : bool
Check if a given char is an end of line token
isNestedSelector()  : bool
Tells if the linter is parsing a nested selector
lintChar()  : bool
Performs lint on a given char
lintCommentChar()  : bool|null
Performs lint for a given char, check comment part
lintNestedSelectorChar()  : bool|null
Performs lint for a given char, check nested selector part
lintPropertyContentChar()  : bool|null
Performs lint for a given char, check property content part
lintPropertyNameChar()  : bool|null
Performs lint for a given char, check property name part
lintSelectorChar()  : bool|null
Performs lint for a given char, check selector part
lintSelectorContentChar()  : bool|null
Performs lint for a given char, check selector content part
resetCharNumber()  : Linter
Reset current char number property
resetContext()  : Linter
Reset context property
resetContextContent()  : Linter
Reset context content property
resetErrors()  : Linter
Reset the errors property
resetLineNumber()  : Linter
Reset current line number property
resetPreviousChar()  : Linter
Reset previous char property
setComment()  : void
Set the comment flag
setContext()  : Linter
Set new context
setNestedSelector()  : void
Set the nested selector flag
setPreviousChar()  : Linter
Set new previous char

Constants

CONTEXT_NESTED_SELECTOR_CONTENT

public mixed CONTEXT_NESTED_SELECTOR_CONTENT = 'nested selector content'

CONTEXT_PROPERTY_CONTENT

public mixed CONTEXT_PROPERTY_CONTENT = 'property content'

CONTEXT_PROPERTY_NAME

public mixed CONTEXT_PROPERTY_NAME = 'property name'

CONTEXT_SELECTOR

public mixed CONTEXT_SELECTOR = 'selector'

CONTEXT_SELECTOR_CONTENT

public mixed CONTEXT_SELECTOR_CONTENT = 'selector content'

Properties

$charNumber

Current char number

protected int $charNumber = 0

$comment

Tells if the linter is parsing a comment

protected bool $comment = false

$context

Current context of parsing (must be a constant starting by CONTEXT_...)

protected string|null $context

$contextContent

Current content of parse. Ex: the selector name, the property name or the property content

protected string $contextContent

$cssLintProperties

Class to provide css properties knowledge

protected Properties|null $cssLintProperties

$errors

Errors occurred during the lint process

protected array<string|int, mixed>|null $errors = []

$lineNumber

Current line number

protected int $lineNumber = 0

$nestedSelector

Tells if the linter is parsing a nested selector. Ex: @media, @keyframes.

protected bool $nestedSelector = false

..

$previousChar

The previous linted char

protected string|null $previousChar

Methods

__construct()

Constructor

public __construct([Properties $oProperties = null ]) : mixed
Parameters
$oProperties : Properties = null

(optional) an instance of the "\CssLint\Properties" helper

getCssLintProperties()

Return an instance of the "\CssLint\Properties" helper, initialize a new one if not define already

public getCssLintProperties() : Properties
Return values
Properties

getErrors()

Return the errors occurred during the lint process

public getErrors() : array<string|int, mixed>
Return values
array<string|int, mixed>

lintFile()

Performs lint for a given file path

public lintFile(string $sFilePath) : bool
Parameters
$sFilePath : string

: a path of an existing and readable file

Tags
throws
InvalidArgumentException
throws
RuntimeException
Return values
bool

: true if the file is a valid css file, else false

lintString()

Performs lint on a given string

public lintString(string $sString) : bool
Parameters
$sString : string
Return values
bool

: true if the string is a valid css string, false else

setCssLintProperties()

Set an instance of the "\CssLint\Properties" helper

public setCssLintProperties(Properties $oCssLintProperties) : void
Parameters
$oCssLintProperties : Properties

addContextContent()

Append new value to context content

protected addContextContent(string $sContextContent) : Linter
Parameters
$sContextContent : string
Return values
Linter

addError()

Add a new error message to the errors property, it adds extra infos to the given error message

protected addError(string $sError) : Linter
Parameters
$sError : string
Return values
Linter

assertContext()

Assert that current context is the same as given

protected assertContext(string|array<string|int, mixed>|null $sContext) : bool
Parameters
$sContext : string|array<string|int, mixed>|null
Return values
bool

assertPreviousChar()

Assert that previous char is the same as given

protected assertPreviousChar(string $sChar) : bool
Parameters
$sChar : string
Return values
bool

getCharNumber()

Return the current char number

protected getCharNumber() : int
Return values
int

getContextContent()

Return context content

protected getContextContent() : string
Return values
string

getLineNumber()

Return the current line number

protected getLineNumber() : int
Return values
int

incrementCharNumber()

Add 1 to the current char number

protected incrementCharNumber() : Linter
Return values
Linter

incrementLineNumber()

Add 1 to the current line number

protected incrementLineNumber() : Linter
Return values
Linter

initLint()

Initialize linter, reset all process properties

protected initLint() : Linter
Return values
Linter

isComment()

Tells if the linter is parsing a comment

protected isComment() : bool
Return values
bool

isEndOfLine()

Check if a given char is an end of line token

protected isEndOfLine(string $sChar) : bool
Parameters
$sChar : string
Return values
bool

: true if the char is an end of line token, else false

isNestedSelector()

Tells if the linter is parsing a nested selector

protected isNestedSelector() : bool
Return values
bool

lintChar()

Performs lint on a given char

protected lintChar(string $sChar) : bool
Parameters
$sChar : string
Return values
bool

: true if the process should continue, else false

lintCommentChar()

Performs lint for a given char, check comment part

protected lintCommentChar(string $sChar) : bool|null
Parameters
$sChar : string
Return values
bool|null

: true if the process should continue, else false, null if this char is not about comment

lintNestedSelectorChar()

Performs lint for a given char, check nested selector part

protected lintNestedSelectorChar(string $sChar) : bool|null
Parameters
$sChar : string
Return values
bool|null

: true if the process should continue, else false, null if this char is not a nested selector

lintPropertyContentChar()

Performs lint for a given char, check property content part

protected lintPropertyContentChar(string $sChar) : bool|null
Parameters
$sChar : string
Return values
bool|null

: true if the process should continue, else false, null if this char is not a property content

lintPropertyNameChar()

Performs lint for a given char, check property name part

protected lintPropertyNameChar(string $sChar) : bool|null
Parameters
$sChar : string
Return values
bool|null

: true if the process should continue, else false, null if this char is not a property name

lintSelectorChar()

Performs lint for a given char, check selector part

protected lintSelectorChar(string $sChar) : bool|null
Parameters
$sChar : string
Return values
bool|null

: true if the process should continue, else false, null if this char is not about selector

lintSelectorContentChar()

Performs lint for a given char, check selector content part

protected lintSelectorContentChar(string $sChar) : bool|null
Parameters
$sChar : string
Return values
bool|null

: true if the process should continue, else false, null if this char is not a selector content

resetCharNumber()

Reset current char number property

protected resetCharNumber() : Linter
Return values
Linter

resetContext()

Reset context property

protected resetContext() : Linter
Return values
Linter

resetContextContent()

Reset context content property

protected resetContextContent() : Linter
Return values
Linter

resetErrors()

Reset the errors property

protected resetErrors() : Linter
Return values
Linter

resetLineNumber()

Reset current line number property

protected resetLineNumber() : Linter
Return values
Linter

resetPreviousChar()

Reset previous char property

protected resetPreviousChar() : Linter
Return values
Linter

setComment()

Set the comment flag

protected setComment(bool $bComment) : void
Parameters
$bComment : bool

setContext()

Set new context

protected setContext(string|null $sContext) : Linter
Parameters
$sContext : string|null
Return values
Linter

setNestedSelector()

Set the nested selector flag

protected setNestedSelector(bool $bNestedSelector) : void
Parameters
$bNestedSelector : bool

setPreviousChar()

Set new previous char

protected setPreviousChar(string $sChar) : Linter
Parameters
$sChar : string
Return values
Linter

        
On this page

Search results