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/yandex.market/lib/ui/userfield/helper/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/yandex.market/lib/ui/userfield/helper/value.php
<?php

namespace Yandex\Market\Ui\UserField\Helper;

class Value
{
	public static function asSingle($userField, $htmlControl)
	{
		$value = static::extractFromField($userField, $htmlControl);

		return static::isSingle($value) ? $value : null;
	}

	public static function asMultiple($userField, $htmlControl)
	{
		$value = static::extractFromField($userField, $htmlControl);

		if (static::isMultiple($value))
		{
			$result = $value;
		}
		else if (static::isSingle($value) && !static::isEmpty($value))
		{
			$result = [ $value ];
		}
		else
		{
			$result = [];
		}

		return $result;
	}

	protected static function isSingle($value)
	{
		return !is_array($value);
	}

	protected static function isMultiple($value)
	{
		return is_array($value);
	}

	protected static function isEmpty($value)
	{
		return !is_scalar($value) || (string)$value === '';
	}

	protected static function extractFromField($userField, $htmlControl)
	{
		if (isset($userField['VALUE']))
		{
			$result = $userField['VALUE'];
		}
		else if (isset($htmlControl['VALUE']) && ($htmlControl['VALUE'] !== '' || !array_key_exists('VALUE', $userField)))
		{
			$result = $htmlControl['VALUE'];
		}
		else if ($userField['ENTITY_VALUE_ID'] < 1 && !empty($userField['SETTINGS']['DEFAULT_VALUE']))
		{
			$result = $userField['SETTINGS']['DEFAULT_VALUE'];
		}
		else
		{
			$result = null;
		}

		return $result;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit