Marks the observable as complete.

@param mixed $value Observable return value.
501487
public function complete($value)
    {
        if (null === $this->observable) {
            return;
        }

        $this->observable = null;
        $this->delayed->resolve($value);
    }
683399
public function exor($value){
        if($this->value !== null){
            return $this->markErrorIf($value !== null);
        }
        if($value !== null){
            return $this->markErrorIf($this->value !== null);
        }
        return $this;
    }
859880
protected function resolve($value = null): void
    {
        if (~$this->state & AbstractPromise::PENDING) {
            return;
        }
        
        if ($value instanceof Promise) {
            $value->when(function (?\Throwable $e, $v = null): void {
                if ($e === null) {
                    $this->resolve($v);
                } else {
                    $this->fail($e);
                }
            });
            
            return;
        }
        
        $callbacks = $this->result;
        
        $this->state ^= AbstractPromise::PENDING | AbstractPromise::SUCCEEDED;
        $this->result = $value;
        
        if ($this instanceof Cancellable) {
            $this->context->unregisterCancellation($this);
        }
        
        if ($callbacks) {
            if (\is_array($callbacks)) {
                foreach ($callbacks as $callback) {
                    try {
                        $callback(null, $value);
                    } catch (\Throwable $e) {
                        $this->context->handleError($e);
                    }
                }
            } else {
                try {
                    $callbacks(null, $value);
                } catch (\Throwable $e) {
                    $this->context->handleError($e);
                }
            }
        }
    }
179641
public function checksum($value)
    {
        $checksum = $this->getChecksum();
        if (!empty($checksum)) {
            if (method_exists($this, $checksum)) {
                return call_user_func(array($this, $checksum), $value);
            }
        }

        return false;
    }
279374
public static function finish($value, $cap)
    {
        $quoted = preg_quote($cap, '/');

        return preg_replace('/(?:'.$quoted.')+$/u', '', $value).$cap;
    }
1104222
public function push($value)
    {
        $this->offsetSet($this->count(), $value);
        $this->seek($this->count() - 1);
    }
1354837
public function checkSelectedValue($value)
  {
    if (is_null($this->selected)) {
      return false;
    }

    if (is_array($this->selected)) {
      return in_array($value, $this->selected);
    }

    return $this->selected == $value;
  }
7394
protected function isValueSelected($value)
	{
		$val = $this->getValue();
		if (is_null($value)) {
			return FALSE;
		}
		elseif (is_array($val)) {
			return in_array($value, $val);
		}

		return $value == $val;
	}
836559
private function check($value) {

		if(true === is_string($value)) {
			
			@json_decode($value);

	 		return true === (json_last_error() == JSON_ERROR_NONE);
	 	}

	 	return false;
	}
801557
public static function checkEmpty($value)
    {
        if (!isset($value)){
            return true;
        }

        if ($value === null){
            return true;
        }

        if (trim($value) === "") {
            return true;
        }

        return false;
    }
407938
public function checkRequired($value)
    {
        if (is_null($value)) {
            return false;
        }

        if (is_string($value) && trim($value) === '') {
            return false;
        }

        if ((is_array($value) || $value instanceof Countable) && count($value) < 1) {
            return false;
        }

        return true;
    }
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);
        }
    }
1193061
public function next($value): self
    {
        $this->ensureIsNotLocked();

        $this->value = $value;
        $this->locked = true;

        return $this;
    }
1252780
function setPercentComplete( $value, $params=FALSE ) {
    $this->percentcomplete['value']  = $value;
    $this->percentcomplete['params'] = $this->_setParams( $params );
  }
687935
protected function processSetValue($value)
    {
        if ($this->onSetCallback !== null && ($this->onSetValue === null || $this->onSetValue === $value)) {
            return $this->processCallback($this->onSetCallback, $value);
        }

        return $value;
    }
