lithium\test\Mocker::_dynamicCode()

protected static method

Will generate the code you are wanting.

This pulls from $_mockDelegateIngredients and $_mockIngredients.

Parameters

  • string $type

    The name of the array of ingredients to use

  • string $key

    The key from the array of ingredients

  • array

    $tokens Tokens, if any, that should be inserted

Returns

string

Source

	protected static function _dynamicCode($type, $key, $tokens = []) {
		$defaults = [
			'master' => '\lithium\test\Mocker',
		];
		$tokens += $defaults;
		$name = '_' . $type . 'Ingredients';
		$code = implode("\n", static::${$name}[$key]);
		return Text::insert($code, $tokens) . "\n";
	}