Checks response code.

@param $num
556834
public function seeResponseCodeIs($num)
    {
        \PHPUnit\Framework\Assert::assertEquals($num, $this->client->getInternalResponse()->getStatus());
    }
857061
public function validate($param)
    {
        /*
         * If we don't have a value to validate, check if it's required.
         * @link http://raml.org/spec.html#required
         */
        if (\in_array($param, [null, ''], true)) {
            if ($this->isRequired()) {
                throw new ValidationException($this->getKey() . ' is required', static::VAL_ISREQUIRED);
            }

            return;
        }

        switch ($this->getType()) {
            case static::TYPE_BOOLEAN:

                // Must be boolean
                if (!\is_bool($param)) {
                    throw new ValidationException($this->getKey() . ' is not boolean', static::VAL_NOTBOOLEAN);
                }

                break;
            case static::TYPE_DATE:

                // Must be a valid date
                if (!\DateTimeImmutable::createFromFormat('D, d M Y H:i:s T', $param)) {
                    throw new ValidationException($this->getKey() . ' is not a valid date', static::VAL_NOTDATE);
                }

                // no break

            case static::TYPE_STRING:

                // Must be a string
                if (!\is_string($param)) {
                    throw new ValidationException($this->getKey() . ' is not a string', static::VAL_NOTSTRING);
                }

                /**
                 * Check the length of a string.
                 *
                 * @link http://raml.org/spec.html#minlength
                 */
                $minLength = $this->getMinLength();
                if (!empty($minLength) && \strlen($param) < $minLength) {
                    throw new ValidationException(
                        $this->getKey() . ' must be at least ' . $minLength . ' characters long',
                        static::VAL_TOOSHORT
                    );
                }

                /**
                 * Check the length of a string.
                 *
                 * @link http://raml.org/spec.html#maxlength
                 */
                $maxLength = $this->getMaxLength();
                if (!empty($maxLength) && \strlen($param) > $maxLength) {
                    throw new ValidationException(
                        $this->getKey() . ' must be no more than ' . $maxLength . ' characters long',
                        static::VAL_TOOLONG
                    );
                }

                break;
            case static::TYPE_INTEGER:

                /*
                 * Integers must be of type integer.
                 *
                 * @link http://raml.org/spec.html#type
                 */
                if (!\is_int($param)) {
                    throw new ValidationException($this->getKey() . ' is not an integer', static::VAL_NOTINT);
                }
                // no break

            case static::TYPE_NUMBER:

                /*
                 * Number types must be numeric. ;)
                 *
                 * @link http://raml.org/spec.html#type
                 */
                if (!\is_numeric($param)) {
                    throw new ValidationException($this->getKey() . ' is not a number', static::VAL_NOTNUMBER);
                }

                /**
                 * Check the value constraints if specified.
                 *
                 * @link http://raml.org/spec.html#minimum
                 */
                $min = $this->getMinimum();
                if (!empty($min) && $param < $min) {
                    throw new ValidationException(
                        $this->getKey() . ' must be greater than or equal to ' . $min,
                        static::VAL_NUMLESSTHAN
                    );
                }

                /**
                 * Check the value constraints if specified.
                 *
                 * @link http://raml.org/spec.html#maximum
                 */
                $max = $this->getMaximum();
                if (!empty($max) && $param > $max) {
                    throw new ValidationException(
                        $this->getKey() . ' must be less than or equal to ' . $max,
                        static::VAL_GREATERTHAN
                    );
                }

                break;
            case static::TYPE_FILE:
                // File type cannot be reliably validated based on its type alone.

                break;
            case static::TYPE_TIME_ONLY:
            case static::TYPE_DATE_ONLY:
            case static::TYPE_DATETIME_ONLY:
            case static::TYPE_DATETIME:
                $typeObject = ApiDefinition::determineType(
                    $this->key,
                    [
                        'type' => $this->getType(),
                        'format' => $this->getFormat(),
                    ]
                );
                $typeObject->validate($param);
                if (!$typeObject->isValid()) {
                    throw new ValidationException($typeObject->getErrors()[0]);
                }

                break;
        }

        /**
         * Validate against the RAML specified pattern if it exists.
         *
         * @link http://raml.org/spec.html#pattern
         */
        $validationPattern = $this->getValidationPattern();
        if (!empty($validationPattern) &&
            \preg_match('|' . $validationPattern . '|', $param) !== 1
        ) {
            throw new ValidationException(
                $this->getKey() . ' does not match the specified pattern',
                static::VAL_PATTERNFAIL
            );
        }

        /*
         * If we have an enum (array), then it must be a specified value.
         *
         * NOTE: The RAML spec states that "enum" only applies to strings. However, it
         * could just as easily apply to integers or any other data type that an array
         * can hold in a YAML structure.
         *
         * @link http://raml.org/spec.html#enum
         */
        if (\is_array($enum = $this->getEnum()) && !\in_array($param, $enum, true)) {
            throw new ValidationException(
                $this->getKey() . ' must be one of the following: ' . \implode(', ', $enum),
                static::VAL_NOTENUMVALUE
            );
        }
    }
