Checks/fixes so the artNo input is valid.

@param int|string &$artNo Article number.

@throws KlarnaException
@return void
173154
private function _checkArtNo(&$artNo)
    {
        if (is_numeric($artNo) && !is_string($artNo)) {
            //Convert artNo to string if integer.
            $artNo = strval($artNo);
        }
        if (!isset($artNo) || strlen($artNo) == 0 || (!is_string($artNo))) {
            throw new Klarna_ArgumentNotSetException("artNo");
        }
    }
1121398
private function _checkInt(&$int, $field)
    {
        if (!isset($int)) {
            throw new Klarna_ArgumentNotSetException($field);
        }
        if (is_numeric($int) && !is_int($int)) {
            $int = intval($int);
        }
        if (!is_numeric($int) || !is_int($int)) {
            throw new Klarna_InvalidTypeException($field, "integer");
        }
    }
558536
public function register($assets, $type, $position, $order = 0, $mode = 'default')
    {
        if (! in_array($type, $this->types)) {
            throw new InvalidArgumentException("Invalid assets type [${type}]");
        } else if (! in_array($mode, array('default', 'inline', 'view'))) {
            throw new InvalidArgumentException("Invalid assets mode [${mode}]");
        }

        // The assets type and mode are valid.
        else if (! empty($items = $this->parseAssets($assets, $order, $mode))) {
            // We will merge the items for the specified type and position.

            Arr::set($this->positions, $key = "${type}.${position}", array_merge(
                Arr::get($this->positions, $key, array()), $items
            ));
        }
    }
600721
private function _checkQty(&$qty)
    {
        if (!isset($qty)) {
            throw new Klarna_ArgumentNotSetException("Quantity");
        }
        if (is_numeric($qty) && !is_int($qty)) {
            $qty = intval($qty);
        }
        if (!is_int($qty)) {
            throw new Klarna_InvalidTypeException("Quantity", "integer");
        }
    }
143078
private function _checkRef(&$reference, &$refCode)
    {
        if (!is_string($reference)) {
            $reference = strval($reference);
            if (!is_string($reference)) {
                throw new Klarna_InvalidTypeException("Reference", "string");
            }
        }

        if (!is_string($refCode)) {
            $refCode = strval($refCode);
            if (!is_string($refCode)) {
                throw new Klarna_InvalidTypeException("Reference code", "string");
            }
        }
    }
72415
protected function checkValue(): void
    {
        if (!ctype_digit($this->value) && !is_numeric($this->value) && !empty($this->value)) {
            throw new InvalidArgumentException('NumericParser: Value must be of type numeric');
        }
    }
398594
public function validatePlugin($plugin)
    {
        if (!$plugin instanceof ModelInterface) {
            throw new Exception\InvalidPluginException(sprintf(
                'Model of type %s is invalid; must implement "%s"',
                (is_object($plugin) ? get_class($plugin) : gettype($plugin)),
                ModelInterface::class
            ));
        }
    }
1311388
private static function checkAutocommit(\PDO $pdo): void
    {
        $vendor = $pdo->getAttribute(\PDO::ATTR_DRIVER_NAME);
        
        // MySQL turns autocommit off during a transaction.
        if ($vendor == "mysql") {
            return;
        }

        try {
            if ($pdo->getAttribute(\PDO::ATTR_AUTOCOMMIT)) {
                throw new \InvalidArgumentException("PDO::ATTR_AUTOCOMMIT should be disabled.");
            }
        } catch (\PDOException $e) {
            /*
             * Ignore this, as some drivers would throw an exception for an
             * unsupported attribute (e.g. Postgres).
             */
        }
    }
339935
public function validate($addCartItemCommand, Constraint $constraint): void
    {
        Assert::isInstanceOf($addCartItemCommand, AddToCartCommandInterface::class);
        Assert::isInstanceOf($constraint, CartItemAvailability::class);

        /** @var OrderItemInterface $cartItem */
        $cartItem = $addCartItemCommand->getCartItem();

        $isStockSufficient = $this->availabilityChecker->isStockSufficient(
            $cartItem->getVariant(),
            $cartItem->getQuantity() + $this->getExistingCartItemQuantityFromCart($addCartItemCommand->getCart(), $cartItem)
        );

        if (!$isStockSufficient) {
            $this->context->addViolation(
                $constraint->message,
                ['%itemName%' => $cartItem->getVariant()->getInventoryName()]
            );
        }
    }
1150935
public function apply(AbstractNode $node): void
    {
        if (!$this->isPlugin($node)) {
            return;
        }

        $className = $node->getName();

        if (!$this->isSuffixValid($className)) {
            $this->addViolation($node, [$node->getName()]);
        }
    }
961564
protected function validateHeaderName($headerName) : void
	{
		if (! \is_string($headerName))
		{
			throw new \InvalidArgumentException('Header name must be a string');
		}
		else if (! \preg_match(HeaderInterface::RFC7230_TOKEN, $headerName))
		{
			throw new \InvalidArgumentException(\sprintf('The given header name "%s" is not valid', $headerName));
		}
	}
1213807
public function validate($checkCurrentVersion = true)
    {
        if (null === $this->moduleDescriptor) {
            throw new \Exception(
                $this->trans(
                    "The %name module definition has not been initialized.",
                    [ '%name' => $this->moduleDirName ]
                )
            );
        }

        $this->checkVersion();

        if (true === $checkCurrentVersion) {
            $this->checkModuleVersion();
        }

        $this->checkModuleDependencies();
    }
603430
public function validate(string $key, array $scope = [], array $input = []): void
    {
        $value = $key == '*' ? '*' : $scope[$key] ?? null;

        ($this->validate)($value, $key, $scope, $input);
    }
1148817
public function shouldIgnoreError($errno)
    {
        if ($this->useErrorReporting && ($errno & error_reporting()) === 0) {
            // ignore due to error_reporting level
            $this->verboseLogger()->debug("Ignore (error below allowed error_reporting level)");
            return true;
        }

        if ($this->includedErrno != -1 && ($errno & $this->includedErrno) != $errno) {
            // ignore
            $this->verboseLogger()->debug("Ignore due to included_errno level");
            return true;
        }

        if (isset($this->errorSampleRates[$errno])) {
            // get a float in the range [0, 1)
            // mt_rand() is inclusive, so add 1 to mt_randmax
            $float_rand = mt_rand() / ($this->mtRandmax + 1);
            if ($float_rand > $this->errorSampleRates[$errno]) {
                // skip
                $this->verboseLogger()->debug("Skip due to error sample rating");
                return true;
            }
        }
        
        return false;
    }
1188765
public static function i18n(string $i18n): bool
    {
        if (in_array($i18n, self::$__i18nLists)) {
            self::$__i18n = $i18n;
            return true;
        }
        return false;
    }
5902
public function updateErrorBox($form, $result, $errors)
    {
        if (($form->isSubmitted() && $result !== true) || count($errors) > 0) {
            if (is_string($result)) {
                $this->addError(new Error(
                    Error::GENERAL_ERROR,
                    $result
                ));
            } else if (count($errors) > 0) {
                foreach ($errors as $error) {
                    $this->addError($error);
                }
            } else {
                $this->addError(new Error(
                    Error::UNKNOWN_ERROR,
                    ''
                ));
            }
        }
    }
61057
public function addArticle($article)
    {
        if (!$this->articles->contains($article)) {
            $this->articles->add($article);
        }
    }