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/rest/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

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

namespace Bitrix\Sale\Rest;

use Bitrix\Main\Engine\Action;
use Bitrix\Main\Engine\Controller;
use Bitrix\Rest\RestException;

class ModificationFieldsBase
{
	const TO_WHITE_LIST = 'TO_WHITE_LIST';
	const TO_CAMEL = 'TO_CAMEL';
	const TO_SNAKE = 'TO_SNAKE';
	const SORTING_KEYS = 'SORTING_KEYS';
	const CHECK_REQUIRED = 'CHECK_REQUIRED';

	protected string $name;
	protected array $arguments;
	protected Controller $controller;
	protected $format;
	protected $data;
	protected $scope;

	static public function buildByAction(Action $action, $data=[], $scope='')
	{
		return new static($action->getName(), $action->getArguments(), $action->getController(), $data, $scope);
	}

	public function __construct($name, $arguments,  $controller, $data=[], $scope='')
	{
		$this->name = $name;
		$this->arguments = $arguments;
		$this->controller = $controller;

		$this->data = $data;
		$this->scope = $scope;
	}

	public function getName()
	{
		return $this->name;
	}

	public function getArguments()
	{
		return $this->arguments;
	}

	public function setArguments($arguments)
	{
		$this->arguments = $arguments;
	}

	/**
	 * @param mixed $format
	 */
	public function setFormat($format): void
	{
		$this->format = $format;
	}

	public function getController()
	{
		return $this->controller;
	}

	public function getScope()
	{
		return $this->scope;
	}

	public function getData()
	{
		return $this->data;
	}

	/**
	 * @param Controller $controller
	 * @return Entity\BasketItem|Entity\Order|Entity\Payment|Entity\PersonType|Entity\Property|Entity\PropertyGroup|null
	 * @throws RestException
	 */
	protected function getEntity(Controller $controller)
	{
		$entity = null;
		if($controller instanceof \Bitrix\Sale\Controller\Order)
		{
			$entity = new \Bitrix\Sale\Rest\Entity\Order();
		}
		elseif ($controller instanceof \Bitrix\Sale\Controller\BasketItem)
		{
			$entity = new \Bitrix\Sale\Rest\Entity\BasketItem();
		}
		elseif ($controller instanceof \Bitrix\Sale\Controller\BasketProperties)
		{
			$entity = new \Bitrix\Sale\Rest\Entity\BasketProperties();
		}
		elseif ($controller instanceof \Bitrix\Sale\Controller\Payment)
		{
			$entity = new \Bitrix\Sale\Rest\Entity\Payment();
		}
		elseif ($controller instanceof \Bitrix\Sale\Controller\Property)
		{
			$entity = new \Bitrix\Sale\Rest\Entity\Property();
		}
		elseif ($controller instanceof \Bitrix\Sale\Controller\Shipment)
		{
			$entity = new \Bitrix\Sale\Rest\Entity\Shipment();
		}
		elseif ($controller instanceof \Bitrix\Sale\Controller\ShipmentItem)
		{
			$entity = new \Bitrix\Sale\Rest\Entity\ShipmentItem();
		}
		else
		{
			throw new RestException('Unknown object ' . get_class($controller));
		}

		return $entity;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit