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/catalog/lib/v2/Sku/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/catalog/lib/v2/Sku/SkuFactory.php
<?php

namespace Bitrix\Catalog\v2\Sku;

use Bitrix\Catalog\v2\BaseIblockElementEntity;
use Bitrix\Catalog\v2\BaseIblockElementFactory;
use Bitrix\Catalog\v2\IoC\Dependency;
use Bitrix\Main\NotSupportedException;

/**
 * Class SkuFactory
 *
 * @package Bitrix\Catalog\v2\Sku
 *
 * !!! This API is in alpha stage and is not stable. This is subject to change at any time without notice.
 * @internal
 */
class SkuFactory extends BaseIblockElementFactory
{
	public const SIMPLE_SKU = SimpleSku::class;
	public const SKU = Sku::class;
	public const SKU_COLLECTION = SkuCollection::class;

	/**
	 * @param string|null $entityClass
	 * @return \Bitrix\Catalog\v2\Sku\BaseSku
	 * @throws \Bitrix\Main\NotSupportedException
	 */
	public function createEntity(string $entityClass = null): BaseIblockElementEntity
	{
		if ($entityClass === null)
		{
			$entityClass = $this->iblockInfo->canHaveSku() ? self::SKU : self::SIMPLE_SKU;
		}

		if ($entityClass === self::SKU && !$this->iblockInfo->canHaveSku())
		{
			throw new NotSupportedException(sprintf(
				'Product catalog {%s} does not support {%s} type.',
				$this->iblockInfo->getProductIblockId(), $entityClass
			));
		}

		if (!is_subclass_of($entityClass, BaseSku::class))
		{
			throw new NotSupportedException(sprintf(
				'Entity with type {%s} must be an instance of {%s}.',
				$entityClass, BaseSku::class
			));
		}

		return $this->makeEntity($entityClass);
	}

	/**
	 * @return \Bitrix\Catalog\v2\Sku\SkuCollection
	 */
	public function createCollection(): SkuCollection
	{
		return $this->container->make(self::SKU_COLLECTION, [
			Dependency::IBLOCK_INFO => $this->iblockInfo,
		]);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit