Sets the code of the warehouse item.

@param string $code New code of the warehouse item
322433
public function setCode( $code )
	{
		$this->_checkCode( $code );

		$this->_values['code'] = (string) $code;
		$this->setModified();
	}
8847
public function setStatusCode($code = null)
    {
        if (!empty($code)) {
            $this->_statusCode = $code;
            http_response_code($this->_statusCode); // this sends the http status code
        }
    }
1179160
function setCode( $code ) {
        $this->code = $code;
        $this->addHeader($this->getDefaultHeaderFromCode( $code ));
        return $this;
    }
253035
protected function setLanguage($code)
    {
        $this->data_language = array();

        if (!empty($code)) {

            $this->data_language = $this->language->get($code);

            if (empty($this->data_language)) {
                $this->outputHttpStatus(404);
            }
        }
    }
175969
public function setStatusCode($code)
	{
		if (!array_key_exists($code, self::$statusCodeMap)) {
			throw new InvalidArgumentException(sprintf('The HTTP stauts code %s is unknown.', $code));
		}

		$this->statusCode = $code;

		return $this;
	}
1225894
public static function setStatus($code) {

		if(false === ('-' . intval($code) == '-' . $code)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($code)), E_USER_ERROR);
		}

		$protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0';

		switch($code) {

			case 100 : header($protocol . ' 100 Continue'); break;
			case 101 : header($protocol . ' 101 Switching Protocols'); break;
			case 102 : header($protocol . ' 102 Processing'); break;
			case 200 : header($protocol . ' 200 OK'); break;
			case 201 : header($protocol . ' 201 Created'); break;
			case 202 : header($protocol . ' 202 Accepted'); break;
			case 203 : header($protocol . ' 203 Non-Authoritative Information'); break;
			case 204 : header($protocol . ' 204 No Content'); break;
			case 205 : header($protocol . ' 205 Reset Content'); break;
			case 206 : header($protocol . ' 206 Partial Content'); break;
			case 207 : header($protocol . ' 207 Multi-Status'); break;
			case 208 : header($protocol . ' 208 Already Reported'); break;
			case 226 : header($protocol . ' 226 IM Used'); break;
			case 300 : header($protocol . ' 300 Multiple Choices'); break;
			case 301 : header($protocol . ' 301 Moved Permanently'); break;
			case 302 : header($protocol . ' 302 Found'); break;
			case 303 : header($protocol . ' 303 See Other'); break;
			case 304 : header($protocol . ' 304 Not Modified'); break;
			case 305 : header($protocol . ' 305 Use Proxy'); break;
			case 306 : header($protocol . ' 306 Switch Proxy'); break;
			case 307 : header($protocol . ' 307 Temporary Redirect'); break;
			case 308 : header($protocol . ' 308 Permanent Redirect'); break;
			case 400 : header($protocol . ' 400 Bad Request'); break;
			case 401 : header($protocol . ' 401 Unauthorized'); break;
			case 402 : header($protocol . ' 402 Payment Required'); break;
			case 403 : header($protocol . ' 403 Forbidden'); break;
			case 404 : header($protocol . ' 404 Not Found'); break;
			case 405 : header($protocol . ' 405 Method Not Allowed'); break;
			case 406 : header($protocol . ' 406 Not Acceptable'); break;
			case 407 : header($protocol . ' 407 Proxy Authentication Required'); break;
			case 408 : header($protocol . ' 408 Request Timeout'); break;
			case 409 : header($protocol . ' 409 Conflict'); break;
			case 410 : header($protocol . ' 410 Gone'); break;
			case 411 : header($protocol . ' 411 Length Required'); break;
			case 412 : header($protocol . ' 412 Precondition Failed'); break;
			case 413 : header($protocol . ' 413 Payload Too Large'); break;
			case 414 : header($protocol . ' 414 Request-URI Too Long'); break;
			case 415 : header($protocol . ' 415 Unsupported Media Type'); break;
			case 416 : header($protocol . ' 416 Requested Range Not Satisfiable'); break;
			case 417 : header($protocol . ' 417 Expectation Failed'); break;
			case 418 : header($protocol . ' 418 I\'m a teapot'); break;
			case 419 : header($protocol . ' 419 Authentication Timeout'); break;
			case 420 : header($protocol . ' 420 Method Failure'); break;
			case 421 : header($protocol . ' 421 Misdirected Request'); break;
			case 422 : header($protocol . ' 422 Unprocessable Entity'); break;
			case 423 : header($protocol . ' 423 Locked'); break;
			case 424 : header($protocol . ' 424 Failed Dependency'); break;
			case 426 : header($protocol . ' 426 Upgrade Required'); break;
			case 428 : header($protocol . ' 428 Precondition Required'); break;
			case 429 : header($protocol . ' 429 Too Many Requests'); break;
			case 431 : header($protocol . ' 431 Request Header Fields Too Large'); break;
			case 440 : header($protocol . ' 440 Login Timeout '); break;
			case 444 : header($protocol . ' 444 No Response'); break;
			case 449 : header($protocol . ' 449 Retry With'); break;
			case 450 : header($protocol . ' 450 Blocked by Windows Parental Controls'); break;
			case 451 : header($protocol . ' 451 Unavailable For Legal Reasons'); break;
			case 494 : header($protocol . ' 494 Request Header Too Large'); break;
			case 495 : header($protocol . ' 495 Cert Error'); break;
			case 496 : header($protocol . ' 496 No Cert'); break;
			case 497 : header($protocol . ' 497 HTTP to HTTPS'); break;
			case 498 : header($protocol . ' 498 Token expired/invalid'); break;
			case 499 : header($protocol . ' 499 Client Closed Request'); break;
			case 500 : header($protocol . ' 500 Internal Server Error'); break;
			case 501 : header($protocol . ' 501 Not Implemented'); break;
			case 502 : header($protocol . ' 502 Bad Gateway'); break;
			case 503 : header($protocol . ' 503 Service Unavailable'); break;
			case 504 : header($protocol . ' 504 Gateway Timeout'); break;
			case 505 : header($protocol . ' 505 HTTP Version Not Supported'); break;
			case 506 : header($protocol . ' 506 Variant Also Negotiates'); break;
			case 507 : header($protocol . ' 507 Insufficient Storage'); break;
			case 508 : header($protocol . ' 508 Loop Detected'); break;
			case 509 : header($protocol . ' 509 Bandwidth Limit Exceeded'); break;
			case 510 : header($protocol . ' 510 Not Extended'); break;
			case 511 : header($protocol . ' 511 Network Authentication Required'); break;
			case 520 : header($protocol . ' 520 Unknown Error'); break;
			case 522 : header($protocol . ' 522 Origin Connection Time-out'); break;
			case 598 : header($protocol . ' 598 Network read timeout error'); break;
			case 599 : header($protocol . ' 599 Network connect timeout error'); break;
		}
	}