1352893
private function encodeSignedNumber($num)
    {
        $sgn_num = $num << 1;
        if ($num < 0) {
            $sgn_num = ~($sgn_num);
        }
        return $this->encodeNumber($sgn_num);
    }
559496
public function orWhere($param){
        if (func_num_args() == 3) {

            $operator =strtolower(func_get_arg(1));
            if (is_numeric(array_search($operator, $this->condition))) {
                $this->whereby .=' or '.self::sanitize(func_get_arg(0))
                    .' '. $operator . ' \''
                    . self::sanitize(func_get_arg(2)) . '\'';
            } else {
                static::$response["status"] = "error";
                static::$response["response"] = "Invalid condition provided in where function";
                static::$response["code"] = 7000;
            }
        } else if (func_num_args() == 2) {
            $this->whereby .= ' or '.self::sanitize(func_get_arg(0)) . ' = \''
                . self::sanitize(func_get_arg(1)) . '\'';
        } else {
            static::$response["status"] = "error";
            static::$response["response"] = "Invalid parameters provided in where function";
            static::$response["code"] = 7001;
        }

        return $this;
    }
70292
public function seeEmailIsSent($num = null)
    {
        if ($num === null) {
            $this->assertNotEmpty($this->grabSentEmails(), 'emails were sent');
            return;
        }
        $this->assertEquals($num, count($this->grabSentEmails()), 'number of sent emails is equal to ' . $num);
    }
229738
public function check($params)
	{
		$requestParams = $this->initRequestParams('check', $params);
		$this->request('check', $requestParams);

		return empty($this->error);
	}
727446
public function check(Request $request)
    {
        $request->validate(['code' => 'required|numeric']);

        if (Hash::check($request->code, $this->getHash())) {
            session(['can_visit' => true]);

            return response([
                'status' => 'success',
            ]);
        }

        $this->incrementLoginAttempts($request);

        if ($this->hasTooManyLoginAttempts($request) && $this->throttleIsActive()) {
            return response([
                'too_many_attempts' => true,
                'seconds_message'  => TransFormer::transform($this->getBlockedSeconds($request), $this->config['seconds_message']),
            ], 401);
        }

        return response([
            'too_many_attempts' => false,
            'attempts_left'    => $this->showAttempts($request),
        ], 401);
    }
438965
public static function ordinal($num)
	{
		$ext = 'th';
		if ($num < 11 || $num > 13) {
			switch ($num % 10) {
				case 1:
					$ext = 'st';
					break;
				case 2:
					$ext = 'nd';
					break;
				case 3:
					$ext = 'rd';
			}
		}
		return $num.$ext;
	}
1000318
function checkNum(nums, min, max){
  if(nums == null)
    return false;

  if(nums == -1)
    return true;

  for(let i = 0; i < nums.length; i++){
    if(nums[i]<min || nums[i]>max)
      return false;
  }

  return true;
}
791939
public static function encode($num)
    {
        $str = '';
        while ($num > 0) {
            $str = self::ALPHABET[($num % self::BASE)] . $str;
            $num = (int)($num / self::BASE);
        }
        return $str;
    }
1223322
public function iShouldSeeSelectChoices($field, $num)
    {
        $selector = sprintf('#select2-%s-results li', $field);

        $this->assertSession()->elementsCount('css', $selector, intval($num));
    }
