class-wp-unittest-factory-callback-after-create.php 575 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. class WP_UnitTest_Factory_Callback_After_Create {
  3. /**
  4. * @var callable
  5. */
  6. public $callback;
  7. /**
  8. * WP_UnitTest_Factory_Callback_After_Create constructor.
  9. *
  10. * @param callable $callback A callback function.
  11. */
  12. public function __construct( $callback ) {
  13. $this->callback = $callback;
  14. }
  15. /**
  16. * Calls the set callback on a given object.
  17. *
  18. * @param mixed $object The object to apply the callback on.
  19. *
  20. * @return mixed The possibly altered object.
  21. */
  22. public function call( $object ) {
  23. return call_user_func( $this->callback, $object );
  24. }
  25. }