Linter
in package
Tags
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 : Errors
- 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() : Errors
- 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() : self
- Set an instance of the "\CssLint\Properties" helper
- addContextContent() : self
- Append new value to context content
- addError() : self
- 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() : self
- Add 1 to the current char number
- incrementLineNumber() : self
- Add 1 to the current line number
- initLint() : static
- 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() : self
- Reset current char number property
- resetContext() : self
- Reset context property
- resetContextContent() : self
- Reset context content property
- resetErrors() : Linter
- Reset the errors property
- resetLineNumber() : self
- Reset current line number property
- resetPreviousChar() : self
- Reset previous char property
- setComment() : void
- Set the comment flag
- setContext() : self
- Set new context
- setNestedSelector() : void
- Set the nested selector flag
- setPreviousChar() : self
- 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
Errors
$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
PropertiesgetErrors()
Return the errors occurred during the lint process
public
getErrors() : Errors
Return values
ErrorslintFile()
Performs lint for a given file path
public
lintFile(string $sFilePath) : bool
Parameters
- $sFilePath : string
-
: a path of an existing and readable file
Tags
Return values
bool —: true if the file is a valid css file, else false
lintString()
Performs lint on a given string
public
lintString(string $stringValue) : bool
Parameters
- $stringValue : 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 $cssLintProperties) : self
Parameters
- $cssLintProperties : Properties
Return values
selfaddContextContent()
Append new value to context content
protected
addContextContent(string $contextContent) : self
Parameters
- $contextContent : string
Return values
selfaddError()
Add a new error message to the errors property, it adds extra infos to the given error message
protected
addError(string $error) : self
Parameters
- $error : string
Return values
selfassertContext()
Assert that current context is the same as given
protected
assertContext(Context $context) : bool
Parameters
- $context : Context
Return values
boolassertPreviousChar()
Assert that previous char is the same as given
protected
assertPreviousChar(string $charValue) : bool
Parameters
- $charValue : string
Return values
boolgetCharNumber()
Return the current char number
protected
getCharNumber() : int
Return values
intgetContextContent()
Return context content
protected
getContextContent() : string
Return values
stringgetLineNumber()
Return the current line number
protected
getLineNumber() : int
Return values
intincrementCharNumber()
Add 1 to the current char number
protected
incrementCharNumber() : self
Return values
selfincrementLineNumber()
Add 1 to the current line number
protected
incrementLineNumber() : self
Return values
selfinitLint()
Initialize linter, reset all process properties
protected
initLint() : static
Return values
staticisComment()
Tells if the linter is parsing a comment
protected
isComment() : bool
Return values
boolisEndOfLine()
Check if a given char is an end of line token
protected
isEndOfLine(string $charValue) : bool
Parameters
- $charValue : 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
boollintChar()
Performs lint on a given char
protected
lintChar(string $charValue) : bool
Parameters
- $charValue : 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 $charValue) : bool|null
Parameters
- $charValue : 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 $charValue) : bool|null
Parameters
- $charValue : 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 $charValue) : bool|null
Parameters
- $charValue : 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 $charValue) : bool|null
Parameters
- $charValue : 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 $charValue) : bool|null
Parameters
- $charValue : 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 $charValue) : bool|null
Parameters
- $charValue : 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() : self
Return values
selfresetContext()
Reset context property
protected
resetContext() : self
Return values
selfresetContextContent()
Reset context content property
protected
resetContextContent() : self
Return values
selfresetErrors()
Reset the errors property
protected
resetErrors() : Linter
Return values
LinterresetLineNumber()
Reset current line number property
protected
resetLineNumber() : self
Return values
selfresetPreviousChar()
Reset previous char property
protected
resetPreviousChar() : self
Return values
selfsetComment()
Set the comment flag
protected
setComment(bool $comment) : void
Parameters
- $comment : bool
setContext()
Set new context
protected
setContext(string|null $context) : self
Parameters
- $context : string|null
Return values
selfsetNestedSelector()
Set the nested selector flag
protected
setNestedSelector(bool $nestedSelector) : void
Parameters
- $nestedSelector : bool
setPreviousChar()
Set new previous char
protected
setPreviousChar(string $charValue) : self
Parameters
- $charValue : string