817526
private function checkResponse($ch)
	{
		$this->responseInfo = curl_getinfo($ch);

		if (curl_errno($ch)) {
			throw new Net_Http_NetworkError(curl_error($ch), curl_errno($ch));
		}
		if ($this->failOnError) {
			$status = $this->getStatus();
			if ($status >= 400 && $status <= 499) {
				throw new Net_Http_ClientError($this->getStatusMessage(), $status, $this->getResponse());
			} elseif ($status >= 500 && $status <= 599) {
				throw new Net_Http_ServerError($this->getStatusMessage(), $status, $this->getResponse());
			}
		}
		if ($this->followLocation) {
			$this->followRedirectPath();
		}
	}
301744
protected function validateNumericCodeCurrency()
    {
        $field = 'numeric_code';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('Numeric code');

        if (empty($value)) {
            $this->setErrorRequired($field, $label);
            return false;
        }

        if (preg_match('/^[0-9]{3}$/', $value) !== 1) {
            $this->setErrorInvalid($field, $label);
            return false;
        }

        $updating = $this->getUpdating();

        if (isset($updating['numeric_code']) && $updating['numeric_code'] == $value) {
            return true;
        }

        foreach ($this->currency->getList() as $currency) {
            if ($currency['numeric_code'] == $value) {
                $this->setErrorExists($field, $label);
                return false;
            }
        }

        return true;
    }
1018323
public function dontSeeResponseCodeIs($code)
    {
        $failureMessage = sprintf(
            'Expected HTTP status code other than %s',
            HttpCode::getDescription($code)
        );
        $this->assertNotEquals($code, $this->getResponseStatusCode(), $failureMessage);
    }
1270119
def check_response(response)
      if response.code == 200
        JSON.parse(response.body)['data']
      else
        'NOK: error code = ' + response.code.to_s
      end
    end
1244259
private void checkResponseCode(String message) throws ResponseException {

        if (this.responseCode != 200 && this.responseCode != 204) {

            HashMap<Integer, String> responseCodes = new HashMap<Integer, String>() {{
                put(206, "PartialContent");
                put(400, "Bad request");
                put(401, "Unauthorized");
                put(403, "Prohibition to use the method");
                put(404, "Not found");
                put(405, "Method not allowed");
                put(413, "Request entity too large");
                put(422, "Unprocessable entity");
                put(500, "Internal server error");
                put(501, "Not implemented");
            }};

            ResponseException responseException = new ResponseException(message);
            responseException.setResponseHttpCode(this.responseCode);

            if (responseCodes.containsKey(this.responseCode)) {
                responseException.setResponseHttpDescription(responseCodes.get(this.responseCode));
            } else {
                responseException.setResponseHttpDescription("Unknown response error");
            }

            if (message != null) {
                JsonObject error = new JsonParser().parse(message).getAsJsonObject();
                for (Entry<String, JsonElement> entry : error.entrySet()) {

                    switch (entry.getKey().toLowerCase()) {
                        case "message":
                            responseException.setApiMessage(entry.getValue().getAsString());
                            break;
                        case "type":
                            responseException.setType(entry.getValue().getAsString());
                            break;
                        case "id":
                            responseException.setId(entry.getValue().getAsString());
                            break;
                        case "date":
                            responseException.setDate((int) entry.getValue().getAsDouble());
                            break;
                        case "errors":
                            if (entry.getValue() == null) break;

                            if (entry.getValue().isJsonNull()) break;

                            for (Entry<String, JsonElement> errorEntry : entry.getValue().getAsJsonObject().entrySet()) {
                                if (!responseException.getErrors().containsKey(errorEntry.getKey()))
                                    responseException.getErrors().put(errorEntry.getKey(), errorEntry.getValue().getAsString());
                                else {
                                    String description = responseException.getErrors().get(errorEntry.getKey());
                                    description = " | " + errorEntry.getValue().getAsString();

                                    responseException.getErrors().put(errorEntry.getKey(), description);
                                }
                            }
                            break;
                    }
                }
            }

            throw responseException;
        }
    }
1264437
private function page($num)
    {
        if ($num == 1) {
            return $this->page->url('delete', $this->url, $this->get);
        }

        return $this->page->url('add', $this->url, $this->get, $num.'of'.$this->total);
    }