PHP Класс Mutagenesis\Mutable

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_filename string Name and relative path of the file to be mutated
$_mutables array Array of mutable elements located in file
$_mutations array An array of generated mutations to be sequentially tested

Открытые методы

Метод Описание
__construct ( string $filename = null ) Constructor; sets name and relative path of the file being mutated
_parseTString ( array $token ) : string Parse a T_STRING value to identify a possible mutation type
cleanup ( ) Cleanup routines for memory management
generate ( ) : void Based on the current file, generate mutations
getFilename ( ) : string Return the file path of the file which is currently being assessed for mutations.
getMutables ( ) : array Get an array of method metainfo in tokenised form representing methods which are capable of being mutated. Note: This does not guarantee they will be mutated since this depends on the scope of supported mutations.
getMutations ( ) : array Get an array of Class & Method indexed mutations containing the mutated token and that token's index in the method's block code.
hasMutation ( string $type ) : boolean Check whether the current file will contain a mutation of the given type
setFilename ( string $filename ) Set the file path of the file which is currently being assessed for mutations.

Защищенные методы

Метод Описание
_parseMutables ( ) : array Parse the given file into an array of method metainformation including class name, method name, file name, method arguments, and method body tokens.
_parseStringToken ( array $token, integer $index ) : mixed Parse a given token (in string form) to identify its type and ascertain whether it can be replaced with a mutated form. The mutated form, if any, is returned for future integration into a mutated version of the source code being tested.
_parseToken ( array $token, integer $index ) : mixed Parse a given token (in array form) to identify its type and ascertain whether it can be replaced with a mutated form. The mutated form, if any, is returned for future integration into a mutated version of the source code being tested.
_parseTokensToMutations ( array $mutables ) : void Based on the internal array of mutable methods, generate another internal array of supported mutations accessible using getMutations().
_reconstructFromTokens ( array $tokens ) : string Reconstruct a string of source code from its constituent tokens

Описание методов

__construct() публичный Метод

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

_parseMutables() защищенный Метод

Parse the given file into an array of method metainformation including class name, method name, file name, method arguments, and method body tokens.
protected _parseMutables ( ) : array
Результат array

_parseStringToken() защищенный Метод

Parse a given token (in string form) to identify its type and ascertain whether it can be replaced with a mutated form. The mutated form, if any, is returned for future integration into a mutated version of the source code being tested.
protected _parseStringToken ( array $token, integer $index ) : mixed
$token array The token to check for viable mutations
$index integer The index of the token in the method's body
Результат mixed Return null if no mutation, or a mutation object

_parseTString() публичный Метод

Parse a T_STRING value to identify a possible mutation type
public _parseTString ( array $token ) : string
$token array
Результат string

_parseToken() защищенный Метод

Parse a given token (in array form) to identify its type and ascertain whether it can be replaced with a mutated form. The mutated form, if any, is returned for future integration into a mutated version of the source code being tested.
protected _parseToken ( array $token, integer $index ) : mixed
$token array The token to check for viable mutations
$index integer The index of the token in the method's body
Результат mixed Return null if no mutation, or a mutation object

_parseTokensToMutations() защищенный Метод

Based on the internal array of mutable methods, generate another internal array of supported mutations accessible using getMutations().
protected _parseTokensToMutations ( array $mutables ) : void
$mutables array
Результат void

_reconstructFromTokens() защищенный Метод

Reconstruct a string of source code from its constituent tokens
protected _reconstructFromTokens ( array $tokens ) : string
$tokens array
Результат string

cleanup() публичный Метод

Cleanup routines for memory management
public cleanup ( )

generate() публичный Метод

Based on the current file, generate mutations
public generate ( ) : void
Результат void

getFilename() публичный Метод

Return the file path of the file which is currently being assessed for mutations.
public getFilename ( ) : string
Результат string

getMutables() публичный Метод

Get an array of method metainfo in tokenised form representing methods which are capable of being mutated. Note: This does not guarantee they will be mutated since this depends on the scope of supported mutations.
public getMutables ( ) : array
Результат array

getMutations() публичный Метод

Get an array of Class & Method indexed mutations containing the mutated token and that token's index in the method's block code.
public getMutations ( ) : array
Результат array

hasMutation() публичный Метод

Check whether the current file will contain a mutation of the given type
public hasMutation ( string $type ) : boolean
$type string The mutation type as documented
Результат boolean

setFilename() публичный Метод

Set the file path of the file which is currently being assessed for mutations.
public setFilename ( string $filename )
$filename string

Описание свойств

$_filename защищенное свойство

Name and relative path of the file to be mutated
protected string $_filename
Результат string

$_mutables защищенное свойство

Array of mutable elements located in file
protected array $_mutables
Результат array

$_mutations защищенное свойство

An array of generated mutations to be sequentially tested
protected array $_mutations
Результат array