Skip to content

Commit 82c3437

Browse files
committed
add pusher event
1 parent e76cc8c commit 82c3437

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Utils/GedcomParser.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Illuminate\Console\OutputStyle;
88
use Symfony\Component\Console\Input\StringInput;
99
use Symfony\Component\Console\Output\StreamOutput;
10-
10+
use \App\Events\GedComProgressSent;
1111
class GedcomParser
1212
{
1313
/**
@@ -18,29 +18,35 @@ class GedcomParser
1818
*/
1919
protected $persons_id = [];
2020

21-
public function parse(string $filename, bool $progressBar = false)
21+
public function parse(string $filename, string $slug, bool $progressBar = false)
2222
{
2323
$parser = new \PhpGedcom\Parser();
2424
$gedcom = @$parser->parse($filename);
2525

2626
$individuals = $gedcom->getIndi();
2727
$families = $gedcom->getFam();
28-
28+
$total = count($individuals) + count($families);
29+
$complete = 0;
2930
if ($progressBar === true) {
3031
$bar = $this->getProgressBar(count($individuals) + count($families));
32+
event(new GedComProgressSent($slug, $total, $complete));
3133
}
3234

3335
foreach ($individuals as $individual) {
3436
$this->getPerson($individual);
3537
if ($progressBar === true) {
3638
$bar->advance();
39+
$complete++;
40+
event(new GedComProgressSent($slug, $total, $complete));
3741
}
3842
}
3943

4044
foreach ($families as $family) {
4145
$this->getFamily($family);
4246
if ($progressBar === true) {
4347
$bar->advance();
48+
$complete++;
49+
event(new GedComProgressSent($slug, $total, $complete));
4450
}
4551
}
4652

0 commit comments

Comments
 (0)