Emits a value from the iterator. The returned promise is resolved with the emitted value once all listeners
have been invoked.

@param mixed $value

@return \Amp\Promise

@throws \Error If the iterator has completed.
761867
private function emit($value): Promise
    {
        if ($this->complete) {
            throw new \Error("Iterators cannot emit values after calling complete");
        }

        if ($value instanceof ReactPromise) {
            $value = Promise\adapt($value);
        }

        if ($value instanceof Promise) {
            $deferred = new Deferred;
            $value->onResolve(function ($e, $v) use ($deferred) {
                if ($this->complete) {
                    $deferred->fail(
                        new \Error("The iterator was completed before the promise result could be emitted")
                    );
                    return;
                }

                if ($e) {
                    $this->fail($e);
                    $deferred->fail($e);
                    return;
                }

                $deferred->resolve($this->emit($v));
            });

            return $deferred->promise();
        }

        $this->values[] = $value;
        $this->backPressure[] = $pressure = new Deferred;

        if ($this->waiting !== null) {
            $waiting = $this->waiting;
            $this->waiting = null;
            $waiting->resolve(true);
        }

        return $pressure->promise();
    }
672265
protected function executionCallback($value, $firstRun = false) {
        if (!$firstRun) {
            $this->results[$this->iterator] = $value;
            $this->iterator++;
        }
        if (empty($this->queue)) {
            $resolve = $this->resolve;
            $resolve($this->results);
            return;
        }
        $promise = $this->next();
        $thenFunc = function($value) {
            return call_user_func([$this, 'executionCallback'], $value);
        };
        $promise->done($thenFunc, $this->reject, $this->notify);
    }
602243
public function append($value)
    {
        $nValue = (is_array($value) ? $value : [$value]);
        return $this->vUnion(new static($nValue));
    }
36190
public function setRed($value)
    {
        $this->assertChannelValue($value, self::CHANNEL_RED);
        $this->red = $value;

        return $this;
    }
888844
public function createReceived($value): ReceivedEvent
    {
        return new ReceivedEvent(
            $this->sequencer->next(),
            $this->clock->time(),
            $value
        );
    }
484806
protected function resolveValue($value)
    {
        do {
            if ($value instanceof \JsonSerializable) {
                $value = $value->jsonSerialize();
            } elseif ($value instanceof \Closure) {
                $value = $value();
            } else {
                break;
            }
        } while (true);

        return $value;
    }
704606
public function output($value = null)
    {
        $value = is_null($value) ? $this->value : $value;

        return $this->isRepeatable()
            ? $this->outputRepeatable().$this->getExplanation()
            : $this->outputInput($value).$this->getExplanation();
    }
1363813
public function value($value = null)
    {
        $element = clone $this;

        $element->value = $value;

        $element->applyValueToOptions();

        return $element;
    }
283217
public function with_value( $value ) {
		if ( $this->value === $value ) {
			return $this;
		}

		$cloned_token        = clone $this;
		$cloned_token->value = $value;

		return $cloned_token;
	}
479281
protected function valueRetriever($value)
    {
        if ($this->useAsCallable($value)) {
            return $value;
        }

        return function ($item) use ($value) {

            return ArrayHelper::dataGet($item, $value);
        };
    }
1294931
private function emit($value): Awaitable
    {
        if (null === $this->observable) {
            throw new CompletedError();
        }

        $delayed = $this->delayed;
        $placeholder = $this->placeholder;

        $this->delayed = new Delayed();
        $this->placeholder = new Placeholder($this->delayed);

        $delayed->resolve($value);

        return $placeholder->wait();
    }
1249090
private function resolve($value): Input
    {
        $rules = $this->queueOfRules->toArray();
        $input = Input::make($value);

        foreach ($rules as $rule) {
            $input = $rule->execute($input);
        }

        $input = $this->applyTypeValidation($input);

        return $input;
    }
1110628
public function update($value)
        {
            $this->validate($value);
            if ($this->chaining) {
                $this->chain = $value;
            } else {
                $this->current = $value;
            }
            return $this;
        }
447018
public function setValue($value = null)
    {
        if (is_callable($value)) {
            $value = call_user_func($value);
        }

        $value = $this->handleJsonType($value);

        $this->value = $value;

        return $this;
    }
1191549
public function setValue($value)
    {
        $this->value = $value;
        $this->listeners->executeAll($this->value);
    }
681110
public function set($value = null)
    {
        //get args
        $args = func_get_args();
        
        if (count($args) < 2) {
            return $this;
        }
        
        $value = array_pop($args);
        $last = array_pop($args);
        
        $pointer = &$this->data;
        foreach ($args as $i => $step) {
            if (!isset($pointer[$step])
                || !is_array($pointer[$step])
            ) {
                $pointer[$step] = array();
            }

            $pointer = &$pointer[$step];
        }
        
        $pointer[$last] = $value;
        
        return $this;
    }
1144948
public function asValue($value)
    {
        $endPoint = &$this->getEndPoint();
        $endPoint['lookupType'] = self::TYPE_VALUE;
        $endPoint['value'] = $value;

        return $this;
    }