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/ilovecveti.ru/bitrix/modules/vote/lib/Model/Dto/ |
Upload File : |
<?php namespace Bitrix\Vote\Model\Dto; use Bitrix\Main\ObjectNotFoundException; use Bitrix\Main\Security\Sign\BadSignatureException; use Bitrix\Vote\Attach; use Bitrix\Vote\Attachment\Manager; use Bitrix\Vote\Service\AttachedVoteResultUrlService; use Bitrix\Vote\Service\AttachedVoteSigner; class AttachedVotePayload { public function __construct( public readonly ?Attach $attach, public readonly bool $readAccessThroughSignedParam = false, ) {} public static function makeByAttachId(int $attachId): AttachedVotePayload { try { $attach = new Attach($attachId); } catch (ObjectNotFoundException) { $attach = null; } return new AttachedVotePayload($attach); } public static function makeByEntityId( string $moduleId, string $entityType, int $entityId ): AttachedVotePayload { return new AttachedVotePayload(Manager::loadFirstFromEntity($moduleId, $entityType, $entityId)); } public static function makeBySignedAttachId(string $signedAttachId): AttachedVotePayload { try { $attach = (new AttachedVoteResultUrlService())->getAttachByUrlId($signedAttachId); } catch (ObjectNotFoundException|BadSignatureException) { $attach = null; } return new AttachedVotePayload($attach, true); } }