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/cvetdv.ru/bitrix/modules/yandex.market/lib/data/run/ |
Upload File : |
<?php namespace Yandex\Market\Data\Run; class Waterfall { /** @var callable[] */ private $stages = []; private $index = 0; private $nextArguments; public function add(callable $stage) { $this->stages[] = $stage; return $this; } public function __invoke(Waterfall $waterfall, ...$arguments) { $this->next(...$arguments); if ($this->nextArguments !== null) { $waterfall->next(...$this->nextArguments); } else { $waterfall->next(); } } public function run(...$arguments) { $this->index = 0; $this->next(...$arguments); } public function next(...$arguments) { if (!isset($this->stages[$this->index])) { $this->nextArguments = $arguments; return; } $stage = $this->stages[$this->index]; ++$this->index; /** @noinspection VariableFunctionsUsageInspection */ call_user_func($stage, $this, ...$arguments); --$this->index; } }