Search starting with the given search pos for the invalid codes in consecutive order.

@throws CodeError Contains the error message if there is an invalid array check.

@param array $invalidCodes
@param int $searchPos

@return void
420126
private function checkArrayStructure(array $invalidCodes, int $searchPos): void
    {
        // Rename the var to get more readable code.
        $remainingInvalidCodes = $invalidCodes;
        unset($invalidCodes);

        foreach ($remainingInvalidCodes as $nextInvalidCodeIndex => $nextInvalidCode) {
            $foundTokenPos = TokenHelper::findNextEffective($this->getFile(), $searchPos);
            $foundToken = $this->tokens[$foundTokenPos];

            // We can stop the search, if there is no invalid code.
            if ($foundToken['code'] !== $nextInvalidCode) {
                break;
            }

            // Check the next possible token
            $searchPos = $foundTokenPos + 1;
            unset($remainingInvalidCodes[$nextInvalidCodeIndex]);
        }

        $matchedEveryInvalidCode = !$remainingInvalidCodes;

        $this->file->recordMetric(
            $searchPos,
            'Invalid array comparison',
            $matchedEveryInvalidCode ? 'yes' : 'no'
        );

        if ($matchedEveryInvalidCode) {
            throw (new CodeError(static::CODE_EMPTY_ARRAY, self::MESSAGE_EMPTY_ARRAY, $searchPos));
        }
    }
492348
protected void process(BlockPos pos)
	{
		for (EnumFacing dir : searchDirs)
		{
			BlockPos newPos = pos.offset(dir);
			if (!processed.contains(newPos) && shouldProcessed(newPos))
				toProcess.add(newPos);
		}
		processed.add(pos);
		if (processed.size() >= countLimit)
			toProcess.clear();
	}
618900
private function considerStatusCodes(array $statusCodes): void
    {
        $this->requestCount += count($statusCodes);

        if ($this->autoShutdown) {
            foreach ($statusCodes as $statusCode) {
                if ($statusCode >= 500 && $statusCode < 600) {
                    $this->flagShutdown('Automatic shutdown following status code: ' . $statusCode);
                    break;
                }
            }
        }
    }
1029970
public function findByCodes($codes)
    {
        $codes = (array) $codes;
        $errors = [];
        foreach ($this as $error) {
            $cause = $error->getCause();
            if ($cause instanceof ConstraintViolation && \in_array($cause->getCode(), $codes, true)) {
                $errors[] = $error;
            }
        }

        return new static($this->form, $errors);
    }
1086469
protected function ensureIsInteger($fieldName, $valueToTest, $exceptionCode = 0)
    {
        if (!is_int($valueToTest)) {
            $type = is_object($valueToTest) ? get_class($valueToTest) : gettype($valueToTest);
            $message = sprintf('%s is not an integer, got "%s"', $fieldName, $type);
            throw new InvalidValueException($message, $exceptionCode);
        }
    }
736274
protected function checkResultCode($code)
    {
        if ($this->code > 1000) {
            throw new OutOfRangeException("Result code [$code] out of range");
        } elseif (false === $this->getConstant($this->code)) {
            throw new InvalidArgumentException("Invalid result code [$code]");
        }
    }
693361
public function setExpectedStatusCode($statusCodes)
    {
        if (!is_array($statusCodes)) {
            $this->_expectedStatusCodes[] = $statusCodes;
        } else {
            $this->_expectedStatusCodes = $statusCodes;
        }
    }
1188419
protected function validateStatusCode($statusCode) : void
	{
		if (! \is_int($statusCode))
		{
			throw new \InvalidArgumentException('HTTP status-code must be an integer');
		}
		else if (! ($statusCode >= 100 && $statusCode <= 599))
		{
			throw new \InvalidArgumentException(\sprintf('The given status-code "%d" is not valid', $statusCode));
		}
	}
1287169
@Override
    public void setStatusCode(int code) {
        StatusCodes val = null;
        try {
            val = StatusCodes.getByOrdinal(code);
        } catch (IndexOutOfBoundsException e) {
            // no FFDC required
            // nothing to do, just make the undefined value below
        }

        // this could be null because the ordinal lookup returned an empty
        // status code, or because it was out of bounds
        if (null == val) {
            val = StatusCodes.makeUndefinedValue(code);
        }
        setStatusCode(val);
    }