1206377
public function setError($code, $description)
    {
        $error = new stdClass;
        $error->code = $code;
        $error->description = $description;

        $this->errors[] = $error;
    }
985060
public function setStatus(int $code): Response
    {
        # `Status::getText` will throw an exception for invalid status codes
        $this->statusText = Status::getText($code);
        $this->statusCode = $code;
        return $this;
    }
844068
private function setStatusHeader($code = 200)
    {
        if (empty(self::$codes[$code])) {
            $code = 200;
        }

        if (!empty($this->response)) {
            $this->response->status($code);
        }

        return $this;
    }
425835
protected function setCurrency($code)
    {
        $this->data_currency = array();

        if (!empty($code)) {
            $this->data_currency = $this->currency->get($code);
            if (empty($this->data_currency)) {
                $this->outputHttpStatus(404);
            }
        }
    }
1229734
public function setOpcode($opcode)
    {
        if (!self::validateOpcode($opcode)) {
            throw new InvalidArgumentException("Invalid opcode");
        }

        $this->firstFrameByte = $this->firstFrameByte & 240;
        $this->firstFrameByte |= $opcode;
    }
736346
protected function setCountry($code)
    {
        $this->data_country = $this->country->get($code);

        if (empty($this->data_country)) {
            $this->outputHttpStatus(404);
        }
    }
