403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/sale/lib/basket/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/sale/lib/basket/storage.php
<?php

namespace Bitrix\Sale\Basket;

use Bitrix\Sale;
use Bitrix\Main;

class Storage
{
	/** @var array $instance */
	private static $instance = array();
	/** @var Sale\Basket $basket */
	protected $basket;
	/** @var Sale\Basket $orderableBasket */
	protected $orderableBasket;

	private $fUserId;
	private $siteId;

	private function __construct($fUserId, $siteId)
	{
		$this->fUserId = $fUserId;
		$this->siteId = $siteId;
	}

	private function __clone()
	{
	}

	protected static function getHash($fUserId, $siteId)
	{
		return "{$fUserId}_{$siteId}";
	}

	protected function getFUserId()
	{
		return $this->fUserId;
	}

	protected function getSiteId()
	{
		return $this->siteId;
	}

	public static function getInstance($fUserId, $siteId)
	{
		if (empty($fUserId))
		{
			throw new Main\ArgumentNullException('fUserId');
		}

		if (empty($siteId))
		{
			throw new Main\ArgumentNullException('siteId');
		}

		$hash = static::getHash($fUserId, $siteId);

		if (!isset(static::$instance[$hash]))
		{
			static::$instance[$hash] = new static($fUserId, $siteId);
		}

		return static::$instance[$hash];
	}

	public function getBasket()
	{
		if (!isset($this->basket))
		{
			$registry = Sale\Registry::getInstance(Sale\Registry::REGISTRY_TYPE_ORDER);

			/** @var Sale\Basket $basketClassName */
			$basketClassName = $registry->getBasketClassName();

			$this->basket = $basketClassName::loadItemsForFUser($this->getFUserId(), $this->getSiteId());
		}

		return $this->basket;
	}

	public function getOrderableBasket()
	{
		if (!isset($this->orderableBasket))
		{
			/** @var Sale\Basket $basketClone */
			$basketClone = $this->getBasket()->createClone();
			$this->orderableBasket = $basketClone->getOrderableItems();
		}

		return $this->orderableBasket;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit