Tribe__Promise::__construct( string|array|Tribe__Utils__Callback $callback = null, array $items = null, array $extra_args = array() )
Tribe__Promise constructor.
Contents
Parameters
- $callback
-
(string|array|Tribe__Utils__Callback) (Optional) The callback that should run to perform the promise task.
Default value: null
- $items
-
(array) (Optional) The items to process, each item will be passed as first argument to the callback at run-time.
Default value: null
- $extra_args
-
(array) (Optional) An array of extra arguments that will be passed to the callback function.
Default value: array()
Source
File: src/Tribe/Promise.php
public function __construct( $callback = null, array $items = null, array $extra_args = array() ) {
parent::__construct();
if ( ! empty( $callback ) && ! empty( $items ) ) {
foreach ( $items as $target ) {
$item['callback'] = $callback;
$item['args'] = array_merge( array( $target ), $extra_args );
$this->push_to_queue( $item );
}
}
}