PHP Class Kahlan\Plugin\Stub\Method

Inheritance: extends Kahlan\Plugin\Call\Message
Datei anzeigen Open project: crysalead/kahlan

Protected Properties

Property Type Description
$_closures Closure Stub implementation.
$_return mixed The method return value.
$_returnIndex integer Index value in the Method::$_returns/Method::$_closures array.
$_returns array Return values.
$_substituteIndex integer Index value in the Method::$_substitutes array.
$_substitutes array Return values.

Public Methods

Method Description
__construct ( array $config = [] ) The Constructor.
__invoke ( array $args = [], string $self = null ) : mixed Runs the stub.
actualReturn ( ) : mixed Get the actual return value.
andReturn ( ) Set return values.
andRun ( ) Set the stub logic.
substitute ( ) : mixed Get the method substitute.
toBe ( ) Set return values.

Method Details

__construct() public method

The Constructor.
public __construct ( array $config = [] )
$config array The options array, possible options are: - `'closure'`: the closure to execute for this stub. - `'args'`: the arguments required for exectuting this stub. - `'static'`: the type of call required for exectuting this stub. - `'returns'`: the returns values for this stub (used only if the `'closure'` option is missing).

__invoke() public method

Runs the stub.
public __invoke ( array $args = [], string $self = null ) : mixed
$args array The call arguments array.
$self string The context from which the stub need to be executed.
return mixed The returned stub result.

actualReturn() public method

Get the actual return value.
public actualReturn ( ) : mixed
return mixed

andReturn() public method

Set return values.
public andReturn ( )

andRun() public method

Set the stub logic.
public andRun ( )

substitute() public method

Get the method substitute.
public substitute ( ) : mixed
return mixed

toBe() public method

Set return values.
public toBe ( )

Property Details

$_closures protected_oe property

Stub implementation.
protected Closure $_closures
return Closure

$_return protected_oe property

The method return value.
protected mixed $_return
return mixed

$_returnIndex protected_oe property

Index value in the Method::$_returns/Method::$_closures array.
protected int $_returnIndex
return integer

$_returns protected_oe property

Return values.
protected array $_returns
return array

$_substituteIndex protected_oe property

Index value in the Method::$_substitutes array.
protected int $_substituteIndex
return integer

$_substitutes protected_oe property

Return values.
protected array $_substitutes
return array