1075008
public function match(array $exitCodes): bool
    {
        if (!isset($exitCodes[$this->command]) || $exitCodes[$this->command] !== $this->exitCode) {
            return false;
        }

        return true;
    }
750935
function Invalid(message, code_id) {
    Error.call(this);
    this.message = message || "invalid";
    this.code_id = code_id || null;
    this.statusCode = 403;
}
850238
@JsonIgnore
	public boolean isErrorCode(String... codes) {
		for (String err : codes)
			if (errorCode.equals(err))
				return true;
		return false;
	}
545103
public static function filterStatusCode(int $code): int
    {
        $filteredCode = \filter_var($code, \FILTER_VALIDATE_INT, ['options' => [
            'min_range' => self::MINIMUM,
            'max_range' => self::MAXIMUM,
        ]]);

        if ($filteredCode === false) {
            throw new InvalidArgumentException(\sprintf(
                'The submitted code "%s" must be a positive integer between %s and %s.',
                $code,
                self::MINIMUM,
                self::MAXIMUM
            ));
        }

        return $code;
    }
12466
public static function validatePos($pos)
    {
        $posLength = strlen($pos);

        if (1 > $posLength) {
            throw new InvalidMARCspecException(
                InvalidMARCspecException::PR.
                InvalidMARCspecException::PR1,
                $pos
            );
        }

        if (preg_match('/[^0-9\-#]/', $pos)) { // alphabetic characters etc. are not valid
            throw new InvalidMARCspecException(
                InvalidMARCspecException::PR.
                InvalidMARCspecException::PR2,
                $pos
            );
        }

        if (strpos($pos, '-') === $posLength - 1) { // something like 123- is not valid
            throw new InvalidMARCspecException(
                InvalidMARCspecException::PR.
                InvalidMARCspecException::PR3,
                $pos
            );
        }

        if (0 === strpos($pos, '-')) { // something like -123 ist not valid
            throw new InvalidMARCspecException(
                InvalidMARCspecException::PR.
                InvalidMARCspecException::PR4,
                $pos
            );
        }

        if (strpos($pos, '-') !== strrpos($pos, '-')) { // only one - is allowed
            throw new InvalidMARCspecException(
                InvalidMARCspecException::PR.
                InvalidMARCspecException::PR5,
                $pos
            );
        }

        $_pos = explode('-', $pos);

        if (2 < count($_pos)) {
            throw new InvalidMARCspecException(
                InvalidMARCspecException::PR.
                InvalidMARCspecException::PR6,
                $pos
            );
        }

        if (1 == count($_pos)) {
            $_pos[1] = null;
        }

        return $_pos;
    }
535897
public function code ( $code = NULL ) {
      if ( $code === NULL )
        return $this->code;
      if ( ResponseCode::find( $code ) === NULL )
        throw new \InvalidArgumentException( "Response: no code $code" );
      $this->code = intval( $code );
      return $this;
    }
70224
private function checkLinesBeforeFirstUse(int $firstUsePos): void
    {
        $posBeforeFirstUse = TokenHelper::findPreviousExcluding($this->getFile(), T_WHITESPACE, $firstUsePos - 1);
        $realLinesBeforeUse = $this->getRealLinesBeforeFirstUse($firstUsePos, $posBeforeFirstUse);

        if ($realLinesBeforeUse !== self::LINES_BEFORE_FIRST_USE) {
            $fix = $this->getFile()->addFixableError(
                self::MESSAGE_INCORRECT_LINES_COUNT_BEFORE_FIRST_USE,
                $firstUsePos,
                self::CODE_INCORRECT_LINES_COUNT_BEFORE_FIRST_USE,
                [
                    self::LINES_BEFORE_FIRST_USE,
                    $realLinesBeforeUse
                ]
            );

            if ($fix) {
                $this->fixLinesBeforeFirstUse($firstUsePos, $posBeforeFirstUse, self::LINES_BEFORE_FIRST_USE);
            }
        }
    }
154088
public function setStatusCode($code)
    {
        $code = (int) $code;

        if (!array_key_exists($code, $this->validStatusCodes)) {
            throw new Exceptions\InvalidStatusCodeException(
                "'$code' is an invalid status code"
            );
        }

        $this->statusCode = $code;

        return $this;
    }