@param int      $id
@param callable $callback
@param array    $callback_params

@return \WP_Post | null WP_Post on success or null on failure
495959
public static function displaySingleItemByID ($id, $callback = null, array $callback_params = array())
    {
        $item = get_post($id);
        if (!is_null($item)) {
            global $post;
            $post = $item;
            setup_postdata($post);
            if ($callback !== null)
                call_user_func_array($callback, array_merge(array($post), $callback_params));
            wp_reset_postdata();
        }
        return $item;
    }
669230
function(callback) {
      var i = 0,
          keys = this.keys(),
          returned;

      for (i; i < keys.length; i++) {
        returned = callback(keys[i], this.get(keys[i]));
        if (returned === false) { return false; }
      };
    }
73295
public function fetchCallback(callable $callback, $mode = null)
    {
        $results = [];
        while (false !== $row = $this->fetch($mode)) {
            $results[] = call_user_func($callback, $row);
        }

        return $results;
    }
1121855
function (id, callback) {
        var todos = data.todos;

        for (var i = 0; i < todos.length; i++) {
          if (todos[i].id == id) {
            todos.splice(i, 1);
            break;
          }
        }

        flush();
        callback.call(undefined, data.todos);
      }
427934
public function AssignCallback($Callback, $Options = NULL) {
      if (!is_callable($Callback)) return FALSE;
      
      $this->Callback = $Callback;
      $this->CallbackOptions = $Options;
   }
1136831
public function actionIndex($callback, $id)
    {
        $model = NavItemPageBlockItem::findOne($id);
        
        if (!$model) {
            throw new Exception("Unable to find item id.");
        }
        
        $block = $model->block->getObject($model->id, 'callback');

        if (!$block) {
            throw new Exception("Unable to find block object.");
        }
        
        return ObjectHelper::callMethodSanitizeArguments($block, $this->callbackToMethod($callback), Yii::$app->request->get());
    }
568343
public function call($callback, array $parameters = [])
    {
        switch (count($parameters)) {
            case 0:
                return call_user_func($callback);
            case 1:
                return call_user_func($callback, $parameters[0]);
            case 2:
                return call_user_func($callback, $parameters[0], $parameters[1]);
            case 3:
                return call_user_func($callback, $parameters[0], $parameters[1], $parameters[2]);
            case 4:
                return call_user_func($callback, $parameters[0], $parameters[1], $parameters[2], $parameters[3]);
        }

        return call_user_func_array($callback, $parameters);
    }
1277552
protected static function retrieve($id = null, $params = [])
    {
        $url = static::classUrl();
        if ($id) {
            $url = $url . '/' . $id;
        }
        list($response) = static::staticRequest('get', $url, $params);
        return $response;
    }
673870
public function handle($callback = null, $errorsCallback = null)
    {
        if ($this->posted()) {
            $errors = $this->check();

            if (!$errors) {
                if (null !== $callback) {
                    $callback($this->getData());
                }
            } else {
                if (null !== $errorsCallback) {
                    $errorsCallback($errors);
                }
                return $errors;
            }
        }

        return array();
    }
473389
function (id, options, cb) {
    if (arguments.length !== 3) {
      cb = options;
      options = {};
    }
    var self = this;
    var model = this.get(id);
    if (model){
      return cb(null, model);
    }
    function done() {
      var model = self.get(id);
      if (model) {
        if (cb){
          cb(null, model);
        }
      } else {
        cb(new Error('not found'));
      }
    }
    if (options.all) {
      this.fetch({
        callback: done
      });
    } else {
      this.fetchById(id, cb);
    }
  }
996603
public function param( $param_name, $callback )
	{
		if( is_callable($callback) )
		{
			$this->_params[$param_name] = $callback( new request() );
		}
		else
		{
			$this->_params[$param_name] = $callback;
		}
	}
887079
protected function delete_callback( $post_id, $assoc_args ) {
		$status    = get_post_status( $post_id );
		$post_type = get_post_type( $post_id );

		if ( ! $assoc_args['force']
			&& ( 'post' !== $post_type && 'page' !== $post_type ) ) {
			return [
				'error',
				"Posts of type '{$post_type}' do not support being sent to trash.\n"
				. 'Please use the --force flag to skip trash and delete them permanently.',
			];
		}

		if ( ! wp_delete_post( $post_id, $assoc_args['force'] ) ) {
			return [ 'error', "Failed deleting post {$post_id}." ];
		}

		$action = $assoc_args['force'] || 'trash' === $status || 'revision' === $post_type ? 'Deleted' : 'Trashed';

		return [ 'success', "{$action} post {$post_id}." ];
	}
841298
public function chunkById( $count, callable $callback, $column = 'id' )
	{
		$lastId = null;

		$results = $this->forPageAfterId( $count, 0, $column )->get();

		while ( !empty( $results ) )
		{
			if ( call_user_func( $callback, $results ) === false )
			{
				return false;
			}

			$lastId = last( $results )->{$column};

			$results = $this->forPageAfterId( $count, $lastId, $column )->get();
		}

		return true;
	}
76262
protected function createStringCallback($callback, array $parameters)
    {
        if (function_exists($callback)) {
            return $this->createCallableCallback($callback, $parameters);
        } else {
            return $this->createClassesCallback($callback, $parameters);
        }
    }
675103
public function when($name, callable $callback, callable $default = null, array $context = [])
    {
        if ($this->isActive($name, $context)) {
            return $callback($this->params($name), $context);
        } elseif ($default) {
            return $default($this->params($name), $context);
        }

        return $this;
    }
904188
public function fieldsFor($id, $obj, callable $callback){
		$this->context->fieldsFor($id, $obj, $callback);
	}
1039616
function fetch_callback($sql, callable $callback)
	{
		$result = null;
		$rs = $this->query($sql, MYSQLI_USE_RESULT);
		while ($row = $rs->fetch_assoc())
		{
		//	if (call_user_func_array($callback, [&$row, &$result]) === false)	//	alternative: when using references, the values MUST be passed via an array with call_user_func_array(), call_user_func() only passes by value!
			if ($callback($row, $result) === false)
				break;
		}
		$rs->free_result();
		return $result;
	}