Passed
Push — develop ( d8faa2...4cb62a )
by nguereza
12:47
created
src/Extractor/JsonExtractor.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,8 +44,7 @@  discard block
 block discarded – undo
44 44
  * @class JsonExtractor
45 45
  * @package Platine\Etl\Extractor
46 46
  */
47
-class JsonExtractor implements ExtractorInterface
48
-{
47
+class JsonExtractor implements ExtractorInterface {
49 48
     public const EXTRACT_AUTO = 0;
50 49
     public const EXTRACT_FROM_STRING = 1;
51 50
     public const EXTRACT_FROM_FILE = 2;
@@ -61,8 +60,7 @@  discard block
 block discarded – undo
61 60
      * Create new instance
62 61
      * @param int $type
63 62
      */
64
-    public function __construct(int $type = self::EXTRACT_AUTO)
65
-    {
63
+    public function __construct(int $type = self::EXTRACT_AUTO) {
66 64
         $this->type = $type;
67 65
     }
68 66
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      * @param SplFileObject|string $file
123 123
      * @return iterable<int|string, mixed>
124 124
      */
125
-    protected function extractFromFile(SplFileObject|string $file): iterable
125
+    protected function extractFromFile(SplFileObject | string $file): iterable
126 126
     {
127 127
         if ($file instanceof SplFileObject) {
128 128
             $file = $file->getPathname();
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      * @param array<mixed>|string $data
144 144
      * @return iterable<int|string, mixed>
145 145
      */
146
-    protected function extractAuto(array|string $data): iterable
146
+    protected function extractAuto(array | string $data): iterable
147 147
     {
148 148
         if (is_array($data)) {
149 149
             return $this->extractFromArray($data);
Please login to merge, or discard this patch.
src/Extractor/CsvExtractor.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,8 +44,7 @@
 block discarded – undo
44 44
  * @class CsvExtractor
45 45
  * @package Platine\Etl\Extractor
46 46
  */
47
-class CsvExtractor implements ExtractorInterface
48
-{
47
+class CsvExtractor implements ExtractorInterface {
49 48
     public const EXTRACT_AUTO = 0;
50 49
     public const EXTRACT_FROM_STRING = 1;
51 50
     public const EXTRACT_FROM_FILE = 2;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@
 block discarded – undo
154 154
      * @param SplFileObject|string $file
155 155
      * @return iterable<int|string, mixed>
156 156
      */
157
-    protected function extractFromFile(SplFileObject|string $file): iterable
157
+    protected function extractFromFile(SplFileObject | string $file): iterable
158 158
     {
159 159
         if ($file instanceof SplFileObject) {
160 160
             return new CsvFileIterator(
Please login to merge, or discard this patch.
src/EtlTool.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Loader/LoaderInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
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).
Please login to merge, or discard this patch.
src/Loader/FileLoader.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,8 +41,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/Loader/JsonFileLoader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      * @param int $depth
78 78
      */
79 79
     public function __construct(
80
-        SplFileObject|string $file,
80
+        SplFileObject | string $file,
81 81
         int $options = 0,
82 82
         int $depth = 512
83 83
     ) {
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     /**
109 109
      * {@inheritodc}
110 110
      */
111
-    public function load(Generator $items, int|string $key, Etl $etl): void
111
+    public function load(Generator $items, int | string $key, Etl $etl): void
112 112
     {
113 113
         foreach ($items as $k => $v) {
114 114
             $this->data[$k] = $v;
Please login to merge, or discard this patch.
src/Loader/NullLoader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
     /**
54 54
      * {@inheritodc}
55 55
      */
56
-    public function load(Generator $items, int|string $key, Etl $etl): void
56
+    public function load(Generator $items, int | string $key, Etl $etl): void
57 57
     {
58 58
         foreach ($items as $value) {
59 59
             continue;
Please login to merge, or discard this patch.
src/Loader/CsvFileLoader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      * @param string $escapeString
84 84
      */
85 85
     public function __construct(
86
-        SplFileObject|string $file,
86
+        SplFileObject | string $file,
87 87
         array $keys = [],
88 88
         string $delimiter = ',',
89 89
         string $enclosure = '"',
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     /**
141 141
      * {@inheritodc}
142 142
      */
143
-    public function load(Generator $items, int|string $key, Etl $etl): void
143
+    public function load(Generator $items, int | string $key, Etl $etl): void
144 144
     {
145 145
         foreach ($items as $value) {
146 146
             $this->file->fputcsv(
Please login to merge, or discard this patch.
src/Loader/ArrayLoader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
     /**
80 80
      * {@inheritodc}
81 81
      */
82
-    public function load(Generator $items, int|string $key, Etl $etl): void
82
+    public function load(Generator $items, int | string $key, Etl $etl): void
83 83
     {
84 84
         foreach ($items as $value) {
85 85
             if ($this->preserveKeys) {
Please login to merge, or discard this patch.