Fire callback for each member of the array.

@param callable $callback

@return $this
977925
public function each(callable $callback)
    {
        if ($this->isCollection()) {
            foreach ($this->data as $val) {
                $callback($this->box($val));
            }
        } else {
            $callback($this->box($this->data));
        }

        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;
    }
1049950
public function groupBy(callable $callback)
    {
        $results = [];

        foreach ($this->items as $key => $value) {
            $groupKey = $callback($value, $key, $this->items);

            if (! isset($results[$groupKey])) {
                $results[$groupKey] = [];
            }

            $results[$groupKey][$key] = $value;
        }

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

        $this->getPreprocessor()->register($callback);
        return $this;
    }
1221
public function on($type, $callback)
    {
        if (!isset($this->callbacks[$type])) {
            $this->callbacks[$type] = [];
        }
        $this->callbacks[$type][] = $callback;
        return $this;
    }
237918
public function whenLogged($callback)
    {
        $this->loggedInCallbacks[] = $callback;

        if ($this->isLogged()) {
            fire_callbacks($this->loggedInCallbacks, $this);
        }
    }
573385
public function removeReturnListener(callable $callback)
    {
        foreach ($this->returnCallbacks as $k => $v) {
            if ($v === $callback) {
                unset($this->returnCallbacks[$k]);
            }
        }

        return $this;
    }
557245
public function execute(\Closure $callback)
    {
        $this->action = self::NODE_ACTION_EXECUTE;
        $this->data['callback'] = $callback;
        return $this;
    }
1357981
public function postprocess(callable $callback)
    {
        if ($callback instanceof Closure) {
            $callback = $callback->bindTo($this, get_class($this));
        }

        $this->getPostprocessor()->register($callback);
        return $this;
    }
871793
public function registerCallback(callable $callback)
    {
        $this->pipeline
            ->pipe($callback)
            ->process($this->config);

        return $this;
    }
994845
protected static function callback($callback)
    {
        if( is_string($callback) && ! is_callable($callback) )
        {
            return self::controllerCallback($callback);
        }

        return $callback;
    }
379748
public function addCallback(string $key, callable $callback): self
    {
        if (!isset($this->callbacks[$key])) {
            $this->callbacks[$key] = $callback;
        } else {
            throw new \Exception("Callback with key ($key) already exists");
        }

        return $this;
    }
422861
public function setEditableCallback($callback)
    {
        $this->isEditable() ?: $this->setEditable();
        $this->editableCallback = $callback;

        return $this;
    }
1214530
public function after($callback)
    {
        $callbacks = $this->getOption('_after_middlewares');
        $callbacks[] = $callback;
        $this->setOption('_after_middlewares', $callbacks);

        return $this;
    }
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;
    }
1290622
public function each(callable $callback)
    {
        $array = $this->getArrayCopy();
        foreach ($array as $key => $value) {
            $callback($value, $key, $array);
        }
    }
1061546
public function eachChild($callback)
    {
        foreach ($this->children as $child) {
            call_user_func($callback, $child);
        }

        return $this;
    }