Cli
in package
Table of Contents
Properties
- $RETURN_CODE_ERROR : mixed
- $RETURN_CODE_SUCCESS : mixed
- $SCRIPT_NAME : mixed
Methods
- run() : int
- Entrypoint of the cli, will execute the linter according to the given arguments
- displayLinterErrors() : mixed
- Display the errors returned by the linter
- lintFile() : int
- Performs lint on a given file path
- lintString() : int
- Performs lint on a given string
- parseArguments() : CliArgs
- Retrieve the parsed Cli arguments from given arguments array
- printError() : mixed
- Display an error message
- printLine() : mixed
- Display the given message in a new line
- printUsage() : mixed
- Display usage of the cli
Properties
$RETURN_CODE_ERROR
private
static mixed
$RETURN_CODE_ERROR
= 1
$RETURN_CODE_SUCCESS
private
static mixed
$RETURN_CODE_SUCCESS
= 0
$SCRIPT_NAME
private
static 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, mixed> $aArguments) : int
Parameters
- $aArguments : array<string|int, mixed>
-
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(array<string|int, mixed> $aErrors) : mixed
Parameters
- $aErrors : array<string|int, mixed>
-
the generated errors to be displayed
lintFile()
Performs lint on a given file path
private
lintFile(Linter $oCssLinter, string $sFilePath) : int
Parameters
- $oCssLinter : Linter
-
the instance of the linter
- $sFilePath : string
-
the path of the file to be linted
Return values
int —the return code related to the execution of the linter
lintString()
Performs lint on a given string
private
lintString(Linter $oCssLinter, string $sString) : int
Parameters
- $oCssLinter : Linter
-
the instance of the linter
- $sString : 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, mixed> $aArguments) : CliArgs
Parameters
- $aArguments : array<string|int, mixed>
Return values
CliArgs —an instance of Cli arguments object containing parsed arguments
printError()
Display an error message
private
printError(string $sError) : mixed
Parameters
- $sError : string
-
the message to be displayed
printLine()
Display the given message in a new line
private
printLine(string $sMessage) : mixed
Parameters
- $sMessage : string
-
the message to be displayed
printUsage()
Display usage of the cli
private
printUsage() : mixed