PHP Class PHPComposter\PHPComposter\BaseAction

This class should be extended by each new action.
Since: 0.1.3
Author: Alain Schlesser ([email protected])
Show file Open project: php-composter/php-composter

Protected Properties

Property Type Description
$hook string Hook that was triggered.
$root string Root folder of the package.

Public Methods

Method Description
__construct ( string $hook, string $root ) Instantiate a BaseAction object.
init ( ) Initialize the action.
shutdown ( ) Shut the action down.

Protected Methods

Method Description
getAgainst ( ) : string Get the tree object to check against.
getStagedFiles ( $pattern ) : array Get the file sthat have been staged for the current commit.
recursiveGlob ( string $pattern, integer $flags ) : mixed Recursively iterate over folders and look for $pattern.

Private Methods

Method Description
prependRoot ( string &$file, integer $index, string $root ) Prepend the repository root path

Method Details

__construct() public method

Instantiate a BaseAction object.
Since: 0.1.3
public __construct ( string $hook, string $root )
$hook string The name of the hook that was triggered.
$root string Absolute path to the root folder of the package.

getAgainst() protected method

Get the tree object to check against.
protected getAgainst ( ) : string
return string HEAD or hash representing empty/initial commit state

getStagedFiles() protected method

Get the file sthat have been staged for the current commit.
Since: 0.1.3
protected getStagedFiles ( $pattern ) : array
return array

init() public method

Initialize the action.
Since: 0.1.3
public init ( )

recursiveGlob() protected method

Recursively iterate over folders and look for $pattern.
Since: 0.1.3
protected recursiveGlob ( string $pattern, integer $flags ) : mixed
$pattern string Pattern to look for.
$flags integer Optional. Flags to PHP glob() function. Defaults to 0.
return mixed

shutdown() public method

Shut the action down.
Since: 0.1.3
public shutdown ( )

Property Details

$hook protected property

Hook that was triggered.
Since: 0.1.3
protected string $hook
return string

$root protected property

Root folder of the package.
Since: 0.1.3
protected string $root
return string