Execute a callback without changing value of promise.
@param $callback
@return $this
356145
private function _finally($callback) {
        if ($this->state !== self::PENDING) {
            $callback($this->value);
        }
        return $this;
    }
1208936
public function onSuccess(Closure $callback)
    {
        return $this->then(function (Container $container) use ($callback) {
            if (0 === $this->exitCode) {
                $container->call($callback);
            }
        });
    }
1113008
public function when($callback)
    {
        $this->filters[] = is_callable($callback) ? $callback : function () use ($callback) {
            return $callback;
        };

        return $this;
    }
765471
public function control(callable $callback, $context = null)
    {
        $this->control = $callback;
        $this->controlContext = $context;

        return $this;
    }
1250514
public function callback(string $name, callable $callback): self
    {
        $this->data->callback($name, $callback);
        return $this;
    }
629598
public function each( \Closure $callback )
	{
		foreach( $this->items as $name => $properties )
		{
			if( $callback($properties, $name) === false )
			{
				break;
			}
		}

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

        return $this;
    }
107374
public function save($callback)
    {
        foreach ($this as $object) {
            call_user_func($callback, $object);
            if($object->changes()) $object->save();
        }

        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;
    }
983241
public function setEditableRowCallback($callback)
    {
        $this->isEditable() ?: $this->setEditable();
        $this->editableRowCallback = $callback;

        return $this;
    }
571875
public function setCallback(callable $callback): EventObserver
    {
        $this->callback = $callback;
        $this->id = $this->getId($callback);

        return $this;
    }
1231509
public function addCallback($callback, $driver = null)
	{
		if (!empty($driver)) {
			if (is_array($driver)) {
				if (!in_array($this->index->driver, $driver)) {
					return $this;
				}
			}
			else if ($driver != $this->index->driver) {
				return $this;
			}
		}
		
		$this->callbacks[] = $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;
    }
306154
function (callback) {
        return new Promise((resolve, reject) => {
          this.end(result => {
            try {
              resolve(callback(result))
            } catch (err) {
              reject(err)
            }
          })
        })
      }
431933
public function callback($callback)
    {
        $t = $this;
        $args = array_slice(func_get_args(),1);

        // use an event handler to dispatch to the callback
        $this->_events->register('startTransaction', function($event, $connection) use ($t, $callback, $args) {
            $t->results []= call_user_func_array($callback, $args);
        });

        return $this;
    }
244944
function (callback) {
            var promise = new Promise();
            this.addCallback(function () {
                try {
                    when(isFunction(callback) ? callback.apply(this, arguments) : callback).then(promise);
                } catch (e) {
                    promise.errback(e);
                }
            });

            this.addErrback(function () {
                try {
                    when(isFunction(callback) ? callback.apply(this, arguments) : callback).then(promise);
                } catch (e) {
                    promise.errback(e);
                }
            });
            return promise.promise();
        }
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;
    }