@param mixed $value

@throws \Error Thrown if the promise has already been resolved.
355049
private function resolve($value = null)
    {
        if ($this->resolved) {
            $message = "Promise has already been resolved";

            if (isset($this->resolutionTrace)) {
                $trace = formatStacktrace($this->resolutionTrace);
                $message .= ". Previous resolution trace:\n\n{$trace}\n\n";
            } else {
                // @codeCoverageIgnoreStart
                $message .= ", define environment variable AMP_DEBUG or const AMP_DEBUG = true and enable assertions "
                    . "for a stacktrace of the previous resolution.";
                // @codeCoverageIgnoreEnd
            }

            throw new \Error($message);
        }

        \assert((function () {
            $env = \getenv("AMP_DEBUG") ?: "0";
            if (($env !== "0" && $env !== "false") || (\defined("AMP_DEBUG") && \AMP_DEBUG)) {
                $trace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS);
                \array_shift($trace); // remove current closure
                $this->resolutionTrace = $trace;
            }

            return true;
        })());

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

        $this->resolved = true;
        $this->result = $value;

        if ($this->onResolved === null) {
            return;
        }

        $onResolved = $this->onResolved;
        $this->onResolved = null;

        if ($this->result instanceof Promise) {
            $this->result->onResolve($onResolved);
            return;
        }

        try {
            $result = $onResolved(null, $this->result);

            if ($result === null) {
                return;
            }

            if ($result instanceof \Generator) {
                $result = new Coroutine($result);
            }

            if ($result instanceof Promise || $result instanceof ReactPromise) {
                Promise\rethrow($result);
            }
        } catch (\Throwable $exception) {
            Loop::defer(static function () use ($exception) {
                throw $exception;
            });
        }
    }
1011301
public function push($value)
    {
        $this->checkType($value);
        $data = &$this->getDataPlaceHolder();
        array_push($data, $value);
    }
361387
public function setValue($value)
	{
		// any preparation goes here, for example casting to int
		$errors = $this->getValidationErrors($value);
		// if specific validation existed would go here & if
		// anything goes wrong will put error message into errors
		if(!empty($errors))
			throw $this->getContext()->getModel('ValidationException', 'Form', array(($errors)));
		return $value;
	}
249192
public static function IS_ERR($value = '')
    {
        $value = self::flattenSingleValue($value);

        return self::IS_ERROR($value) && (!self::IS_NA($value));
    }
94006
protected function onSetFormValue(string $value): void
    {
        foreach ($this->options as $option) {
            $isMatch = ($value === $option->getValue());
            $option->setSelected($isMatch);

            if ($isMatch) {
                $this->value = $value;
            }
        }

        parent::onSetFormValue($value);
    }
797745
public function error($value='')
    {
        if($this->sieve->error) {
            self::$writer->swrite(LOG_ERR, sprintf($this->template, 'ERROR', $value));
        }
    }
1217815
protected function onSetFormValue(
        /** @noinspection PhpUnusedParameterInspection */
        string $value
    ): void {
        if ($this->isEmpty() && $this->isRequired()) {
            $this->setError('Missing value');

            return;
        }
    }
849695
public static function isValid($value): bool
    {
        try {
            self::decode($value);

            return true;
        } catch (\Throwable $e) {
            return false;
        }
    }
1256649
protected function setValue($value)
    {
        if ($value === self::UNSUBSCRIBE)
        {
            $this->value = self::UNSUBSCRIBE;
        } else {
            $this->value = self::SUBSCRIBE;
        }
    }
640652
public function onSessionInit($value) {
        if(!$value->offsetExists("value")) {
            return;
        }

        $value = $value->offsetGet("value");

        foreach($this->getFormElements() as $name => $child) {
            if(!$value->offsetExists($name)) continue;

            $newvalue = $value->offsetGet($name);

            $child->setValue($newvalue);

            //check if child did some processing/initializing on object values - keep sync

            $childvalue = $child->getValue();

            if($newvalue !== $childvalue) {
                $value->offsetSet($name, $childvalue);
            }
        }
    }
128811
public function send($value)
    {
        $this->validateValidity();
        try {
            $this->g->send($value);
            return;
        } catch (\Throwable $e) {} catch (\Exception $e) {}
        $this->e = $e;
    }
757674
protected function validate($value)
	{
		if ($value < $this->minValue || $value > $this->maxValue)
		{
			throw new InvalidArgumentException('Value ' . $value . ' is out of bounds (' . $this->minValue . '..' . $this->maxValue . ')');
		}
	}
760025
public function setValue($value)
    {
        $this->clear();

        if (!is_array($value)) {
            $value = [$value];
        }

        foreach ($value as $argument) {
            $this[] = $argument;
        }
    }
1205585
public function setValue($value) {
		if($value instanceof Value) {
			$value = $value->getRawValue();
		}
		foreach($this->inputs as $inflector) {
			$value = $inflector($value);
		}
		$this->value = $value;
	}
918643
public function setDateVerified( $value )
	{
		if( $value === $this->getDateVerified() ) { return; }

		$this->_checkDateOnlyFormat( $value );

		$this->_values['vdate'] = ( $value ? (string) $value : null );
		$this->setModified();
	}
1043305
private function checkValue($value){


        $check = $this->getPossibleValueArray();
        if (!is_array($check) || empty($check)){
            $this->handleError("No Check Array defined (getPossibleValueArray())",  EnumException::NoEnumsDefined);
        }
        if (!in_array($value, $check)){
            $this->handleError("Invalid Value", EnumException::Invalidvalue);
        }
    }
1170732
protected function resolveValue($value)
    {
        if (is_array($value)) {
            $this->value = isset($value['@action']) && $value['@action'] !== 'index' ? $value['@action'] : '';
            if ($this->value !== '' && isset($value['@format'])) {
                $this->value .= '.' . $value['@format'];
            }
            $exceedingArguments = [];
            foreach ($value as $argumentKey => $argumentValue) {
                if (substr($argumentKey, 0, 1) !== '@' && substr($argumentKey, 0, 2) !== '__') {
                    $exceedingArguments[$argumentKey] = $argumentValue;
                }
            }
            if ($exceedingArguments !== []) {
                $exceedingArguments = Arrays::removeEmptyElementsRecursively($exceedingArguments);
                $exceedingArguments = $this->persistenceManager->convertObjectsToIdentityArrays($exceedingArguments);
                $queryString = http_build_query([$this->name => $exceedingArguments], null, '&');
                if ($queryString !== '') {
                    $this->value .= '?' . $queryString;
                }
            }
        }

        return true;
    }