1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
durationcountbased.php
См. документацию.
1<?php
8namespace Bitrix\Sender\Dispatch;
9
10use Bitrix\Main\Localization\Loc;
11
12use Bitrix\Sender\Message;
13use Bitrix\Sender\Transport;
14
15Loc::loadMessages(__FILE__);
16
22{
24 private $message;
25
27 private $count;
28
36 public static function create(Message\Adapter $message)
37 {
38 return new static($message);
39 }
40
46 public function __construct(Message\Adapter $message)
47 {
48 $this->message = $message;
49 }
50
57 public function getInterval($count)
58 {
59 if (!$count)
60 {
61 return 0;
62 }
63
64 $this->count = $count;
66 $limiter = current($this->getLimiters());
67 if (!$limiter)
68 {
69 return 0;
70 }
71
72 $limit = $limiter->getLimit();
73 if (!$limit)
74 {
75 return 0;
76 }
77
78 $timeouts = $this->getLimitTimeouts($limiter);
79 $unit = $this->getLimitUnit($limiter);
80
81 if ($timeouts)
82 {
83 $count = $this->count % ($limit * $timeouts);
84 }
85 else
86 {
87 $count = $this->count;
88 }
89
90 return ($timeouts * $unit) + ($count * $this->message->getSendDuration());
91 }
92
99 public function getIntervalDefault($count)
100 {
101 $interval = $this->getInterval($count);
102 if ($interval)
103 {
104 return $interval;
105 }
106
107 return ceil(0.01 * $count);
108 }
109
110 protected function getLimitUnit(Transport\iLimiter $limiter)
111 {
112 return Transport\CountLimiter::getUnitInterval($limiter->getUnit());
113 }
114
115 protected function getLimitTimeouts(Transport\iLimiter $limiter)
116 {
117 $count = $this->count;
118 $limit = $limiter->getLimit();
119 $count -= $limit - $limiter->getCurrent();
120 if (!$count || !$limit)
121 {
122 return 0;
123 }
124
125 return intval($count / $limit);
126 }
127
128 protected function getLimiters()
129 {
130 $transport = $this->message->getTransport();
131 if (!$transport)
132 {
133 return array();
134 }
135
136 return $transport->getLimiters($this->message);
137 }
138}
$count
Определения admin_tab.php:4
static create(Message\Adapter $message)
Определения durationcountbased.php:36
getLimitUnit(Transport\iLimiter $limiter)
Определения durationcountbased.php:110
getLimitTimeouts(Transport\iLimiter $limiter)
Определения durationcountbased.php:115
__construct(Message\Adapter $message)
Определения durationcountbased.php:46
static getUnitInterval($unit)
Определения countlimiter.php:78
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
Определения adapter.php:9
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936