1077640
private function parse(string $value): void
    {
        // Check for castling:
        if (preg_match('/^(O-O|O-O-O)(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->castling = $matches[1];
            $this->check = $matches[2] === '+';
            $this->checkmate = $matches[2] === '#';
            $this->annotation = isset($matches[3]) ? $matches[3] : null;
            return;
        }

        // Pawn movement:
        if (preg_match('/^([a-h])([1-8])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->targetColumn = $matches[1];
            $this->targetRow = (int)$matches[2];
            $this->check = $matches[3] === '+';
            $this->checkmate = $matches[3] === '#';
            $this->movedPiece = self::PIECE_PAWN;
            $this->annotation = isset($matches[4]) ? $matches[4] : null;
            return;
        }

        // Pawn movement (long san):
        if (preg_match('/^([a-h])([1-8])([a-h])([1-8])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->movedPieceDisambiguationColumn = $matches[1];
            $this->movedPieceDisambiguationRow = (int)$matches[2];
            $this->targetColumn = $matches[3];
            $this->targetRow = (int)$matches[4];
            $this->check = $matches[5] === '+';
            $this->checkmate = $matches[5] === '#';
            $this->movedPiece = self::PIECE_PAWN;
            $this->annotation = isset($matches[6]) ? $matches[6] : null;
            $this->longSan = true;
            return;
        }

        // Piece movement:
        if (preg_match('/^([KQBNR])([a-h])([1-8])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->movedPiece = $matches[1];
            $this->targetColumn = $matches[2];
            $this->targetRow = (int)$matches[3];
            $this->check = $matches[4] === '+';
            $this->checkmate = $matches[4] === '#';
            $this->annotation = isset($matches[5]) ? $matches[5] : null;
            return;
        }

        // Piece movement from a specific column:
        if (preg_match('/^([KQBNR])([a-h])([a-h])([1-8])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->movedPiece = $matches[1];
            $this->movedPieceDisambiguationColumn = $matches[2];
            $this->targetColumn = $matches[3];
            $this->targetRow = (int)$matches[4];
            $this->check = $matches[5] === '+';
            $this->checkmate = $matches[5] === '#';
            $this->annotation = isset($matches[6]) ? $matches[6] : null;
            return;
        }

        // Piece movement from a specific row:
        if (preg_match('/^([KQBNR])([0-9])([a-h])([1-8])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->movedPiece = $matches[1];
            $this->movedPieceDisambiguationRow = (int)$matches[2];
            $this->targetColumn = $matches[3];
            $this->targetRow = (int)$matches[4];
            $this->check = $matches[5] === '+';
            $this->checkmate = $matches[5] === '#';
            $this->annotation = isset($matches[6]) ? $matches[6] : null;
            return;
        }

        // Piece movement from a specific column and row (long san):
        if (preg_match('/^([KQBNR])([a-h])([0-9])([a-h])([1-8])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->movedPiece = $matches[1];
            $this->movedPieceDisambiguationColumn = $matches[2];
            $this->movedPieceDisambiguationRow = (int)$matches[3];
            $this->targetColumn = $matches[4];
            $this->targetRow = (int)$matches[5];
            $this->check = $matches[6] === '+';
            $this->checkmate = $matches[6] === '#';
            $this->annotation = isset($matches[7]) ? $matches[7] : null;
            $this->longSan = true;
            return;
        }

        // Pawn capture:
        if (preg_match('/^([a-h])x([a-h])([1-8])(?:=?([KQBNR]))?(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->targetColumn = $matches[2];
            $this->targetRow = (int)$matches[3];
            $this->movedPiece = self::PIECE_PAWN;
            $this->movedPieceDisambiguationColumn = $matches[1];
            $this->capture = true;
            $this->promotedPiece = $matches[4] ?: null;
            $this->check = $matches[5] === '+';
            $this->checkmate = $matches[5] === '#';
            $this->annotation = isset($matches[6]) ? $matches[6] : null;
            return;
        }

        // Pawn capture (long san):
        if (preg_match('/^([a-h])([1-8])x([a-h])([1-8])(?:=?([KQBNR]))?(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->targetColumn = $matches[3];
            $this->targetRow = (int)$matches[4];
            $this->movedPiece = self::PIECE_PAWN;
            $this->movedPieceDisambiguationColumn = $matches[1];
            $this->movedPieceDisambiguationRow = (int)$matches[2];
            $this->capture = true;
            $this->promotedPiece = $matches[5] ?: null;
            $this->check = $matches[6] === '+';
            $this->checkmate = $matches[6] === '#';
            $this->annotation = isset($matches[7]) ? $matches[7] : null;
            $this->longSan = true;
            return;
        }

        // Piece capture:
        if (preg_match('/^([KQBNR])x([a-h])([1-8])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->movedPiece = $matches[1];
            $this->targetColumn = $matches[2];
            $this->targetRow = (int)$matches[3];
            $this->check = $matches[4] === '+';
            $this->checkmate = $matches[4] === '#';
            $this->capture = true;
            $this->annotation = isset($matches[5]) ? $matches[5] : null;
            return;
        }

        // Piece capture from a specific column:
        if (preg_match('/^([KQBNR])([a-h])x([a-h])([1-8])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->movedPiece = $matches[1];
            $this->movedPieceDisambiguationColumn = $matches[2];
            $this->targetColumn = $matches[3];
            $this->targetRow = (int)$matches[4];
            $this->check = $matches[5] === '+';
            $this->checkmate = $matches[5] === '#';
            $this->capture = true;
            $this->annotation = isset($matches[6]) ? $matches[6] : null;
            return;
        }

        // Piece capture from a specific row:
        if (preg_match('/^([KQBNR])([0-9])x([a-h])([1-8])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->movedPiece = $matches[1];
            $this->movedPieceDisambiguationRow = (int)$matches[2];
            $this->targetColumn = $matches[3];
            $this->targetRow = (int)$matches[4];
            $this->check = $matches[5] === '+';
            $this->checkmate = $matches[5] === '#';
            $this->capture = true;
            $this->annotation = isset($matches[6]) ? $matches[6] : null;
            return;
        }

        // Piece capture from a specific column and row (long san):
        if (preg_match('/^([KQBNR])([a-h])([0-9])x([a-h])([1-8])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->movedPiece = $matches[1];
            $this->movedPieceDisambiguationColumn = $matches[2];
            $this->movedPieceDisambiguationRow = (int)$matches[3];
            $this->targetColumn = $matches[4];
            $this->targetRow = (int)$matches[5];
            $this->check = $matches[6] === '+';
            $this->checkmate = $matches[6] === '#';
            $this->capture = true;
            $this->annotation = isset($matches[7]) ? $matches[7] : null;
            $this->longSan = true;
            return;
        }

        // Check for pawn promotion:
        if (preg_match('/^([a-h])([1-8])=?([KQBNR])(\+|\#?)(\?\?|\?|\?\!|\!|\!\!)?$/', $value, $matches)) {
            $this->movedPiece = self::PIECE_PAWN;
            $this->targetColumn = $matches[1];
            $this->targetRow = (int)$matches[2];
            $this->promotedPiece = $matches[3];
            $this->check = $matches[4] === '+';
            $this->checkmate = $matches[4] === '#';
            $this->annotation = isset($matches[5]) ? $matches[5] : null;
            return;
        }

        throw new InvalidArgumentException(sprintf(
            'The value "%s" could not be parsed.',
            $value
        ));
    }
18516
public function checkReceived($value = null): ?EventCollection
    {
        $cardinality = $this->resetCardinality();
        $argumentCount = func_num_args();

        if (0 === $argumentCount) {
            $checkValue = false;
        } else {
            $checkValue = true;
            $value = $this->matcherFactory->adapt($value);
        }

        $isCall = $this->subject instanceof Call;
        $matchingEvents = [];
        $matchCount = 0;
        $eventCount = 0;

        foreach ($this->calls as $call) {
            $isMatchingCall = false;

            foreach ($call->iterableEvents() as $event) {
                if ($event instanceof ReceivedEvent) {
                    ++$eventCount;

                    if (!$checkValue || $value->matches($event->value())) {
                        $matchingEvents[] = $event;
                        $isMatchingCall = true;

                        if ($isCall) {
                            ++$matchCount;
                        }
                    }
                }
            }

            if (!$isCall && $isMatchingCall) {
                ++$matchCount;
            }
        }

        if ($isCall) {
            $totalCount = $eventCount;
        } else {
            $totalCount = $this->callCount;
        }

        if ($cardinality->matches($matchCount, $totalCount)) {
            return $this->assertionRecorder->createSuccess($matchingEvents);
        }

        return null;
    }