Actions
2 years ago
Commands
2 years ago
Concerns
2 years ago
Contracts
2 years ago
Controllers
2 years ago
DataTransferObjects
2 years ago
Steps
1 year ago
FormMetaDecorator.php
1 year ago
Pipeline.php
2 years ago
ServiceProvider.php
1 year ago
StepProcessor.php
2 years ago
functions.php
2 years ago
StepProcessor.php
32 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\FormMigration; |
| 4 | |
| 5 | use Give\FormMigration\Contracts\FormMigrationStep; |
| 6 | use Give\FormMigration\DataTransferObjects\FormMigrationPayload; |
| 7 | |
| 8 | class StepProcessor |
| 9 | { |
| 10 | /** |
| 11 | * @var FormMigrationPayload |
| 12 | */ |
| 13 | protected $payload; |
| 14 | |
| 15 | public function __construct(FormMigrationPayload $payload) |
| 16 | { |
| 17 | $this->payload = $payload; |
| 18 | } |
| 19 | |
| 20 | public function __invoke(FormMigrationStep $step) |
| 21 | { |
| 22 | if($step->canHandle()) { |
| 23 | $step->process(); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | public function finally(callable $callback) |
| 28 | { |
| 29 | $callback($this->payload); |
| 30 | } |
| 31 | } |
| 32 |