Skip to content

Commit dbbd536

Browse files
committed
docs: ✏️ tweak readme and composer.json doc
1 parent bab805b commit dbbd536

2 files changed

Lines changed: 11 additions & 19 deletions

File tree

README.md

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,14 @@ use Ttskch\Bulkony\Export\RowGenerator\RowGeneratorInterface;
7878

7979
class UserRowGenerator implements RowGeneratorInterface
8080
{
81-
private $userRepository;
82-
83-
public function __construct($userRepository)
81+
public function __construct(private $userRepository)
8482
{
85-
$this->userRepository = $userRepository;
8683
}
8784

8885
public function getHeadingRows(): array
8986
{
90-
return ['id', 'name', 'email'];
87+
// return 2D array so that you can export multiple header rows
88+
return [['id', 'name', 'email']];
9189
}
9290

9391
public function getBodyRowsIterator(): iterable
@@ -170,11 +168,8 @@ use Ttskch\Bulkony\Import\RowVisitor\RowVisitorInterface;
170168

171169
class UserRowVisitor implements RowVisitorInterface
172170
{
173-
private $userRepository;
174-
175-
public function __constructor($userRepository)
171+
public function __constructor(private $userRepository)
176172
{
177-
$this->userRepository = $userRepository;
178173
}
179174

180175
public function import(array $csvRow, int $csvLineNumber, Context $context): void
@@ -184,7 +179,7 @@ class UserRowVisitor implements RowVisitorInterface
184179

185180
private function hydrate(array $csvRow): App\User
186181
{
187-
// create App\User instance from csv row
182+
// create App\User instance from csv row in some way
188183
return new App\User($csvRow);
189184
}
190185
}
@@ -227,13 +222,8 @@ use Ttskch\Bulkony\Import\Validation\ErrorList;
227222

228223
class UserRowVisitor implements ValidatableRowVisitorInterface
229224
{
230-
private $userRepository;
231-
private $validator;
232-
233-
public function __constructor($userRepository, $validator)
225+
public function __constructor(private $userRepository, private $validator)
234226
{
235-
$this->userRepository = $userRepository;
236-
$this->validator = $validator;
237227
}
238228

239229
public function import(array $csvRow, int $csvLineNumber, Context $context): void
@@ -256,7 +246,7 @@ class UserRowVisitor implements ValidatableRowVisitorInterface
256246

257247
public function onError(array $csvRow, ErrorList $errorList, Context $context): bool
258248
{
259-
// you can log errors for one csv row or something here...
249+
// you can log errors for one csv row or do something here...
260250

261251
// you can choose continue or abort on error occurred
262252
return ValidatableRowVisitorInterface::CONTINUE_ON_ERROR;
@@ -265,7 +255,7 @@ class UserRowVisitor implements ValidatableRowVisitorInterface
265255

266256
private function hydrate(array $csvRow): App\User
267257
{
268-
// create App\User instance from csv row
258+
// create App\User instance from csv row in some way
269259
return new App\User($csvRow);
270260
}
271261
}

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"name": "ttskch/bulkony",
3-
"description": "",
3+
"description": "Easy and flexible CSV exports and imports in PHP ⚡",
4+
"keywords": ["csv", "excel", "bulk", "csv-export", "csv-import"],
5+
"type": "library",
46
"license": "MIT",
57
"authors": [
68
{

0 commit comments

Comments
 (0)