@@ -40,8 +40,7 @@ |
||
40 | 40 | * @class NullLoader |
41 | 41 | * @package Platine\Etl\Loader |
42 | 42 | */ |
43 | -class NullLoader implements LoaderInterface |
|
44 | -{ |
|
43 | +class NullLoader implements LoaderInterface { |
|
45 | 44 | /** |
46 | 45 | * {@inheritodc} |
47 | 46 | */ |
@@ -41,8 +41,7 @@ |
||
41 | 41 | * @class CsvFileLoader |
42 | 42 | * @package Platine\Etl\Loader |
43 | 43 | */ |
44 | -class CsvFileLoader implements LoaderInterface |
|
45 | -{ |
|
44 | +class CsvFileLoader implements LoaderInterface { |
|
46 | 45 | /** |
47 | 46 | * The file to be used |
48 | 47 | * @var SplFileObject |
@@ -40,8 +40,7 @@ discard block |
||
40 | 40 | * @class ArrayLoader |
41 | 41 | * @package Platine\Etl\Loader |
42 | 42 | */ |
43 | -class ArrayLoader implements LoaderInterface |
|
44 | -{ |
|
43 | +class ArrayLoader implements LoaderInterface { |
|
45 | 44 | /** |
46 | 45 | * The data |
47 | 46 | * @var array<mixed> |
@@ -59,8 +58,7 @@ discard block |
||
59 | 58 | * @param bool $preserveKeys |
60 | 59 | * @param array<mixed> $data |
61 | 60 | */ |
62 | - public function __construct(bool $preserveKeys = true, array &$data = []) |
|
63 | - { |
|
61 | + public function __construct(bool $preserveKeys = true, array &$data = []) { |
|
64 | 62 | $this->data = &$data; |
65 | 63 | $this->preserveKeys = $preserveKeys; |
66 | 64 | } |
@@ -42,8 +42,7 @@ |
||
42 | 42 | * @class JsonFileLoader |
43 | 43 | * @package Platine\Etl\Loader |
44 | 44 | */ |
45 | -class JsonFileLoader implements LoaderInterface |
|
46 | -{ |
|
45 | +class JsonFileLoader implements LoaderInterface { |
|
47 | 46 | /** |
48 | 47 | * The file to be used |
49 | 48 | * @var SplFileObject |
@@ -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($file, string $eol = PHP_EOL) |
|
64 | - { |
|
62 | + public function __construct($file, string $eol = PHP_EOL) { |
|
65 | 63 | if (is_string($file)) { |
66 | 64 | $file = new SplFileObject($file, 'w'); |
67 | 65 | } |
@@ -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'])) { |
@@ -42,8 +42,7 @@ discard block |
||
42 | 42 | * @package Platine\Etl\Iterator |
43 | 43 | * @implements IteratorAggregate<int|string, mixed> |
44 | 44 | */ |
45 | -class FileLineIterator implements IteratorAggregate |
|
46 | -{ |
|
45 | +class FileLineIterator implements IteratorAggregate { |
|
47 | 46 | /** |
48 | 47 | * The file to be used |
49 | 48 | * @var SplFileObject |
@@ -54,8 +53,7 @@ discard block |
||
54 | 53 | * Create new instance |
55 | 54 | * @param SplFileObject $file |
56 | 55 | */ |
57 | - public function __construct(SplFileObject $file) |
|
58 | - { |
|
56 | + public function __construct(SplFileObject $file) { |
|
59 | 57 | $this->file = $file; |
60 | 58 | } |
61 | 59 |
@@ -61,8 +61,7 @@ discard block |
||
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 | } |
@@ -84,8 +83,7 @@ discard block |
||
84 | 83 | * Uses a regex to split lines. |
85 | 84 | * @return Generator|string[] |
86 | 85 | */ |
87 | - protected function pregSplitIterator() |
|
88 | - { |
|
86 | + protected function pregSplitIterator() { |
|
89 | 87 | $lines = (array) preg_split("/((\r?\n)|(\r\n?))/", $this->content); |
90 | 88 | foreach ($lines as $line) { |
91 | 89 | yield $line; |
@@ -96,8 +94,7 @@ discard block |
||
96 | 94 | * Uses "strtok" to split lines. Provides better performance, but skips empty lines. |
97 | 95 | * @return Generator|string[] |
98 | 96 | */ |
99 | - protected function strtokIterator() |
|
100 | - { |
|
97 | + protected function strtokIterator() { |
|
101 | 98 | $tok = strtok($this->content, "\r\n"); |
102 | 99 | while ($tok !== false) { |
103 | 100 | $line = $tok; |
@@ -111,7 +111,7 @@ |
||
111 | 111 | return !empty( |
112 | 112 | array_filter( |
113 | 113 | $current, |
114 | - function ($cell) { |
|
114 | + function($cell) { |
|
115 | 115 | return $cell !== null; |
116 | 116 | } |
117 | 117 | ) |
@@ -42,6 +42,5 @@ |
||
42 | 42 | * @package Platine\Etl\Iterator |
43 | 43 | * @extends Traversable<int|string, mixed> |
44 | 44 | */ |
45 | -interface CsvIteratorInterface extends Traversable |
|
46 | -{ |
|
45 | +interface CsvIteratorInterface extends Traversable { |
|
47 | 46 | } |