Skip to content

Commit d4a933b

Browse files
Merge remote-tracking branch 'origin/master'
# Conflicts: # src/Utils/GedcomGenerator.php
2 parents 43dc3ad + 17ab3ee commit d4a933b

39 files changed

+176
-188
lines changed

src/Events/GedComProgressSent.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@ class GedComProgressSent implements ShouldBroadcast
2727
* @param $complete
2828
*/
2929
public function __construct(
30-
$slug,
31-
$total,
32-
$complete,
33-
$channel = ['name' => 'gedcom-progress', 'eventName' => 'newMessage']
34-
)
35-
{
30+
$slug,
31+
$total,
32+
$complete,
33+
$channel = ['name' => 'gedcom-progress', 'eventName' => 'newMessage']
34+
) {
3635
$this->slug = $slug;
3736
$this->total = $total;
3837
$this->complete = $complete;
@@ -49,9 +48,9 @@ public function __construct(
4948
public function broadcastWith()
5049
{
5150
return [
52-
'slug' => $this->slug,
53-
'total' => $this->total,
54-
'complete' => $this->complete,
51+
'slug' => $this->slug,
52+
'total' => $this->total,
53+
'complete' => $this->complete,
5554
];
5655
}
5756

src/Utils/FamilyData.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class FamilyData
2424
public static function getFamily($conn, $families, $obje_ids, $sour_ids, $persons_id, $note_ids, $repo_ids)
2525
{
2626
$familyData = [];
27+
2728
try {
2829
foreach ($families as $family) {
2930
$g_id = $family->getId();
@@ -65,29 +66,26 @@ public static function getFamily($conn, $families, $obje_ids, $sour_ids, $person
6566

6667
$key = [
6768
['husband_id', $husband_id], ['wife_id', $wife_id], ['description', $description], ['type_id', $type_id], ['nchi', $nchi],
68-
['rin', $rin]
69+
['rin', $rin],
6970
];
7071
$check = Family::on($conn)->where($key)->first();
7172
if (empty($check)) {
7273
$value = [['husband_id', $husband_id], ['wife_id', $wife_id], ['description', $description], ['type_id', $type_id], ['nchi', $nchi],
73-
['rin', $rin]];
74+
['rin', $rin], ];
7475

7576
$FamilyData[] = $value;
7677
}
7778
// $person = Person::on($conn)->updateOrCreate($key,$value);
7879
// otherFields::insertOtherFields($conn,$individual,$obje_ids,$person);
7980

80-
8181
foreach (array_chunk($FamilyData, 200) as $chunk) {
8282
Family::on($conn)->insert($chunk);
8383
}
8484
otherFamRecord::insertFamilyData($conn, $families, $obje_ids, $sour_ids);
85-
8685
} catch (\Exception $e) {
8786
$error = $e->getMessage();
87+
8888
return \Log::error($error);
8989
}
90-
9190
}
9291
}
93-

src/Utils/GedcomGenerator.php

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44

55
use FamilyTree365\LaravelGedcom\Models\Family;
66
use FamilyTree365\LaravelGedcom\Models\Person;
7-
use Gedcom\Gedcom;
8-
use Gedcom\Record\Fam;
9-
use Gedcom\Record\Fam\Even;
10-
use Gedcom\Record\Indi\Even as Personal;
11-
use Gedcom\Record\Fam\Slgs;
12-
use Gedcom\Record\Head;
13-
use Gedcom\Record\Head\Sour;
14-
use Gedcom\Record\Indi;
15-
use Gedcom\Record\Indi\Fams;
16-
use Gedcom\Record\Indi\Name;
17-
use Gedcom\Record\NoteRef;
18-
use Gedcom\Record\ObjeRef;
19-
use Gedcom\Record\SourRef;
20-
use Gedcom\Record\Subm;
21-
use Gedcom\Writer;
7+
use PhpGedcom\Gedcom;
8+
use PhpGedcom\Record\Fam;
9+
use PhpGedcom\Record\Fam\Even;
10+
use PhpGedcom\Record\Fam\Slgs;
11+
use PhpGedcom\Record\Head;
12+
use PhpGedcom\Record\Head\Sour;
13+
use PhpGedcom\Record\Indi;
14+
use PhpGedcom\Record\Indi\Even as Personal;
15+
use PhpGedcom\Record\Indi\Fams;
16+
use PhpGedcom\Record\Indi\Name;
17+
use PhpGedcom\Record\NoteRef;
18+
use PhpGedcom\Record\ObjeRef;
19+
use PhpGedcom\Record\SourRef;
20+
use PhpGedcom\Record\Subm;
21+
use PhpGedcom\Writer;
2222

2323
class GedcomGenerator
2424
{
@@ -315,15 +315,15 @@ protected function setIndi($p_id)
315315
$indi->setSex($sex);
316316

317317
$place = PersonEvent::query()->find($p_id);
318-
$_plac = new Personal;
319-
if(!empty($place->type)){
318+
$_plac = new Personal();
319+
if (!empty($place->type)) {
320320
$_plac->setType($place->type);
321321
}
322-
if(!empty($place->date)){
323-
$date = \FamilyTree365\LaravelGedcom\Utils\Importer\Date::read("", $place->date);
322+
if (!empty($place->date)) {
323+
$date = \FamilyTree365\LaravelGedcom\Utils\Importer\Date::read('', $place->date);
324324
$_plac->setDate($date);
325325
}
326-
if(!empty($place->type) && !empty($place->date)){
326+
if (!empty($place->type) && !empty($place->date)) {
327327
$indi->getAllEven($_plac);
328328
}
329329

@@ -379,17 +379,17 @@ protected function setFam($family_id)
379379
$even = new Even();
380380
$_type = null; // string
381381
$_date = null; // string
382-
$_plac = null; // \Gedcom\Record\Indi\Even\Plac
382+
$_plac = null; // \PhpGedcom\Record\Indi\Even\Plac
383383
$_caus = null; // string
384384
$_age = null; // string
385-
$_addr = null; // \Gedcom\Record\Addr
386-
$_phon = []; // \Gedcom\Record\Phon
385+
$_addr = null; // \PhpGedcom\Record\Addr
386+
$_phon = []; // \PhpGedcom\Record\Phon
387387
$_agnc = null; // string
388-
$_husb = null; // \Gedcom\Record\Fam\Even\Husb
389-
$_wife = null; // \Gedcom\Record\Fam\Even\Wife
390-
$_obje = []; // \Gedcom\Writer\ObjeRef
391-
$_sour = []; // \Gedcom\Writer\SourRef
392-
$_note = []; // \Gedcom\Writer\NoteRef
388+
$_husb = null; // \PhpGedcom\Record\Fam\Even\Husb
389+
$_wife = null; // \PhpGedcom\Record\Fam\Even\Wife
390+
$_obje = []; // \PhpGedcom\Writer\ObjeRef
391+
$_sour = []; // \PhpGedcom\Writer\SourRef
392+
$_note = []; // \PhpGedcom\Writer\NoteRef
393393
$even->setType($_type);
394394
$even->setDate($_date);
395395
$even->setPlac($_plac);

src/Utils/GedcomParser.php

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,12 @@ class GedcomParser
3636
protected $conn = '';
3737

3838
public function parse(
39-
$conn,
40-
string $filename,
41-
string $slug,
42-
bool $progressBar = NULL,
43-
$channel = ['name' => 'gedcom-progress1', 'eventName' => 'newMessage']
44-
)
45-
{
39+
$conn,
40+
string $filename,
41+
string $slug,
42+
bool $progressBar = null,
43+
$channel = ['name' => 'gedcom-progress1', 'eventName' => 'newMessage']
44+
) {
4645
DB::disableQueryLog();
4746
//start calculating the time
4847
$time_start = microtime(true);
@@ -65,28 +64,22 @@ public function parse(
6564
$repo = [];
6665
$obje = [];
6766

68-
if ($gedcom->getSubn())
69-
{
67+
if ($gedcom->getSubn()) {
7068
$subn = $gedcom->getSubn();
7169
}
72-
if ($gedcom->getSubm())
73-
{
70+
if ($gedcom->getSubm()) {
7471
$subm = $gedcom->getSubm();
7572
}
76-
if ($gedcom->getSour())
77-
{
73+
if ($gedcom->getSour()) {
7874
$sour = $gedcom->getSour();
7975
}
80-
if ($gedcom->getNote())
81-
{
76+
if ($gedcom->getNote()) {
8277
$note = $gedcom->getNote();
8378
}
84-
if ($gedcom->getRepo())
85-
{
79+
if ($gedcom->getRepo()) {
8680
$repo = $gedcom->getRepo();
8781
}
88-
if ($gedcom->getObje())
89-
{
82+
if ($gedcom->getObje()) {
9083
$obje = $gedcom->getObje();
9184
}
9285

@@ -138,7 +131,6 @@ public function parse(
138131
$complete++;
139132
event(new GedComProgressSent($slug, $total, $complete, $channel));
140133
}
141-
142134
}
143135
// store information about all the submitters to the GEDCOM file.
144136
foreach ($subm as $item) {
@@ -259,9 +251,9 @@ public function parse(
259251
event(new GedComProgressSent($slug, $total, $complete, $channel));
260252
}
261253
}
262-
}
263-
catch (\Exception $e) {
254+
} catch (\Exception $e) {
264255
$error = $e->getMessage();
256+
265257
return \Log::error($error);
266258
}
267259

src/Utils/Importer/Indi/Even.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static function read($conn, $events, $person, $obje_ids = [])
4040
$phon = \FamilyTree365\LaravelGedcom\Utils\Importer\Phon::read($conn, $_phon);
4141
$_addr = $even->getAddr();
4242
//$addr_id = \FamilyTree365\LaravelGedcom\Utils\Importer\Addr::read($conn, $_addr);
43-
if(!empty($_addr)){
43+
if (!empty($_addr)) {
4444
$addr_id = \FamilyTree365\LaravelGedcom\Utils\Importer\Addr::read($conn, $_addr);
4545
} else {
4646
$addr_id = null;
@@ -196,7 +196,7 @@ public static function otherField($conn, $events, $person)
196196
$phon = \FamilyTree365\LaravelGedcom\Utils\Importer\Phon::read($conn, $_phon);
197197
$_addr = $even->getAddr();
198198
//$addr_id = \FamilyTree365\LaravelGedcom\Utils\Importer\Addr::read($conn, $_addr);
199-
if(!empty($_addr)){
199+
if (!empty($_addr)) {
200200
$addr_id = \FamilyTree365\LaravelGedcom\Utils\Importer\Addr::read($conn, $_addr);
201201
} else {
202202
$addr_id = null;
@@ -316,12 +316,12 @@ public static function otherField($conn, $events, $person)
316316
$person->deathday = date('Y-m-d', strtotime($date));
317317
}
318318
$person->save();
319-
319+
320320
$sour = $even->getSour();
321321
$notes = $even->getNote();
322322
$obje = $even->getObje();
323323
$_chan = $even->getChan() ?? null;
324-
if((!empty($sour) && count($sour) > 0) || (!empty($obje) && count($obje) > 0) || (!empty($notes) && count($notes) > 0) || !empty($_chan)) {
324+
if ((!empty($sour) && count($sour) > 0) || (!empty($obje) && count($obje) > 0) || (!empty($notes) && count($notes) > 0) || !empty($_chan)) {
325325
$record = PersonEvent::on($conn)->where($key)->first();
326326
$_group = 'indi_even';
327327
$_gid = $record->id;

src/Utils/ParentData.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class ParentData
2525
public static function getPerson($conn, $individuals, $obje_ids, $sour_ids)
2626
{
2727
$ParentData = [];
28+
2829
try {
2930
foreach ($individuals as $k => $individual) {
3031
$g_id = $individual->getId();
@@ -89,15 +90,15 @@ public static function getPerson($conn, $individuals, $obje_ids, $sour_ids)
8990
$givn = $name;
9091
}
9192

92-
$config = json_encode(config('database.connections.' . $conn));
93+
$config = json_encode(config('database.connections.'.$conn));
9394
/* $key = [
9495
['name', $name], ['givn', $givn], ['surn', $surn], ['sex', $sex], ['uid', $uid],
9596
]; */
9697
//$check = Person::on($conn)->where($key)->first();
9798
//if (empty($check)) {
98-
$value = ['name' => $name, 'givn' => $givn, 'surn' => $surn, 'sex' => $sex, 'uid' => $uid, 'rin' => $rin, 'resn' => $resn, 'rfn' => $rfn, 'afn' => $afn];
99+
$value = ['name' => $name, 'givn' => $givn, 'surn' => $surn, 'sex' => $sex, 'uid' => $uid, 'rin' => $rin, 'resn' => $resn, 'rfn' => $rfn, 'afn' => $afn];
99100

100-
$ParentData[] = $value;
101+
$ParentData[] = $value;
101102
//}
102103
// $person = Person::on($conn)->updateOrCreate($key,$value);
103104
// otherFields::insertOtherFields($conn,$individual,$obje_ids,$person);
@@ -109,11 +110,10 @@ public static function getPerson($conn, $individuals, $obje_ids, $sour_ids)
109110
// it's take only 1 second for 3010 record
110111
Person::on($conn)->insert($ParentData);
111112
otherFields::insertOtherFields($conn, $individuals, $obje_ids, $sour_ids);
112-
}
113-
catch (\Exception $e) {
113+
} catch (\Exception $e) {
114114
$error = $e->getMessage();
115+
115116
return \Log::error($error);
116117
}
117118
}
118119
}
119-

src/factories/AddrFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function definition()
2727
'city' => $this->faker->city(),
2828
'stae' => $this->faker->state(),
2929
'post' => $this->faker->postcode(),
30-
'ctry' => $this->faker->countryCode(), 'created_at', 'updated_at'
30+
'ctry' => $this->faker->countryCode(), 'created_at', 'updated_at',
3131
];
3232
}
3333
}

src/factories/AuthorFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class AuthorFactory extends Factory
2222
public function definition()
2323
{
2424
return [
25-
'description' => $this->faker->words(), 'is_active', 'name' => $this->faker->name()
25+
'description' => $this->faker->words(), 'is_active', 'name' => $this->faker->name(),
2626
];
2727
}
2828
}

src/factories/ChanFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ChanFactory extends Factory
2222
public function definition()
2323
{
2424
return [
25-
'group' => $this->faker->word(), 'gid' => $this->faker->randomElement(1, 2), 'date' => $this->faker->date(), 'time' => $this->faker->time(), 'created_at', 'updated_at'
25+
'group' => $this->faker->word(), 'gid' => $this->faker->randomElement(1, 2), 'date' => $this->faker->date(), 'time' => $this->faker->time(), 'created_at', 'updated_at',
2626
];
2727
}
2828
}

src/factories/CitationFactory.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ class CitationFactory extends Factory
2323
public function definition()
2424
{
2525
return [
26-
'name' => $this->faker->word(), 'description' => $this->faker->text(),
26+
'name' => $this->faker->word(), 'description' => $this->faker->text(),
2727
'repository_id' => Repository::factory(),
28-
'volume' => $this->faker->randomElement(1, 2, 3, 4, 5),
29-
'page' => $this->faker->randomNumber(500), 'is_active',
30-
'confidence' => $this->faker->word(),
31-
'source_id' => $this->faker->randomElement(1, 2, 3, 4)
28+
'volume' => $this->faker->randomElement(1, 2, 3, 4, 5),
29+
'page' => $this->faker->randomNumber(500), 'is_active',
30+
'confidence' => $this->faker->word(),
31+
'source_id' => $this->faker->randomElement(1, 2, 3, 4),
3232

3333
];
3434
}

0 commit comments

Comments
 (0)