Sets a callback which is going to be fired always when we have a room for more jobs
@param  callable $cb Callback
@return this
352444
public function more($cb = null)
    {
        if ($cb !== null) {
            $this->more = $cb;
            $this->moreFirstFlag = true;
            return $this;
        }
        if ($this->more !== null) {
            if ($this->more instanceof \Iterator) {
                iterator:
                $it = $this->more;
                while (!$this->isQueueFull() && $it->valid()) {
                    if ($this->moreFirstFlag) {
                        $this->moreFirstFlag = false;
                    } else {
                        $it->next();
                        if (!$it->valid()) {
                            break;
                        }
                    }
                    $this->addJob($it->key(), $it->current());
                }
            } else {
                $func = $this->more;
                if (($r = $func($this)) instanceof \Iterator) {
                    $this->more = $r;
                    goto iterator;
                }
            }
        }
        return $this;
    }
3964
public function onConnected($cb)
    {
        if ($this->state === self::STATE_AUTH_ERROR) {
            $cb($this, false);
        } elseif ($this->state === self::STATE_AUTH_OK) {
            $cb($this, true);
        } else {
            if (!$this->onConnected) {
                $this->onConnected = new StackCallbacks();
            }
            $this->onConnected->push($cb);
        }
    }
751931
public function each(callable $callback)
    {
        foreach ($this->items as $key => $item) {
            $result = $callback($item, $key);

            if (false === $result) {
                break;
            }

            if (!is_object($item)) {
                $this->items[$key] = $result;
            }
        }

        return $this;
    }
1061546
public function eachChild($callback)
    {
        foreach ($this->children as $child) {
            call_user_func($callback, $child);
        }

        return $this;
    }
456737
public function addListener($cb)
    {
        if ($this->state === self::STATE_DONE) {
            $cb($this);
            return;
        }
        $this->listeners[] = CallbackWrapper::wrap($cb);
    }
328468
public function each(callable $callback)
	{
		foreach ($this->members as $key => $member)
		{
			if ($callback($key, $member) === false) {
				break;
			}
		}
		return $this;
	}
750076
public function setCallback($callback)
    {
        // If the provided $value is not a closure, make it one now for easy resolution.
        if (!is_callable($callback)) {
            $callback = function () use ($callback) {
                return $callback;
            };
        }

        if ($this->protected) {
            return $this;
        }

        $this->callback = $callback;

        return $this;
    }
434695
public function each(callable $callback) : self {

      if (!is_callable($callback)) {
        throw new \InvalidArgumentException('Invalid callback function');
      }

      foreach ($this->getTokens() as $index => $item) {
        call_user_func($callback, $item, $index, $this);
      }

      $this->rewind();

      return $this;
    }
1290850
public function killCallback($callback)
    {
        $key = $this->getCallbackKey($callback);

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

        return $this;
    }
590856
public function setStartCallable(callable $startCallable): self
    {
        assert($this->checkProcedureStartOrEndCallableSignature($startCallable));

        $this->startCallable = $startCallable;

        return $this;
    }
250231
public function setUserCallback (callable $callback)
	{
		//$this->usercallback = $callback;

		if (count ($this->usercallback) > 0)
			throw new InvalidParameter ("A usercallback was already set. Use addUserCallback to add multiple callbacks");

		$this->addUserCallback ('default', $callback);

		return $this;
	}
274794
public function when($condition, callable $trueCallback, callable $falseCallback = null)
    {
        if ($condition) {
            call_user_func($trueCallback, $this);
        } else {
            is_callable($falseCallback) && call_user_func($falseCallback, $this);
        }
        return $this;
    }
795764
public function callback(string $name, callable $callback): self
    {
        $this->callbacks[$name] = $callback;
        return $this;
    }
233516
def add_callback(self, cb):
        
        if ((cb in self.callbacks) is False):
            self.callbacks.append(cb)
666386
public function setEditableColumns($callback = NULL)
    {
        $this->onRender[] = function(Grid $grid) use ($callback) {
            if (!$grid->hasColumns()) {
                return;
            }

            foreach ($grid->getComponent(Column::ID)->getComponents() as $column) {
                if ($column instanceof Editable && !$column->isEditableDisabled() && !$column->editableCallback) {
                    $column->setEditable($callback);
                }
            }
        };

        return $this;
    }
1281874
public function setCallback($callback)
    {
        if (!is_callable($callback)) {
            throw new InvalidArgumentException('Expected a callable. Got an uncallable '. gettype($callback));
        }

        $this->callback = $callback;

        return $this;
    }
471744
public function addLogger(callable $callback)
    {
        if (!is_callable($callback)) {
            throw LoggerException::forInvalidCallback();
        }

        if ($callback instanceof Closure) {
            $callback = $callback->bindTo($this, get_class($this));
        }

        $this->loggers[] = $callback;

        return $this;
    }