1225019
public function increase( $productCode, $warehouseCode, $amount )
	{
		$context = $this->_getContext();

		$productManager = MShop_Factory::createManager( $context, 'product' );
		$search = $productManager->createSearch();
		$search->setConditions( $search->compare( '==', 'product.code', $productCode ) );
		$productIds = array_keys( $productManager->searchItems( $search ) );

		$warehouseManager = $this->getSubManager( 'warehouse' );
		$search = $warehouseManager->createSearch();
		$search->setConditions( $search->compare( '==', 'product.stock.warehouse.code', $warehouseCode ) );
		$warehouseIds = array_keys( $warehouseManager->searchItems( $search ) );

		if( empty( $warehouseIds ) ) {
			throw new MShop_Product_Exception( sprintf( 'No warehouse for code "%1$s" found', $warehouseCode ) );
		}

		$search = $this->createSearch();
		$expr = array(
			$search->compare( '==', 'product.stock.siteid', $context->getLocale()->getSitePath() ),
			$search->compare( '==', 'product.stock.productid', $productIds ),
			$search->compare( '==', 'product.stock.warehouseid', $warehouseIds ),
		);
		$search->setConditions( $search->combine( '&&', $expr ) );

		$types = array(
			'product.stock.siteid' => $this->_searchConfig['product.stock.siteid']['internaltype'],
			'product.stock.productid' => $this->_searchConfig['product.stock.productid']['internaltype'],
			'product.stock.warehouseid' => $this->_searchConfig['product.stock.warehouseid']['internaltype'],
		);
		$translations = array(
			'product.stock.siteid' => '"siteid"',
			'product.stock.productid' => '"prodid"',
			'product.stock.warehouseid' => '"warehouseid"',
		);

		$conditions = $search->getConditionString( $types, $translations );

		$dbm = $context->getDatabaseManager();
		$dbname = $this->_getResourceName();
		$conn = $dbm->acquire( $dbname );

		try
		{
			/** mshop/product/manager/stock/default/item/stocklevel
			 * Increases or decreases the stock level for the given product and warehouse code
			 *
			 * The stock level is decreased for the ordered products each time
			 * an order is placed by a customer successfully. Also, updates
			 * from external sources like ERP systems can increase the stock
			 * level of a product if no absolute values are set via saveItem()
			 * instead.
			 *
			 * The stock level must be from one of the sites that are configured
			 * via the context item. If the current site is part of a tree of
			 * sites, the statement can increase or decrease stock levels from
			 * the current site and all parent sites if the stock level is
			 * inherited by one of the parent sites.
			 *
			 * Each time the stock level is updated, the modification time is
			 * set to the current timestamp and the editor field is updated.
			 *
			 * @param string SQL statement for increasing/decreasing the stock level
			 * @since 2014.03
			 * @category Developer
			 * @see mshop/product/manager/stock/default/item/insert
			 * @see mshop/product/manager/stock/default/item/update
			 * @see mshop/product/manager/stock/default/item/newid
			 * @see mshop/product/manager/stock/default/item/delete
			 * @see mshop/product/manager/stock/default/item/search
			 * @see mshop/product/manager/stock/default/item/count
			 */
			$path = 'mshop/product/manager/stock/default/item/stocklevel';
			$stmt = $conn->create( str_replace( ':cond', $conditions, $context->getConfig()->get( $path, $path ) ) );

			$stmt->bind( 1, $amount, MW_DB_Statement_Abstract::PARAM_INT );
			$stmt->bind( 2, date( 'Y-m-d H:i:s' ) ); //mtime
			$stmt->bind( 3, $context->getEditor() );

			$stmt->execute()->finish();

			$dbm->release( $conn, $dbname );
		}
		catch( Exception $e )
		{
			$dbm->release( $conn, $dbname );
			throw $e;
		}
	}
369149
public function delete($code) {
        $service = self::get($code);

        $deleteResult = Manager::delete($service->getId());
        if (!$deleteResult->isSuccess()) {
            $this->throwException(
                __METHOD__,
                'Error deleting delivery service [%s]: %s',
                $code,
                implode('; ', $deleteResult->getErrorMessages())
            );
        }
    }
1037979
public function setUninstalled($code)
    {
        $history = Parameter::get('system::theme.history', []);
        if (array_key_exists($code, $history)) {
            unset($history[$code]);
        }

        Parameter::set('system::theme.history', $history);
    }
600841
public function setStatusCode($code, $message)
  {
    $this->meta->statusCode = $code;
    $this->meta->statusMessage = $message;
  }
73390
public function setLanguage($code = null)
    {
        if (!isset($code)) {
            $code = $this->config->get('cli_langcode', '');
        }

        $this->langcode = $code;
        $this->translation->set($code, null);

        return $this;
    }