2016-01-19 04:55:19 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class WP_UnitTest_Factory_Callback_After_Create {
|
2019-01-09 06:43:14 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var callable
|
|
|
|
*/
|
2016-01-19 04:55:19 +01:00
|
|
|
var $callback;
|
|
|
|
|
2019-01-09 06:43:14 +01:00
|
|
|
/**
|
|
|
|
* WP_UnitTest_Factory_Callback_After_Create constructor.
|
|
|
|
*
|
|
|
|
* @param callable $callback A callback function.
|
|
|
|
*/
|
2016-01-19 04:55:19 +01:00
|
|
|
function __construct( $callback ) {
|
|
|
|
$this->callback = $callback;
|
|
|
|
}
|
|
|
|
|
2019-01-09 06:43:14 +01:00
|
|
|
/**
|
|
|
|
* Calls the set callback on given object.
|
|
|
|
*
|
|
|
|
* @param mixed $object The object to apply the callback on.
|
|
|
|
*
|
|
|
|
* @return mixed The possibly altered object.
|
|
|
|
*/
|
2016-01-19 04:55:19 +01:00
|
|
|
function call( $object ) {
|
|
|
|
return call_user_func( $this->callback, $object );
|
|
|
|
}
|
|
|
|
}
|