PHP Class Mutagenesis\Mutation\MutationAbstract

ファイルを表示 Open project: padraic/mutagenesis Class Usage Examples

Protected Properties

Property Type Description
$_filename string Name and relative path of the file being mutated
$_tokensMutated array Array of source code tokens after a mutation has been applied
$_tokensOriginal array Array of original source code tokens prior to mutation

Public Methods

Method Description
__construct ( string $filename = '' ) Constructor; sets name and relative path of the file being mutated
getDiff ( ) : string Calculate the unified diff between the original source code and its its mutated form
getFilename ( ) : string Return the file path of the file which is currently being assessed for mutations.
getMutation ( array $tokens, integer $index ) : array Get a new mutation as an array of changed tokens
mutate ( array $tokens, integer $index ) Perform a mutation against the given original source code tokens for a mutable element

Protected Methods

Method Description
_reconstructFromTokens ( array $tokens ) : string Reconstruct a new mutation into a source code string based on the returned tokens

Method Details

__construct() public method

Constructor; sets name and relative path of the file being mutated
public __construct ( string $filename = '' )
$filename string

_reconstructFromTokens() protected method

Reconstruct a new mutation into a source code string based on the returned tokens
protected _reconstructFromTokens ( array $tokens ) : string
$tokens array
return string

getDiff() public method

Calculate the unified diff between the original source code and its its mutated form
public getDiff ( ) : string
return string

getFilename() public method

Return the file path of the file which is currently being assessed for mutations.
public getFilename ( ) : string
return string

getMutation() abstract public method

Get a new mutation as an array of changed tokens
abstract public getMutation ( array $tokens, integer $index ) : array
$tokens array
$index integer
return array

mutate() public method

Perform a mutation against the given original source code tokens for a mutable element
public mutate ( array $tokens, integer $index )
$tokens array
$index integer

Property Details

$_filename protected_oe property

Name and relative path of the file being mutated
protected string $_filename
return string

$_tokensMutated protected_oe property

Array of source code tokens after a mutation has been applied
protected array $_tokensMutated
return array

$_tokensOriginal protected_oe property

Array of original source code tokens prior to mutation
protected array $_tokensOriginal
return array