PHP Class Elgg\CommitMessage

Since: 1.9
Show file Open project: elgg/elgg

Public Methods

Method Description
__construct ( string | null $msg = null ) Checks if a commit message is in the correct format
__toString ( )
findLengthyLines ( string $msg, integer $max_len ) : array Returns an array of line numbers > $max_len
getLengthyLines ( ) : array Get the line number of lines that are too long
getMaxLineLength ( ) : integer Return the max line length
getMsg ( ) : string Return the processed message.
getOriginalMsg ( ) : string Return the original message
getPart ( string $part ) : string Get part of the message
getValidTypes ( ) : array Return all valid types
isValid ( ) : boolean Are all parts of the message valid
isValidFormat ( ) : boolean Whether the message format conforms to our standards.
isValidLineLength ( ) : boolean Are any of the lines too long?
isValidType ( ) : boolean Is the type valid
removeComments ( string $msg ) : string Removes all lines that start with #
setMaxLineLength ( integer $len ) : void Sets the max line length allowed.
setMsg ( string $msg ) : void Sets the active message
shouldIgnore ( ) : boolean Should this msg be ignored for formatting?

Private Methods

Method Description
processMsg ( ) : array Process the msg into its parts

Method Details

__construct() public method

Checks if a commit message is in the correct format
public __construct ( string | null $msg = null )
$msg string | null The commit message

__toString() public method

public __toString ( )

findLengthyLines() public static method

Returns an array of line numbers > $max_len
public static findLengthyLines ( string $msg, integer $max_len ) : array
$msg string The content to parse
$max_len integer Maximum length between \n in the $msg
return array

getLengthyLines() public method

Get the line number of lines that are too long
public getLengthyLines ( ) : array
return array

getMaxLineLength() public method

Return the max line length
public getMaxLineLength ( ) : integer
return integer

getMsg() public method

Return the processed message.
public getMsg ( ) : string
return string

getOriginalMsg() public method

Return the original message
public getOriginalMsg ( ) : string
return string

getPart() public method

Get part of the message
public getPart ( string $part ) : string
$part string One section of the message.
return string

getValidTypes() public static method

Return all valid types
public static getValidTypes ( ) : array
return array

isValid() public method

Are all parts of the message valid
public isValid ( ) : boolean
return boolean

isValidFormat() public method

Whether the message format conforms to our standards.
public isValidFormat ( ) : boolean
return boolean

isValidLineLength() public method

Are any of the lines too long?
See also: getLengthyLines() to get line numbers
public isValidLineLength ( ) : boolean
return boolean

isValidType() public method

Is the type valid
public isValidType ( ) : boolean
return boolean

removeComments() public static method

Removes all lines that start with #
public static removeComments ( string $msg ) : string
$msg string The msg body of the commit
return string

setMaxLineLength() public method

Defaults to 160.
public setMaxLineLength ( integer $len ) : void
$len integer The maximum length.
return void

setMsg() public method

Sets the active message
public setMsg ( string $msg ) : void
$msg string The message content
return void

shouldIgnore() public method

Should this msg be ignored for formatting?
public shouldIgnore ( ) : boolean
return boolean