Set a callback used to search the hierarchy globally, even before
applying the filter.

@param callable $callback
@return $this
342972
public function setSearchFunction($callback)
    {
        if (!is_callable($callback, true)) {
            throw new InvalidArgumentException('TreeDropdownField->setSearchFunction(): not passed a valid callback');
        }

        $this->searchCallback = $callback;
        return $this;
    }
586442
public function setCallbacks(array $callbacks = [])
    {
        foreach ($callbacks as $type => $items) {
            foreach ($items as $item) {
                $this->addCallbackJob($type, $item);
            }
        }

        return $this;
    }
48133
public function setCallback($callback = null)
    {
        if (!is_null($callback) && !is_callable($callback)) {
            throw new Exception("callback must be of type callable or null");
        }

        $this->callback = $callback;

        return $this;
    }
683285
public function setCallback($callback = false)
    {
        if(!$callback)
        {
            $callback = \Ginger\System\Parameters::$callback;
        }
        $this->callback = $callback;
    }
8638
public function setCallback(callable $callback, array $params = [])
    {
        if ($this->hasCallback()) {
            throw new ArchException('Callback already defined');
        }
        $this->callback = $callback;
        $this->callbackParams = $params;
        return $this;
    }
464431
public function setFilterCallback($callback, $flags = null)
    {
        $flags = ((int) $flags) | self::FILTER_REPLACE;
        $this->addFilterCallback($callback, $flags);
    }
932211
public function map($callback) {

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

      foreach ($this->getItems() as $index => $item) {
        call_user_func_array($callback, array($item, $index, $this));
      }

      $this->rewind();

      return $this;
    }
121313
public function sort( callable $callback )
    {
        uasort( $this->collection, $callback );
        reset( $this->collection );
        return $this;
    }
618984
public function setCallback($callback){
		if(!is_callable($callback))
			throw new Exception('Invalid callback passed for logging: '.$callback);
		$this->callback = $callback;
		return $this;
	}
1282314
public function setConstraint(Closure $callback)
    {
        $this->data            = [];
        $this->loaded          = false;
        $this->queryConstraint = $callback;

        return $this;
    }
217257
public function preprocess(callable $callback)
    {
        if ($callback instanceof Closure) {
            $callback = $callback->bindTo($this, get_class($this));
        }

        $this->getPreprocessor()->register($callback);
        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;
    }
422861
public function setEditableCallback($callback)
    {
        $this->isEditable() ?: $this->setEditable();
        $this->editableCallback = $callback;

        return $this;
    }
1313279
public function filter(callable $callback = null)
    {
        foreach ($this->items as $key => $value) {
            if (
                (!$callback && !(bool)$value) ||
                ($callback && !$callback($value, $key))
            ) {
                unset($this->items[$key]);
            }
        }

        return $this;
    }
1094266
public function map(\Closure $callback)
    {

        $this->_items = array_map($callback, $this->_items);

        return $this;
    }
1036459
public function each(callable $callback)
    {
        foreach ($this->all() as $key => $value) {
            $callback($key, $value);
        }

        return $this;
    }
795764
public function callback(string $name, callable $callback): self
    {
        $this->callbacks[$name] = $callback;
        return $this;
    }