|
8 | 8 | use Lkrms\Contract\IService; |
9 | 9 | use Lkrms\Support\Catalog\RegularExpression as Regex; |
10 | 10 | use Lkrms\Support\Pipeline; |
| 11 | +use Lkrms\Sync\Catalog\SyncOperation as OP; |
11 | 12 | use Lkrms\Sync\Contract\ISyncContext; |
12 | 13 | use Lkrms\Sync\Contract\ISyncEntity; |
13 | 14 | use Lkrms\Sync\Contract\ISyncProvider; |
@@ -191,20 +192,46 @@ protected function run(ISyncContext $context, callable $operation) |
191 | 192 | } |
192 | 193 |
|
193 | 194 | /** |
194 | | - * Get a new pipeline bound to the provider's container |
| 195 | + * Get a new pipeline for mapping provider data to entities |
195 | 196 | * |
| 197 | + * @template T of ISyncEntity |
| 198 | + * @param class-string<T> $entity |
| 199 | + * @return IPipeline<mixed[],T,array{0:OP::*,1:ISyncContext,2?:int|string|T|T[]|null,...}> |
| 200 | + */ |
| 201 | + protected function pipelineFrom(string $entity): IPipeline |
| 202 | + { |
| 203 | + return Pipeline::create($this->App); |
| 204 | + } |
| 205 | + |
| 206 | + /** |
| 207 | + * Get a new pipeline for mapping entities to provider data |
| 208 | + * |
| 209 | + * @template T of ISyncEntity |
| 210 | + * @param class-string<T> $entity |
| 211 | + * @return IPipeline<T,mixed[],array{0:OP::*,1:ISyncContext,2?:int|string|T|T[]|null,...}> |
| 212 | + */ |
| 213 | + protected function pipelineTo(string $entity): IPipeline |
| 214 | + { |
| 215 | + return Pipeline::create($this->App); |
| 216 | + } |
| 217 | + |
| 218 | + /** |
196 | 219 | * @return IPipeline<mixed,mixed,mixed> |
| 220 | + * @deprecated Use {@see SyncProvider::pipelineFrom()} or |
| 221 | + * {@see SyncProvider::pipelineTo()} instead |
| 222 | + * @codeCoverageIgnore |
197 | 223 | */ |
198 | 224 | protected function pipeline(): IPipeline |
199 | 225 | { |
200 | 226 | return Pipeline::create($this->App); |
201 | 227 | } |
202 | 228 |
|
203 | 229 | /** |
204 | | - * Wrap a new pipeline around a callback |
205 | | - * |
206 | 230 | * @param (callable(mixed $payload, IPipeline<mixed,mixed,mixed> $pipeline, mixed $arg): mixed) $callback |
207 | 231 | * @return IPipeline<mixed,mixed,mixed> |
| 232 | + * @deprecated Use {@see SyncProvider::pipelineFrom()} or |
| 233 | + * {@see SyncProvider::pipelineTo()} instead |
| 234 | + * @codeCoverageIgnore |
208 | 235 | */ |
209 | 236 | protected function callbackPipeline(callable $callback): IPipeline |
210 | 237 | { |
|
0 commit comments