Set callback for choosing target index.

@param  callback $callback
@throws Zend_Search_Lucene_Exception
764124
public function setDocumentDistributorCallback($callback)
    {
        if ($callback !== null  &&  !is_callable($callback)) {
            include_once 'Zend/Search/Lucene/Exception.php';
            throw new Zend_Search_Lucene_Exception('$callback parameter must be a valid callback.');
        }

        $this->_documentDistributorCallBack = $callback;
    }
274879
public function onLogQuery(callable $callback = null)
    {
        if ($callback === null || is_callable($callback)) {
            $this->on_log_query = $callback;
        } else {
            throw new InvalidArgumentException('Callback needs to be NULL or callable');
        }
    }
186826
public function setFilterFunction($callback)
    {
        if (!is_callable($callback, true)) {
            throw new InvalidArgumentException('TreeDropdownField->setFilterCallback(): not passed a valid callback');
        }

        $this->filterCallback = $callback;
        return $this;
    }
25029
public function withBulkProcessing(callable $callback)
    {
        $bulkProcessing = $this->bulkProcessing;
        $this->bulkProcessing = true;
        try {
            /** @noinspection PhpUndefinedMethodInspection */
            $callback->__invoke();
        } catch (\Exception $exception) {
            $this->bulkProcessing = $bulkProcessing;
            throw $exception;
        }
        $this->bulkProcessing = $bulkProcessing;
    }
250555
protected function setArray($name, callable $callback = null)
    {
        return $this->field(Type::TARRAY, $name, $callback);
    }
978602
public function each(callable $callback)
    {
        foreach ($this->collection as $key => $value) {
            $callback($value, $key);
        }
    }
1195541
function createIndex($name, $callback = false)
    {

        $index = new Index($name, $callback);

        $index->connection = $this->connection;

        return $index->create();
    }
103672
private function updateData($callback = null): void
    {
        $queryBuilder = $this->dbUtils->getConn()->createQueryBuilder();
        if ($this->limit === 0) {
            $this->setLimit($this->dbUtils->countResults($this->entity));
        }

        $this->expression->evaluateExpressions(
            $this->configEntities[$this->entity]['pre_actions']
        );

        $startAt = 0; // The first part of the limit (offset)
        $num = 0; // The number of rows updated
        while ($num < $this->limit) {
            $rows = $queryBuilder
                ->select('*')->from($this->entity)
                ->setFirstResult($startAt)->setMaxResults($this->batchSize)
                ->orderBy($this->priKey)
                ->execute();

            // I need to read line by line if I have to update the table
            // to make sure I do update by update (slower but no other choice for now)
            foreach ($rows as $row) {
                // Call the right method according to the mode
                $this->{$this->updateMode[$this->mode]}($row);

                if ($callback !== null) {
                    $callback(++$num);
                }
                // Have to exit now as we have reached the max
                if ($num >= $this->limit) {
                    break 2;
                }
            }
            // Move the offset
            // Make sure the loop ends if we have nothing to process
            $num = $startAt += $this->batchSize;
        }
        // Run a final method if defined
        if ($this->mode === 'batch') {
            $this->loadDataInBatch('update');
        }

        $this->expression->evaluateExpressions(
            $this->configEntities[$this->entity]['post_actions']
        );
    }
954172
public function setJsonCallbackWrap($callback)
    {

        if (empty($callback)) {
            $this->jsonCallbackWrap = false;
            return;
        }

        if (!is_string($callback)) {
            throw new \Exception('JSON callback wrap should be a string or false.');
        }

        $this->jsonCallbackWrap = $callback;
    }
464431
public function setFilterCallback($callback, $flags = null)
    {
        $flags = ((int) $flags) | self::FILTER_REPLACE;
        $this->addFilterCallback($callback, $flags);
    }
983241
public function setEditableRowCallback($callback)
    {
        $this->isEditable() ?: $this->setEditable();
        $this->editableRowCallback = $callback;

        return $this;
    }
1004981
public function setCallback($callback)
    {
        if ($callback instanceof \OldSound\RabbitMqBundle\RabbitMq\ConsumerInterface) {
            $callback = array($callback, 'execute');
        }
        $this->callback = $callback;

        return $this;
    }
997401
public static function ignoreif($callback)
    {
        if (is_callable($callback) === false) {
            throw new Exception('Invalid callback');
        }

        App::on('init', function () use ($callback) {
            if ($callback()) {
                App::env('maintenance', false);
            }
        });
    }
1290850
public function killCallback($callback)
    {
        $key = $this->getCallbackKey($callback);

        self::$_baseRealCallbacks[$key] = false;

        return $this;
    }
53992
public function setCallback(Closure $callback = null)
    {
        if ($this->callback !== null || $callback === null) {
            throw new \RuntimeException("Cannot redeclare this comparer callback.");
        }

        $this->callback = Closure::bind($callback, $this, get_called_class());
    }
900181
public function transform(callable $callback): self
    {
        $index = 0;
        foreach ($this->items as $key => $value) {
            $this->set($key, $callback($value, $key, $index++));
        }

        return $this;
    }
456681
public static function on($event, $callback){

        if( !isset(self::$observers[ $event ]) ){
            self::$observers[ $event ] = array();
        }

        self::$observers[ $event ][] = $callback;
    }