@@ -47,8 +47,7 @@ |
||
| 47 | 47 | * @class EtlTool |
| 48 | 48 | * @package Platine\Etl |
| 49 | 49 | */ |
| 50 | -class EtlTool |
|
| 51 | -{ |
|
| 50 | +class EtlTool { |
|
| 52 | 51 | /** |
| 53 | 52 | * @var callable|null |
| 54 | 53 | */ |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | * @param DispatcherInterface|null $dispatcher |
| 103 | 103 | */ |
| 104 | 104 | public function __construct( |
| 105 | - ExtractorInterface|callable|null $extractor = null, |
|
| 106 | - TransformerInterface|callable|null $transformer = null, |
|
| 107 | - LoaderInterface|callable|null $loader = null, |
|
| 105 | + ExtractorInterface | callable | null $extractor = null, |
|
| 106 | + TransformerInterface | callable | null $transformer = null, |
|
| 107 | + LoaderInterface | callable | null $loader = null, |
|
| 108 | 108 | ?DispatcherInterface $dispatcher = null |
| 109 | 109 | ) { |
| 110 | 110 | if ($extractor !== null) { |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @param ExtractorInterface|callable|null $extractor |
| 127 | 127 | * @return $this |
| 128 | 128 | */ |
| 129 | - public function extractor(ExtractorInterface|callable|null $extractor): self |
|
| 129 | + public function extractor(ExtractorInterface | callable | null $extractor): self |
|
| 130 | 130 | { |
| 131 | 131 | if ($extractor instanceof ExtractorInterface) { |
| 132 | 132 | $this->extractor = [$extractor, 'extract']; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * @param TransformerInterface|callable|null $transformer |
| 146 | 146 | * @return $this |
| 147 | 147 | */ |
| 148 | - public function transformer(TransformerInterface|callable|null $transformer): self |
|
| 148 | + public function transformer(TransformerInterface | callable | null $transformer): self |
|
| 149 | 149 | { |
| 150 | 150 | if ($transformer instanceof TransformerInterface) { |
| 151 | 151 | $this->transformer = [$transformer, 'transform']; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * @param LoaderInterface|callable $loader |
| 164 | 164 | * @return $this |
| 165 | 165 | */ |
| 166 | - public function loader(LoaderInterface|callable $loader): self |
|
| 166 | + public function loader(LoaderInterface | callable $loader): self |
|
| 167 | 167 | { |
| 168 | 168 | if ($loader instanceof LoaderInterface) { |
| 169 | 169 | $this->loader = [$loader, 'load']; |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * @return $this |
| 199 | 199 | */ |
| 200 | 200 | public function onStart( |
| 201 | - ListenerInterface|callable $listener, |
|
| 201 | + ListenerInterface | callable $listener, |
|
| 202 | 202 | int $priority = DispatcherInterface::PRIORITY_DEFAULT |
| 203 | 203 | ): self { |
| 204 | 204 | $this->dispatcher->addListener(BaseEvent::START, $listener, $priority); |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * @return $this |
| 215 | 215 | */ |
| 216 | 216 | public function onExtract( |
| 217 | - ListenerInterface|callable $listener, |
|
| 217 | + ListenerInterface | callable $listener, |
|
| 218 | 218 | int $priority = DispatcherInterface::PRIORITY_DEFAULT |
| 219 | 219 | ): self { |
| 220 | 220 | $this->dispatcher->addListener(BaseEvent::EXTRACT, $listener, $priority); |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | * @return $this |
| 231 | 231 | */ |
| 232 | 232 | public function onExtractException( |
| 233 | - ListenerInterface|callable $listener, |
|
| 233 | + ListenerInterface | callable $listener, |
|
| 234 | 234 | int $priority = DispatcherInterface::PRIORITY_DEFAULT |
| 235 | 235 | ): self { |
| 236 | 236 | $this->dispatcher->addListener(BaseEvent::EXTRACT_EXCEPTION, $listener, $priority); |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | * @return $this |
| 247 | 247 | */ |
| 248 | 248 | public function onTransform( |
| 249 | - ListenerInterface|callable $listener, |
|
| 249 | + ListenerInterface | callable $listener, |
|
| 250 | 250 | int $priority = DispatcherInterface::PRIORITY_DEFAULT |
| 251 | 251 | ): self { |
| 252 | 252 | $this->dispatcher->addListener(BaseEvent::TRANSFORM, $listener, $priority); |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | * @return $this |
| 263 | 263 | */ |
| 264 | 264 | public function onTransformException( |
| 265 | - ListenerInterface|callable $listener, |
|
| 265 | + ListenerInterface | callable $listener, |
|
| 266 | 266 | int $priority = DispatcherInterface::PRIORITY_DEFAULT |
| 267 | 267 | ): self { |
| 268 | 268 | $this->dispatcher->addListener(BaseEvent::TRANSFORM_EXCEPTION, $listener, $priority); |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * @return $this |
| 279 | 279 | */ |
| 280 | 280 | public function onLoaderInit( |
| 281 | - ListenerInterface|callable $listener, |
|
| 281 | + ListenerInterface | callable $listener, |
|
| 282 | 282 | int $priority = DispatcherInterface::PRIORITY_DEFAULT |
| 283 | 283 | ): self { |
| 284 | 284 | $this->dispatcher->addListener(BaseEvent::LOADER_INIT, $listener, $priority); |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | * @return $this |
| 295 | 295 | */ |
| 296 | 296 | public function onLoad( |
| 297 | - ListenerInterface|callable $listener, |
|
| 297 | + ListenerInterface | callable $listener, |
|
| 298 | 298 | int $priority = DispatcherInterface::PRIORITY_DEFAULT |
| 299 | 299 | ): self { |
| 300 | 300 | $this->dispatcher->addListener(BaseEvent::LOAD, $listener, $priority); |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | * @return $this |
| 311 | 311 | */ |
| 312 | 312 | public function onLoadException( |
| 313 | - ListenerInterface|callable $listener, |
|
| 313 | + ListenerInterface | callable $listener, |
|
| 314 | 314 | int $priority = DispatcherInterface::PRIORITY_DEFAULT |
| 315 | 315 | ): self { |
| 316 | 316 | $this->dispatcher->addListener(BaseEvent::LOAD_EXCEPTION, $listener, $priority); |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | * @return $this |
| 327 | 327 | */ |
| 328 | 328 | public function onFlush( |
| 329 | - ListenerInterface|callable $listener, |
|
| 329 | + ListenerInterface | callable $listener, |
|
| 330 | 330 | int $priority = DispatcherInterface::PRIORITY_DEFAULT |
| 331 | 331 | ): self { |
| 332 | 332 | $this->dispatcher->addListener(BaseEvent::FLUSH, $listener, $priority); |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | * @return $this |
| 343 | 343 | */ |
| 344 | 344 | public function onSkip( |
| 345 | - ListenerInterface|callable $listener, |
|
| 345 | + ListenerInterface | callable $listener, |
|
| 346 | 346 | int $priority = DispatcherInterface::PRIORITY_DEFAULT |
| 347 | 347 | ): self { |
| 348 | 348 | $this->dispatcher->addListener(BaseEvent::SKIP, $listener, $priority); |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | * @return $this |
| 359 | 359 | */ |
| 360 | 360 | public function onStop( |
| 361 | - ListenerInterface|callable $listener, |
|
| 361 | + ListenerInterface | callable $listener, |
|
| 362 | 362 | int $priority = DispatcherInterface::PRIORITY_DEFAULT |
| 363 | 363 | ): self { |
| 364 | 364 | $this->dispatcher->addListener(BaseEvent::STOP, $listener, $priority); |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | * @return $this |
| 375 | 375 | */ |
| 376 | 376 | public function onRollback( |
| 377 | - ListenerInterface|callable $listener, |
|
| 377 | + ListenerInterface | callable $listener, |
|
| 378 | 378 | int $priority = DispatcherInterface::PRIORITY_DEFAULT |
| 379 | 379 | ): self { |
| 380 | 380 | $this->dispatcher->addListener(BaseEvent::ROLLBACK, $listener, $priority); |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | * @return $this |
| 391 | 391 | */ |
| 392 | 392 | public function onEnd( |
| 393 | - ListenerInterface|callable $listener, |
|
| 393 | + ListenerInterface | callable $listener, |
|
| 394 | 394 | int $priority = DispatcherInterface::PRIORITY_DEFAULT |
| 395 | 395 | ): self { |
| 396 | 396 | $this->dispatcher->addListener(BaseEvent::END, $listener, $priority); |
@@ -70,8 +70,8 @@ |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | - * {@inheritodc} |
|
| 74 | - */ |
|
| 73 | + * {@inheritodc} |
|
| 74 | + */ |
|
| 75 | 75 | public function init(array $options = []): void |
| 76 | 76 | { |
| 77 | 77 | if (isset($options['eol'])) { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * @param SplFileObject|string $file |
| 61 | 61 | * @param string $eol |
| 62 | 62 | */ |
| 63 | - public function __construct(SplFileObject|string $file, string $eol = PHP_EOL) |
|
| 63 | + public function __construct(SplFileObject | string $file, string $eol = PHP_EOL) |
|
| 64 | 64 | { |
| 65 | 65 | if (is_string($file)) { |
| 66 | 66 | $file = new SplFileObject($file, 'w'); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | /** |
| 84 | 84 | * {@inheritodc} |
| 85 | 85 | */ |
| 86 | - public function load(Generator $items, int|string $key, Etl $etl): void |
|
| 86 | + public function load(Generator $items, int | string $key, Etl $etl): void |
|
| 87 | 87 | { |
| 88 | 88 | foreach ($items as $value) { |
| 89 | 89 | $this->file->fwrite($value . $this->eol); |
@@ -41,8 +41,7 @@ discard block |
||
| 41 | 41 | * @class FileLoader |
| 42 | 42 | * @package Platine\Etl\Loader |
| 43 | 43 | */ |
| 44 | -class FileLoader implements LoaderInterface |
|
| 45 | -{ |
|
| 44 | +class FileLoader implements LoaderInterface { |
|
| 46 | 45 | /** |
| 47 | 46 | * The file to be used |
| 48 | 47 | * @var SplFileObject |
@@ -60,8 +59,7 @@ discard block |
||
| 60 | 59 | * @param SplFileObject|string $file |
| 61 | 60 | * @param string $eol |
| 62 | 61 | */ |
| 63 | - public function __construct(SplFileObject|string $file, string $eol = PHP_EOL) |
|
| 64 | - { |
|
| 62 | + public function __construct(SplFileObject|string $file, string $eol = PHP_EOL) { |
|
| 65 | 63 | if (is_string($file)) { |
| 66 | 64 | $file = new SplFileObject($file, 'w'); |
| 67 | 65 | } |
@@ -42,8 +42,7 @@ |
||
| 42 | 42 | * @class LoaderInterface |
| 43 | 43 | * @package Platine\Etl\Loader |
| 44 | 44 | */ |
| 45 | -interface LoaderInterface |
|
| 46 | -{ |
|
| 45 | +interface LoaderInterface { |
|
| 47 | 46 | /** |
| 48 | 47 | * Init loader (start a transaction, if supported) and reset loader state. |
| 49 | 48 | * @param array<string, mixed> $options additional options |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | * @param Etl $etl |
| 60 | 60 | * @return void |
| 61 | 61 | */ |
| 62 | - public function load(Generator $items, int|string $key, Etl $etl): void; |
|
| 62 | + public function load(Generator $items, int | string $key, Etl $etl): void; |
|
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * Flush elements (if supported). |
@@ -61,8 +61,7 @@ |
||
| 61 | 61 | * @param string $content |
| 62 | 62 | * @param bool $skipEmptyLine |
| 63 | 63 | */ |
| 64 | - public function __construct(string $content, bool $skipEmptyLine = true) |
|
| 65 | - { |
|
| 64 | + public function __construct(string $content, bool $skipEmptyLine = true) { |
|
| 66 | 65 | $this->content = $content; |
| 67 | 66 | $this->skipEmptyLine = $skipEmptyLine; |
| 68 | 67 | } |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | return count( |
| 112 | 112 | array_filter( |
| 113 | 113 | $current, |
| 114 | - function ($cell) { |
|
| 114 | + function($cell) { |
|
| 115 | 115 | return $cell !== null; |
| 116 | 116 | } |
| 117 | 117 | ) |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * The key |
| 53 | 53 | * @var int|string|null |
| 54 | 54 | */ |
| 55 | - protected int|string|null $key; |
|
| 55 | + protected int | string | null $key; |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * The exception that is raised |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | public function __construct( |
| 80 | 80 | string $name, |
| 81 | 81 | mixed $item, |
| 82 | - int|string|null $key, |
|
| 82 | + int | string | null $key, |
|
| 83 | 83 | Etl $etl, |
| 84 | 84 | Throwable $exception |
| 85 | 85 | ) { |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * Return the key |
| 103 | 103 | * @return int|string|null |
| 104 | 104 | */ |
| 105 | - public function getKey(): int|string|null |
|
| 105 | + public function getKey(): int | string | null |
|
| 106 | 106 | { |
| 107 | 107 | return $this->key; |
| 108 | 108 | } |
@@ -40,8 +40,7 @@ |
||
| 40 | 40 | * @class ItemExceptionEvent |
| 41 | 41 | * @package Platine\Etl\Event |
| 42 | 42 | */ |
| 43 | -class ItemExceptionEvent extends BaseEvent |
|
| 44 | -{ |
|
| 43 | +class ItemExceptionEvent extends BaseEvent { |
|
| 45 | 44 | /** |
| 46 | 45 | * The item |
| 47 | 46 | * @var mixed |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * The key |
| 52 | 52 | * @var int|string |
| 53 | 53 | */ |
| 54 | - protected int|string $key; |
|
| 54 | + protected int | string $key; |
|
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * Create new instance |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | public function __construct( |
| 64 | 64 | string $name, |
| 65 | 65 | mixed $item, |
| 66 | - int|string $key, |
|
| 66 | + int | string $key, |
|
| 67 | 67 | Etl $etl |
| 68 | 68 | ) { |
| 69 | 69 | parent::__construct($name, $etl); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * Return the key |
| 85 | 85 | * @return int|string |
| 86 | 86 | */ |
| 87 | - public function getKey(): int|string |
|
| 87 | + public function getKey(): int | string |
|
| 88 | 88 | { |
| 89 | 89 | return $this->key; |
| 90 | 90 | } |
@@ -39,8 +39,7 @@ |
||
| 39 | 39 | * @class ItemEvent |
| 40 | 40 | * @package Platine\Etl\Event |
| 41 | 41 | */ |
| 42 | -class ItemEvent extends BaseEvent |
|
| 43 | -{ |
|
| 42 | +class ItemEvent extends BaseEvent { |
|
| 44 | 43 | /** |
| 45 | 44 | * The item |
| 46 | 45 | * @var mixed |