Documentation

Cli
in package

Tags
phpstan-import-type

Errors from \CssLint\Linter

Table of Contents

Constants

RETURN_CODE_ERROR  = 1
RETURN_CODE_SUCCESS  = 0
SCRIPT_NAME  = 'php-css-lint'

Methods

run()  : int
Entrypoint of the cli, will execute the linter according to the given arguments
displayLinterErrors()  : void
Display the errors returned by the linter
getPropertiesFromOptions()  : Properties
Retrieve the properties from the given options
isGlobPattern()  : bool
Checks if a given string is a glob pattern.
lintFile()  : int
Performs lint on a given file path
lintGlob()  : int
lintInput()  : int
lintString()  : int
Performs lint on a given string
parseArguments()  : CliArgs
Retrieve the parsed Cli arguments from given arguments array
printError()  : void
Display an error message
printLine()  : void
Display the given message in a new line
printUsage()  : void
Display usage of the cli

Constants

RETURN_CODE_ERROR

private mixed RETURN_CODE_ERROR = 1

RETURN_CODE_SUCCESS

private mixed RETURN_CODE_SUCCESS = 0

SCRIPT_NAME

private mixed SCRIPT_NAME = 'php-css-lint'

Methods

run()

Entrypoint of the cli, will execute the linter according to the given arguments

public run(array<string|int, string> $arguments) : int
Parameters
$arguments : array<string|int, string>

arguments to be parsed (@see $_SERVER['argv'])

Return values
int

the return code related to the execution of the linter

displayLinterErrors()

Display the errors returned by the linter

private displayLinterErrors(Errors $errors) : void
Parameters
$errors : Errors

the generated errors to be displayed

getPropertiesFromOptions()

Retrieve the properties from the given options

private getPropertiesFromOptions(string $options) : Properties
Parameters
$options : string

the options to be parsed

Return values
Properties

isGlobPattern()

Checks if a given string is a glob pattern.

private isGlobPattern(string $pattern) : bool

A glob pattern typically includes wildcard characters:

  • '*' matches any sequence of characters.
  • '?' matches any single character.
  • '[]' matches any one character in the specified set.

Optionally, if using the GLOB_BRACE flag, brace patterns like {foo,bar} are also valid.

Parameters
$pattern : string

The string to evaluate.

Return values
bool

True if the string is a glob pattern, false otherwise.

lintFile()

Performs lint on a given file path

private lintFile(Linter $cssLinter, string $filePath) : int
Parameters
$cssLinter : Linter

the instance of the linter

$filePath : string

the path of the file to be linted

Return values
int

the return code related to the execution of the linter

lintGlob()

private lintGlob(string $glob) : int
Parameters
$glob : string
Return values
int

lintInput()

private lintInput(Linter $cssLinter, string $input) : int
Parameters
$cssLinter : Linter
$input : string
Return values
int

lintString()

Performs lint on a given string

private lintString(Linter $cssLinter, string $stringValue) : int
Parameters
$cssLinter : Linter

the instance of the linter

$stringValue : string

the CSS string to be linted

Return values
int

the return code related to the execution of the linter

parseArguments()

Retrieve the parsed Cli arguments from given arguments array

private parseArguments(array<string|int, string> $arguments) : CliArgs
Parameters
$arguments : array<string|int, string>

arguments to be parsed (@see $_SERVER['argv'])

Return values
CliArgs

an instance of Cli arguments object containing parsed arguments

printError()

Display an error message

private printError(string $error) : void
Parameters
$error : string

the message to be displayed

printLine()

Display the given message in a new line

private printLine(string $message) : void
Parameters
$message : string

the message to be displayed

printUsage()

Display usage of the cli

private printUsage() : void

        
On this page

Search results