![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mets-rebuild.corals.io/wp-content/plugins/give/src/FormMigration/ |
<?php namespace Give\FormMigration; use Give\FormMigration\Contracts\FormMigrationStep; use Give\FormMigration\DataTransferObjects\FormMigrationPayload; class Pipeline { protected $steps = []; protected $payload; protected $beforeStep; protected $afterStep; public function __construct(array $steps) { $this->steps = $steps; } public function beforeEach(callable $beforeStep): Pipeline { $this->beforeStep = $beforeStep; return $this; } public function afterEach(callable $afterStep): Pipeline { $this->afterStep = $afterStep; return $this; } public function process(FormMigrationPayload $payload): StepProcessor { $processor = new StepProcessor($payload); foreach ($this->steps as $stepClass) { if ($this->beforeStep) call_user_func($this->beforeStep, $stepClass, $payload); $_payload = unserialize(serialize($payload)); $processor(new $stepClass($payload)); if ($this->afterStep) call_user_func($this->afterStep, $stepClass, $payload, $_payload); } return $processor; } }