@@ -19,21 +19,21 @@ |
||
19 | 19 | */ |
20 | 20 | class NullFactSourceStatus extends FactSourceStatus |
21 | 21 | { |
22 | - /** |
|
23 | - * {@inheritDoc} |
|
24 | - * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus::isSet() |
|
25 | - */ |
|
26 | - public function isSet(): bool |
|
27 | - { |
|
28 | - return false; |
|
29 | - } |
|
22 | + /** |
|
23 | + * {@inheritDoc} |
|
24 | + * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus::isSet() |
|
25 | + */ |
|
26 | + public function isSet(): bool |
|
27 | + { |
|
28 | + return false; |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * {@inheritDoc} |
|
33 | - * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\FactSourceStatus::combineWith() |
|
34 | - */ |
|
35 | - public function combineWith(SourceStatus $other) |
|
36 | - { |
|
37 | - return $other; |
|
38 | - } |
|
31 | + /** |
|
32 | + * {@inheritDoc} |
|
33 | + * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\FactSourceStatus::combineWith() |
|
34 | + */ |
|
35 | + public function combineWith(SourceStatus $other) |
|
36 | + { |
|
37 | + return $other; |
|
38 | + } |
|
39 | 39 | } |
@@ -27,52 +27,52 @@ |
||
27 | 27 | */ |
28 | 28 | class RecordNameTextExtenderCollector extends AbstractHookCollector implements RecordNameTextExtenderInterface |
29 | 29 | { |
30 | - /** |
|
31 | - * {@inheritDoc} |
|
32 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title() |
|
33 | - */ |
|
34 | - public function title(): string |
|
35 | - { |
|
36 | - return I18N::translate('Text extender for records’ name'); |
|
37 | - } |
|
30 | + /** |
|
31 | + * {@inheritDoc} |
|
32 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title() |
|
33 | + */ |
|
34 | + public function title(): string |
|
35 | + { |
|
36 | + return I18N::translate('Text extender for records’ name'); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * {@inheritDoc} |
|
41 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description() |
|
42 | - */ |
|
43 | - public function description(): string |
|
44 | - { |
|
45 | - return I18N::translate('Extends the full name of GEDCOM records with additional text or icons.'); |
|
46 | - } |
|
39 | + /** |
|
40 | + * {@inheritDoc} |
|
41 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description() |
|
42 | + */ |
|
43 | + public function description(): string |
|
44 | + { |
|
45 | + return I18N::translate('Extends the full name of GEDCOM records with additional text or icons.'); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * {@inheritDoc} |
|
50 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface() |
|
51 | - */ |
|
52 | - public function hookInterface(): string |
|
53 | - { |
|
54 | - return RecordNameTextExtenderInterface::class; |
|
55 | - } |
|
48 | + /** |
|
49 | + * {@inheritDoc} |
|
50 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface() |
|
51 | + */ |
|
52 | + public function hookInterface(): string |
|
53 | + { |
|
54 | + return RecordNameTextExtenderInterface::class; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * {@inheritDoc} |
|
59 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\RecordNameTextExtenderInterface::recordNamePrepend() |
|
60 | - */ |
|
61 | - public function recordNamePrepend(GedcomRecord $record, bool $use_long = false, string $size = ''): string |
|
62 | - { |
|
63 | - return $this->hooks() |
|
64 | - ->map(fn(RecordNameTextExtenderInterface $hook) => $hook->recordNamePrepend($record, $use_long, $size)) |
|
65 | - ->implode(''); |
|
66 | - } |
|
57 | + /** |
|
58 | + * {@inheritDoc} |
|
59 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\RecordNameTextExtenderInterface::recordNamePrepend() |
|
60 | + */ |
|
61 | + public function recordNamePrepend(GedcomRecord $record, bool $use_long = false, string $size = ''): string |
|
62 | + { |
|
63 | + return $this->hooks() |
|
64 | + ->map(fn(RecordNameTextExtenderInterface $hook) => $hook->recordNamePrepend($record, $use_long, $size)) |
|
65 | + ->implode(''); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * {@inheritDoc} |
|
70 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\RecordNameTextExtenderInterface::recordNameAppend() |
|
71 | - */ |
|
72 | - public function recordNameAppend(GedcomRecord $record, bool $use_long = false, string $size = ''): string |
|
73 | - { |
|
74 | - return $this->hooks() |
|
75 | - ->map(fn(RecordNameTextExtenderInterface $hook) => $hook->recordNameAppend($record, $use_long, $size)) |
|
76 | - ->implode(''); |
|
77 | - } |
|
68 | + /** |
|
69 | + * {@inheritDoc} |
|
70 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\RecordNameTextExtenderInterface::recordNameAppend() |
|
71 | + */ |
|
72 | + public function recordNameAppend(GedcomRecord $record, bool $use_long = false, string $size = ''): string |
|
73 | + { |
|
74 | + return $this->hooks() |
|
75 | + ->map(fn(RecordNameTextExtenderInterface $hook) => $hook->recordNameAppend($record, $use_long, $size)) |
|
76 | + ->implode(''); |
|
77 | + } |
|
78 | 78 | } |
@@ -27,41 +27,41 @@ |
||
27 | 27 | */ |
28 | 28 | class NameAccordionExtenderCollector extends AbstractHookCollector implements NameAccordionExtenderInterface |
29 | 29 | { |
30 | - /** |
|
31 | - * {@inheritDoc} |
|
32 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title() |
|
33 | - */ |
|
34 | - public function title(): string |
|
35 | - { |
|
36 | - return I18N::translate('Individual names accordion extender'); |
|
37 | - } |
|
30 | + /** |
|
31 | + * {@inheritDoc} |
|
32 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title() |
|
33 | + */ |
|
34 | + public function title(): string |
|
35 | + { |
|
36 | + return I18N::translate('Individual names accordion extender'); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * {@inheritDoc} |
|
41 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description() |
|
42 | - */ |
|
43 | - public function description(): string |
|
44 | - { |
|
45 | - return I18N::translate('Extends the names accordion of on an individual’s page.'); |
|
46 | - } |
|
39 | + /** |
|
40 | + * {@inheritDoc} |
|
41 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description() |
|
42 | + */ |
|
43 | + public function description(): string |
|
44 | + { |
|
45 | + return I18N::translate('Extends the names accordion of on an individual’s page.'); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * {@inheritDoc} |
|
50 | - * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface() |
|
51 | - */ |
|
52 | - public function hookInterface(): string |
|
53 | - { |
|
54 | - return NameAccordionExtenderInterface::class; |
|
55 | - } |
|
48 | + /** |
|
49 | + * {@inheritDoc} |
|
50 | + * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface() |
|
51 | + */ |
|
52 | + public function hookInterface(): string |
|
53 | + { |
|
54 | + return NameAccordionExtenderInterface::class; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * {@inheritDoc} |
|
59 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\NameAccordionExtenderInterface::accordionCard() |
|
60 | - */ |
|
61 | - public function accordionCard(Individual $individual): string |
|
62 | - { |
|
63 | - return $this->hooks() |
|
64 | - ->map(fn(NameAccordionExtenderInterface $hook) => $hook->accordionCard($individual)) |
|
65 | - ->implode(''); |
|
66 | - } |
|
57 | + /** |
|
58 | + * {@inheritDoc} |
|
59 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\NameAccordionExtenderInterface::accordionCard() |
|
60 | + */ |
|
61 | + public function accordionCard(Individual $individual): string |
|
62 | + { |
|
63 | + return $this->hooks() |
|
64 | + ->map(fn(NameAccordionExtenderInterface $hook) => $hook->accordionCard($individual)) |
|
65 | + ->implode(''); |
|
66 | + } |
|
67 | 67 | } |
@@ -29,38 +29,38 @@ |
||
29 | 29 | */ |
30 | 30 | class AdminConfigPage implements RequestHandlerInterface |
31 | 31 | { |
32 | - use ViewResponseTrait; |
|
32 | + use ViewResponseTrait; |
|
33 | 33 | |
34 | - private ?HooksModule $module; |
|
35 | - private HookService $hook_service; |
|
34 | + private ?HooksModule $module; |
|
35 | + private HookService $hook_service; |
|
36 | 36 | |
37 | - /** |
|
38 | - * Constructor for AdminConfigPage Request Handler |
|
39 | - * |
|
40 | - * @param ModuleService $module_service |
|
41 | - * @param HookService $hook_service |
|
42 | - */ |
|
43 | - public function __construct(ModuleService $module_service, HookService $hook_service) |
|
44 | - { |
|
45 | - $this->module = $module_service->findByInterface(HooksModule::class)->first(); |
|
46 | - $this->hook_service = $hook_service; |
|
47 | - } |
|
37 | + /** |
|
38 | + * Constructor for AdminConfigPage Request Handler |
|
39 | + * |
|
40 | + * @param ModuleService $module_service |
|
41 | + * @param HookService $hook_service |
|
42 | + */ |
|
43 | + public function __construct(ModuleService $module_service, HookService $hook_service) |
|
44 | + { |
|
45 | + $this->module = $module_service->findByInterface(HooksModule::class)->first(); |
|
46 | + $this->hook_service = $hook_service; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * {@inheritDoc} |
|
51 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
52 | - */ |
|
53 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
54 | - { |
|
55 | - $this->layout = 'layouts/administration'; |
|
49 | + /** |
|
50 | + * {@inheritDoc} |
|
51 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
52 | + */ |
|
53 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
54 | + { |
|
55 | + $this->layout = 'layouts/administration'; |
|
56 | 56 | |
57 | - if ($this->module === null) { |
|
58 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
59 | - } |
|
57 | + if ($this->module === null) { |
|
58 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
59 | + } |
|
60 | 60 | |
61 | - return $this->viewResponse($this->module->name() . '::admin/config', [ |
|
62 | - 'title' => $this->module->title(), |
|
63 | - 'hook_interfaces_list' => $this->hook_service->all(true) |
|
64 | - ]); |
|
65 | - } |
|
61 | + return $this->viewResponse($this->module->name() . '::admin/config', [ |
|
62 | + 'title' => $this->module->title(), |
|
63 | + 'hook_interfaces_list' => $this->hook_service->all(true) |
|
64 | + ]); |
|
65 | + } |
|
66 | 66 | } |
@@ -28,35 +28,35 @@ |
||
28 | 28 | */ |
29 | 29 | class AdminConfigPage implements RequestHandlerInterface |
30 | 30 | { |
31 | - use ViewResponseTrait; |
|
32 | - |
|
33 | - private ?MiscExtensionsModule $module; |
|
34 | - |
|
35 | - /** |
|
36 | - * Constructor for AdminConfigPage Request Handler |
|
37 | - * |
|
38 | - * @param ModuleService $module_service |
|
39 | - */ |
|
40 | - public function __construct(ModuleService $module_service) |
|
41 | - { |
|
42 | - $this->module = $module_service->findByInterface(MiscExtensionsModule::class)->first(); |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * {@inheritDoc} |
|
47 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
48 | - */ |
|
49 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
50 | - { |
|
51 | - $this->layout = 'layouts/administration'; |
|
52 | - |
|
53 | - if ($this->module === null) { |
|
54 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
55 | - } |
|
56 | - |
|
57 | - return $this->viewResponse($this->module->name() . '::admin/config', [ |
|
58 | - 'module' => $this->module, |
|
59 | - 'title' => $this->module->title() |
|
60 | - ]); |
|
61 | - } |
|
31 | + use ViewResponseTrait; |
|
32 | + |
|
33 | + private ?MiscExtensionsModule $module; |
|
34 | + |
|
35 | + /** |
|
36 | + * Constructor for AdminConfigPage Request Handler |
|
37 | + * |
|
38 | + * @param ModuleService $module_service |
|
39 | + */ |
|
40 | + public function __construct(ModuleService $module_service) |
|
41 | + { |
|
42 | + $this->module = $module_service->findByInterface(MiscExtensionsModule::class)->first(); |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * {@inheritDoc} |
|
47 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
48 | + */ |
|
49 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
50 | + { |
|
51 | + $this->layout = 'layouts/administration'; |
|
52 | + |
|
53 | + if ($this->module === null) { |
|
54 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
55 | + } |
|
56 | + |
|
57 | + return $this->viewResponse($this->module->name() . '::admin/config', [ |
|
58 | + 'module' => $this->module, |
|
59 | + 'title' => $this->module->title() |
|
60 | + ]); |
|
61 | + } |
|
62 | 62 | } |
@@ -26,51 +26,51 @@ |
||
26 | 26 | */ |
27 | 27 | class SosaIconHook implements RecordNameTextExtenderInterface |
28 | 28 | { |
29 | - private ModuleInterface $module; |
|
30 | - private SosaRecordsService $sosa_records_service; |
|
29 | + private ModuleInterface $module; |
|
30 | + private SosaRecordsService $sosa_records_service; |
|
31 | 31 | |
32 | - /** |
|
33 | - * Constructor for SosaIconHook |
|
34 | - * |
|
35 | - * @param ModuleInterface $module |
|
36 | - * @param SosaRecordsService $sosa_records_service |
|
37 | - */ |
|
38 | - public function __construct(ModuleInterface $module, SosaRecordsService $sosa_records_service) |
|
39 | - { |
|
40 | - $this->module = $module; |
|
41 | - $this->sosa_records_service = $sosa_records_service; |
|
42 | - } |
|
32 | + /** |
|
33 | + * Constructor for SosaIconHook |
|
34 | + * |
|
35 | + * @param ModuleInterface $module |
|
36 | + * @param SosaRecordsService $sosa_records_service |
|
37 | + */ |
|
38 | + public function __construct(ModuleInterface $module, SosaRecordsService $sosa_records_service) |
|
39 | + { |
|
40 | + $this->module = $module; |
|
41 | + $this->sosa_records_service = $sosa_records_service; |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * {@inheritDoc} |
|
46 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookInterface::module() |
|
47 | - */ |
|
48 | - public function module(): ModuleInterface |
|
49 | - { |
|
50 | - return $this->module; |
|
51 | - } |
|
44 | + /** |
|
45 | + * {@inheritDoc} |
|
46 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookInterface::module() |
|
47 | + */ |
|
48 | + public function module(): ModuleInterface |
|
49 | + { |
|
50 | + return $this->module; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * {@inheritDoc} |
|
55 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\RecordNameTextExtenderInterface::recordNamePrepend() |
|
56 | - */ |
|
57 | - public function recordNamePrepend(GedcomRecord $record, bool $use_long = false, string $size = ''): string |
|
58 | - { |
|
59 | - return ''; |
|
60 | - } |
|
53 | + /** |
|
54 | + * {@inheritDoc} |
|
55 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\RecordNameTextExtenderInterface::recordNamePrepend() |
|
56 | + */ |
|
57 | + public function recordNamePrepend(GedcomRecord $record, bool $use_long = false, string $size = ''): string |
|
58 | + { |
|
59 | + return ''; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * {@inheritDoc} |
|
64 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\RecordNameTextExtenderInterface::recordNameAppend() |
|
65 | - */ |
|
66 | - public function recordNameAppend(GedcomRecord $record, bool $use_long = false, string $size = ''): string |
|
67 | - { |
|
68 | - if ( |
|
69 | - $record instanceof Individual && |
|
70 | - $this->sosa_records_service->isSosa($record->tree(), Auth::user(), $record) |
|
71 | - ) { |
|
72 | - return view($this->module->name() . '::icons/sosa', [ 'size_style' => $size ]); |
|
73 | - } |
|
74 | - return ''; |
|
75 | - } |
|
62 | + /** |
|
63 | + * {@inheritDoc} |
|
64 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\RecordNameTextExtenderInterface::recordNameAppend() |
|
65 | + */ |
|
66 | + public function recordNameAppend(GedcomRecord $record, bool $use_long = false, string $size = ''): string |
|
67 | + { |
|
68 | + if ( |
|
69 | + $record instanceof Individual && |
|
70 | + $this->sosa_records_service->isSosa($record->tree(), Auth::user(), $record) |
|
71 | + ) { |
|
72 | + return view($this->module->name() . '::icons/sosa', [ 'size_style' => $size ]); |
|
73 | + } |
|
74 | + return ''; |
|
75 | + } |
|
76 | 76 | } |
@@ -21,79 +21,79 @@ |
||
21 | 21 | */ |
22 | 22 | class MissingAncestor |
23 | 23 | { |
24 | - /** |
|
25 | - * @var Individual $individual |
|
26 | - */ |
|
27 | - private $individual; |
|
24 | + /** |
|
25 | + * @var Individual $individual |
|
26 | + */ |
|
27 | + private $individual; |
|
28 | 28 | |
29 | - /** |
|
30 | - * @var int $sosa |
|
31 | - */ |
|
32 | - private $sosa; |
|
29 | + /** |
|
30 | + * @var int $sosa |
|
31 | + */ |
|
32 | + private $sosa; |
|
33 | 33 | |
34 | - /** |
|
35 | - * @var bool $missing_father |
|
36 | - */ |
|
37 | - private $missing_father; |
|
34 | + /** |
|
35 | + * @var bool $missing_father |
|
36 | + */ |
|
37 | + private $missing_father; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @var bool $missing_mother |
|
41 | - */ |
|
42 | - private $missing_mother; |
|
39 | + /** |
|
40 | + * @var bool $missing_mother |
|
41 | + */ |
|
42 | + private $missing_mother; |
|
43 | 43 | |
44 | - /** |
|
45 | - * Constructor for MissingAncestor data class |
|
46 | - * |
|
47 | - * @param Individual $ancestor |
|
48 | - * @param int $sosa |
|
49 | - * @param bool $missing_father |
|
50 | - * @param bool $missing_mother |
|
51 | - */ |
|
52 | - public function __construct(Individual $ancestor, int $sosa, bool $missing_father, bool $missing_mother) |
|
53 | - { |
|
54 | - $this->individual = $ancestor; |
|
55 | - $this->sosa = $sosa; |
|
56 | - $this->missing_father = $missing_father; |
|
57 | - $this->missing_mother = $missing_mother; |
|
58 | - } |
|
44 | + /** |
|
45 | + * Constructor for MissingAncestor data class |
|
46 | + * |
|
47 | + * @param Individual $ancestor |
|
48 | + * @param int $sosa |
|
49 | + * @param bool $missing_father |
|
50 | + * @param bool $missing_mother |
|
51 | + */ |
|
52 | + public function __construct(Individual $ancestor, int $sosa, bool $missing_father, bool $missing_mother) |
|
53 | + { |
|
54 | + $this->individual = $ancestor; |
|
55 | + $this->sosa = $sosa; |
|
56 | + $this->missing_father = $missing_father; |
|
57 | + $this->missing_mother = $missing_mother; |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * Reference individual of the row |
|
62 | - * |
|
63 | - * @return Individual |
|
64 | - */ |
|
65 | - public function individual(): Individual |
|
66 | - { |
|
67 | - return $this->individual; |
|
68 | - } |
|
60 | + /** |
|
61 | + * Reference individual of the row |
|
62 | + * |
|
63 | + * @return Individual |
|
64 | + */ |
|
65 | + public function individual(): Individual |
|
66 | + { |
|
67 | + return $this->individual; |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * Minimum sosa of the reference individual |
|
72 | - * |
|
73 | - * @return int |
|
74 | - */ |
|
75 | - public function sosa(): int |
|
76 | - { |
|
77 | - return $this->sosa; |
|
78 | - } |
|
70 | + /** |
|
71 | + * Minimum sosa of the reference individual |
|
72 | + * |
|
73 | + * @return int |
|
74 | + */ |
|
75 | + public function sosa(): int |
|
76 | + { |
|
77 | + return $this->sosa; |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * Indicate whether the reference individual does not have a father |
|
82 | - * |
|
83 | - * @return bool |
|
84 | - */ |
|
85 | - public function isFatherMissing(): bool |
|
86 | - { |
|
87 | - return $this->missing_father; |
|
88 | - } |
|
80 | + /** |
|
81 | + * Indicate whether the reference individual does not have a father |
|
82 | + * |
|
83 | + * @return bool |
|
84 | + */ |
|
85 | + public function isFatherMissing(): bool |
|
86 | + { |
|
87 | + return $this->missing_father; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * Indicate whether the reference individual does not have a mother |
|
92 | - * |
|
93 | - * @return bool |
|
94 | - */ |
|
95 | - public function isMotherMissing(): bool |
|
96 | - { |
|
97 | - return $this->missing_mother; |
|
98 | - } |
|
90 | + /** |
|
91 | + * Indicate whether the reference individual does not have a mother |
|
92 | + * |
|
93 | + * @return bool |
|
94 | + */ |
|
95 | + public function isMotherMissing(): bool |
|
96 | + { |
|
97 | + return $this->missing_mother; |
|
98 | + } |
|
99 | 99 | } |
@@ -24,143 +24,143 @@ |
||
24 | 24 | */ |
25 | 25 | class SosaCalculatorService |
26 | 26 | { |
27 | - /** |
|
28 | - * Maximium size for the temporary Sosa table |
|
29 | - * @var int TMP_SOSA_TABLE_LIMIT |
|
30 | - */ |
|
31 | - private const TMP_SOSA_TABLE_LIMIT = 1000; |
|
32 | - |
|
33 | - /** |
|
34 | - * @var SosaRecordsService $sosa_records_service |
|
35 | - */ |
|
36 | - private $sosa_records_service; |
|
37 | - |
|
38 | - /** |
|
39 | - * Reference user |
|
40 | - * @var UserInterface $user |
|
41 | - */ |
|
42 | - private $user; |
|
43 | - |
|
44 | - /** |
|
45 | - * Reference tree |
|
46 | - * @var Tree $tree |
|
47 | - */ |
|
48 | - private $tree; |
|
49 | - |
|
50 | - /** |
|
51 | - * Temporary Sosa table, used during construction |
|
52 | - * @var array<array<string,mixed>> $tmp_sosa_table |
|
53 | - */ |
|
54 | - private $tmp_sosa_table; |
|
55 | - |
|
56 | - /** |
|
57 | - * Maximum number of generations to calculate |
|
58 | - * @var int $max_generations |
|
59 | - */ |
|
60 | - private $max_generations; |
|
61 | - |
|
62 | - /** |
|
63 | - * Constructor for the Sosa Calculator |
|
64 | - * |
|
65 | - * @param SosaRecordsService $sosa_records_service |
|
66 | - * @param Tree $tree |
|
67 | - * @param UserInterface $user |
|
68 | - */ |
|
69 | - public function __construct(SosaRecordsService $sosa_records_service, Tree $tree, UserInterface $user) |
|
70 | - { |
|
71 | - $this->sosa_records_service = $sosa_records_service; |
|
72 | - $this->tree = $tree; |
|
73 | - $this->user = $user; |
|
74 | - $this->tmp_sosa_table = array(); |
|
75 | - $max_gen_setting = $tree->getUserPreference($user, 'MAJ_SOSA_MAX_GEN'); |
|
76 | - $this->max_generations = is_numeric($max_gen_setting) ? |
|
77 | - (int) $max_gen_setting : |
|
78 | - $this->sosa_records_service->maxSystemGenerations(); |
|
79 | - } |
|
80 | - |
|
81 | - /** |
|
82 | - * Compute all Sosa ancestors from the user's root individual. |
|
83 | - * |
|
84 | - * @return bool Result of the computation |
|
85 | - */ |
|
86 | - public function computeAll(): bool |
|
87 | - { |
|
88 | - $root_id = $this->tree->getUserPreference($this->user, 'MAJ_SOSA_ROOT_ID'); |
|
89 | - if (($indi = Registry::individualFactory()->make($root_id, $this->tree)) !== null) { |
|
90 | - $this->sosa_records_service->deleteAll($this->tree, $this->user); |
|
91 | - $this->addNode($indi, 1); |
|
92 | - $this->flushTmpSosaTable(true); |
|
93 | - return true; |
|
94 | - } |
|
95 | - return false; |
|
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * Compute all Sosa Ancestors from a specified Individual |
|
100 | - * |
|
101 | - * @param Individual $indi |
|
102 | - * @return bool |
|
103 | - */ |
|
104 | - public function computeFromIndividual(Individual $indi): bool |
|
105 | - { |
|
106 | - $current_sosas = $this->sosa_records_service->sosaNumbers($this->tree, $this->user, $indi); |
|
107 | - foreach ($current_sosas->keys() as $sosa) { |
|
108 | - $this->sosa_records_service->deleteAncestorsFrom($this->tree, $this->user, $sosa); |
|
109 | - $this->addNode($indi, $sosa); |
|
110 | - } |
|
111 | - $this->flushTmpSosaTable(true); |
|
112 | - return true; |
|
113 | - } |
|
114 | - |
|
115 | - /** |
|
116 | - * Recursive method to add individual to the Sosa table, and flush it regularly |
|
117 | - * |
|
118 | - * @param Individual $indi Individual to add |
|
119 | - * @param int $sosa Individual's sosa |
|
120 | - */ |
|
121 | - private function addNode(Individual $indi, int $sosa): void |
|
122 | - { |
|
123 | - $birth_year = $indi->getBirthDate()->gregorianYear(); |
|
124 | - $birth_year_est = $birth_year === 0 ? $indi->getEstimatedBirthDate()->gregorianYear() : $birth_year; |
|
125 | - |
|
126 | - $death_year = $indi->getDeathDate()->gregorianYear(); |
|
127 | - $death_year_est = $death_year === 0 ? $indi->getEstimatedDeathDate()->gregorianYear() : $death_year; |
|
128 | - |
|
129 | - $this->tmp_sosa_table[] = [ |
|
130 | - 'indi' => $indi->xref(), |
|
131 | - 'sosa' => $sosa, |
|
132 | - 'birth_year' => $birth_year === 0 ? null : $birth_year, |
|
133 | - 'birth_year_est' => $birth_year_est === 0 ? null : $birth_year_est, |
|
134 | - 'death_year' => $death_year === 0 ? null : $death_year, |
|
135 | - 'death_year_est' => $death_year_est === 0 ? null : $death_year_est |
|
136 | - ]; |
|
137 | - |
|
138 | - $this->flushTmpSosaTable(); |
|
139 | - |
|
140 | - if ( |
|
141 | - ($fam = $indi->childFamilies()->first()) !== null |
|
142 | - && $this->sosa_records_service->generation($sosa) < $this->max_generations |
|
143 | - ) { |
|
144 | - /** @var \Fisharebest\Webtrees\Family $fam */ |
|
145 | - if (($husb = $fam->husband()) !== null) { |
|
146 | - $this->addNode($husb, 2 * $sosa); |
|
147 | - } |
|
148 | - if (($wife = $fam->wife()) !== null) { |
|
149 | - $this->addNode($wife, 2 * $sosa + 1); |
|
150 | - } |
|
151 | - } |
|
152 | - } |
|
153 | - |
|
154 | - /** |
|
155 | - * Write sosas in the table, if the number of items is superior to the limit, or if forced. |
|
156 | - * |
|
157 | - * @param bool $force Should the flush be forced |
|
158 | - */ |
|
159 | - private function flushTmpSosaTable($force = false): void |
|
160 | - { |
|
161 | - if ($force || count($this->tmp_sosa_table) >= self::TMP_SOSA_TABLE_LIMIT) { |
|
162 | - $this->sosa_records_service->insertOrUpdate($this->tree, $this->user, $this->tmp_sosa_table); |
|
163 | - $this->tmp_sosa_table = array(); |
|
164 | - } |
|
165 | - } |
|
27 | + /** |
|
28 | + * Maximium size for the temporary Sosa table |
|
29 | + * @var int TMP_SOSA_TABLE_LIMIT |
|
30 | + */ |
|
31 | + private const TMP_SOSA_TABLE_LIMIT = 1000; |
|
32 | + |
|
33 | + /** |
|
34 | + * @var SosaRecordsService $sosa_records_service |
|
35 | + */ |
|
36 | + private $sosa_records_service; |
|
37 | + |
|
38 | + /** |
|
39 | + * Reference user |
|
40 | + * @var UserInterface $user |
|
41 | + */ |
|
42 | + private $user; |
|
43 | + |
|
44 | + /** |
|
45 | + * Reference tree |
|
46 | + * @var Tree $tree |
|
47 | + */ |
|
48 | + private $tree; |
|
49 | + |
|
50 | + /** |
|
51 | + * Temporary Sosa table, used during construction |
|
52 | + * @var array<array<string,mixed>> $tmp_sosa_table |
|
53 | + */ |
|
54 | + private $tmp_sosa_table; |
|
55 | + |
|
56 | + /** |
|
57 | + * Maximum number of generations to calculate |
|
58 | + * @var int $max_generations |
|
59 | + */ |
|
60 | + private $max_generations; |
|
61 | + |
|
62 | + /** |
|
63 | + * Constructor for the Sosa Calculator |
|
64 | + * |
|
65 | + * @param SosaRecordsService $sosa_records_service |
|
66 | + * @param Tree $tree |
|
67 | + * @param UserInterface $user |
|
68 | + */ |
|
69 | + public function __construct(SosaRecordsService $sosa_records_service, Tree $tree, UserInterface $user) |
|
70 | + { |
|
71 | + $this->sosa_records_service = $sosa_records_service; |
|
72 | + $this->tree = $tree; |
|
73 | + $this->user = $user; |
|
74 | + $this->tmp_sosa_table = array(); |
|
75 | + $max_gen_setting = $tree->getUserPreference($user, 'MAJ_SOSA_MAX_GEN'); |
|
76 | + $this->max_generations = is_numeric($max_gen_setting) ? |
|
77 | + (int) $max_gen_setting : |
|
78 | + $this->sosa_records_service->maxSystemGenerations(); |
|
79 | + } |
|
80 | + |
|
81 | + /** |
|
82 | + * Compute all Sosa ancestors from the user's root individual. |
|
83 | + * |
|
84 | + * @return bool Result of the computation |
|
85 | + */ |
|
86 | + public function computeAll(): bool |
|
87 | + { |
|
88 | + $root_id = $this->tree->getUserPreference($this->user, 'MAJ_SOSA_ROOT_ID'); |
|
89 | + if (($indi = Registry::individualFactory()->make($root_id, $this->tree)) !== null) { |
|
90 | + $this->sosa_records_service->deleteAll($this->tree, $this->user); |
|
91 | + $this->addNode($indi, 1); |
|
92 | + $this->flushTmpSosaTable(true); |
|
93 | + return true; |
|
94 | + } |
|
95 | + return false; |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * Compute all Sosa Ancestors from a specified Individual |
|
100 | + * |
|
101 | + * @param Individual $indi |
|
102 | + * @return bool |
|
103 | + */ |
|
104 | + public function computeFromIndividual(Individual $indi): bool |
|
105 | + { |
|
106 | + $current_sosas = $this->sosa_records_service->sosaNumbers($this->tree, $this->user, $indi); |
|
107 | + foreach ($current_sosas->keys() as $sosa) { |
|
108 | + $this->sosa_records_service->deleteAncestorsFrom($this->tree, $this->user, $sosa); |
|
109 | + $this->addNode($indi, $sosa); |
|
110 | + } |
|
111 | + $this->flushTmpSosaTable(true); |
|
112 | + return true; |
|
113 | + } |
|
114 | + |
|
115 | + /** |
|
116 | + * Recursive method to add individual to the Sosa table, and flush it regularly |
|
117 | + * |
|
118 | + * @param Individual $indi Individual to add |
|
119 | + * @param int $sosa Individual's sosa |
|
120 | + */ |
|
121 | + private function addNode(Individual $indi, int $sosa): void |
|
122 | + { |
|
123 | + $birth_year = $indi->getBirthDate()->gregorianYear(); |
|
124 | + $birth_year_est = $birth_year === 0 ? $indi->getEstimatedBirthDate()->gregorianYear() : $birth_year; |
|
125 | + |
|
126 | + $death_year = $indi->getDeathDate()->gregorianYear(); |
|
127 | + $death_year_est = $death_year === 0 ? $indi->getEstimatedDeathDate()->gregorianYear() : $death_year; |
|
128 | + |
|
129 | + $this->tmp_sosa_table[] = [ |
|
130 | + 'indi' => $indi->xref(), |
|
131 | + 'sosa' => $sosa, |
|
132 | + 'birth_year' => $birth_year === 0 ? null : $birth_year, |
|
133 | + 'birth_year_est' => $birth_year_est === 0 ? null : $birth_year_est, |
|
134 | + 'death_year' => $death_year === 0 ? null : $death_year, |
|
135 | + 'death_year_est' => $death_year_est === 0 ? null : $death_year_est |
|
136 | + ]; |
|
137 | + |
|
138 | + $this->flushTmpSosaTable(); |
|
139 | + |
|
140 | + if ( |
|
141 | + ($fam = $indi->childFamilies()->first()) !== null |
|
142 | + && $this->sosa_records_service->generation($sosa) < $this->max_generations |
|
143 | + ) { |
|
144 | + /** @var \Fisharebest\Webtrees\Family $fam */ |
|
145 | + if (($husb = $fam->husband()) !== null) { |
|
146 | + $this->addNode($husb, 2 * $sosa); |
|
147 | + } |
|
148 | + if (($wife = $fam->wife()) !== null) { |
|
149 | + $this->addNode($wife, 2 * $sosa + 1); |
|
150 | + } |
|
151 | + } |
|
152 | + } |
|
153 | + |
|
154 | + /** |
|
155 | + * Write sosas in the table, if the number of items is superior to the limit, or if forced. |
|
156 | + * |
|
157 | + * @param bool $force Should the flush be forced |
|
158 | + */ |
|
159 | + private function flushTmpSosaTable($force = false): void |
|
160 | + { |
|
161 | + if ($force || count($this->tmp_sosa_table) >= self::TMP_SOSA_TABLE_LIMIT) { |
|
162 | + $this->sosa_records_service->insertOrUpdate($this->tree, $this->user, $this->tmp_sosa_table); |
|
163 | + $this->tmp_sosa_table = array(); |
|
164 | + } |
|
165 | + } |
|
166 | 166 | } |
@@ -31,101 +31,101 @@ |
||
31 | 31 | */ |
32 | 32 | class SosaByGenerationGeoAnalysis implements GeoAnalysisInterface |
33 | 33 | { |
34 | - private SosaRecordsService $records_service; |
|
35 | - |
|
36 | - /** |
|
37 | - * Constructor for SosaByGenerationGeoAnalysis |
|
38 | - * |
|
39 | - * @param SosaRecordsService $records_service |
|
40 | - */ |
|
41 | - public function __construct(SosaRecordsService $records_service) |
|
42 | - { |
|
43 | - $this->records_service = $records_service; |
|
44 | - } |
|
45 | - |
|
46 | - /** |
|
47 | - * {@inheritDoc} |
|
48 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::title() |
|
49 | - */ |
|
50 | - public function title(): string |
|
51 | - { |
|
52 | - return I18N::translate('Sosa ancestors places by generation'); |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * {@inheritDoc} |
|
57 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::itemsDescription() |
|
58 | - */ |
|
59 | - public function itemsDescription(): callable |
|
60 | - { |
|
61 | - return fn(int $count): string => I18N::plural('ancestor', 'ancestors', $count); |
|
62 | - } |
|
63 | - |
|
64 | - /** |
|
65 | - * {@inheritDoc} |
|
66 | - * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::results() |
|
67 | - */ |
|
68 | - public function results(Tree $tree, int $depth): GeoAnalysisResults |
|
69 | - { |
|
70 | - $results = new GeoAnalysisResults(); |
|
71 | - |
|
72 | - $unique_ancestors = $this->records_service |
|
73 | - ->listAncestors($tree, Auth::user()) |
|
74 | - ->uniqueStrict(fn(stdClass $item): string => $item->majs_i_id); |
|
75 | - |
|
76 | - foreach ($unique_ancestors as $item) { |
|
77 | - $ancestor = Registry::individualFactory()->make($item->majs_i_id, $tree); |
|
78 | - if ($ancestor === null || !$ancestor->canShow()) { |
|
79 | - continue; |
|
80 | - } |
|
81 | - $generation = $this->records_service->generation((int) $item->majs_sosa); |
|
82 | - $significantplace = new GeoAnalysisPlace($tree, null, $depth); |
|
83 | - foreach ($this->significantPlaces($ancestor) as $place) { |
|
84 | - $significantplace = new GeoAnalysisPlace($tree, $place, $depth, true); |
|
85 | - if ($significantplace->isKnown()) { |
|
86 | - break; |
|
87 | - } |
|
88 | - } |
|
89 | - $results->addPlace($significantplace); |
|
90 | - $results->addPlaceInCategory( |
|
91 | - I18N::translate('Generation %s', I18N::number($generation)), |
|
92 | - $generation, |
|
93 | - $significantplace |
|
94 | - ); |
|
95 | - } |
|
96 | - |
|
97 | - return $results; |
|
98 | - } |
|
99 | - |
|
100 | - /** |
|
101 | - * Returns significant places in order of priority for an individual |
|
102 | - * |
|
103 | - * @param Individual $individual |
|
104 | - * @return Generator<\Fisharebest\Webtrees\Place> |
|
105 | - */ |
|
106 | - protected function significantPlaces(Individual $individual): Generator |
|
107 | - { |
|
108 | - yield $individual->getBirthPlace(); |
|
109 | - |
|
110 | - /** @var \Fisharebest\Webtrees\Fact $fact */ |
|
111 | - foreach ($individual->facts(['RESI']) as $fact) { |
|
112 | - yield $fact->place(); |
|
113 | - } |
|
114 | - |
|
115 | - yield $individual->getDeathPlace(); |
|
116 | - |
|
117 | - /** @var \Fisharebest\Webtrees\Family $family */ |
|
118 | - foreach ($individual->childFamilies() as $family) { |
|
119 | - foreach ($family->facts(['RESI']) as $fact) { |
|
120 | - yield $fact->place(); |
|
121 | - } |
|
122 | - } |
|
123 | - |
|
124 | - /** @var \Fisharebest\Webtrees\Family $family */ |
|
125 | - foreach ($individual->spouseFamilies() as $family) { |
|
126 | - foreach ($family->facts(['RESI']) as $fact) { |
|
127 | - yield $fact->place(); |
|
128 | - } |
|
129 | - } |
|
130 | - } |
|
34 | + private SosaRecordsService $records_service; |
|
35 | + |
|
36 | + /** |
|
37 | + * Constructor for SosaByGenerationGeoAnalysis |
|
38 | + * |
|
39 | + * @param SosaRecordsService $records_service |
|
40 | + */ |
|
41 | + public function __construct(SosaRecordsService $records_service) |
|
42 | + { |
|
43 | + $this->records_service = $records_service; |
|
44 | + } |
|
45 | + |
|
46 | + /** |
|
47 | + * {@inheritDoc} |
|
48 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::title() |
|
49 | + */ |
|
50 | + public function title(): string |
|
51 | + { |
|
52 | + return I18N::translate('Sosa ancestors places by generation'); |
|
53 | + } |
|
54 | + |
|
55 | + /** |
|
56 | + * {@inheritDoc} |
|
57 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::itemsDescription() |
|
58 | + */ |
|
59 | + public function itemsDescription(): callable |
|
60 | + { |
|
61 | + return fn(int $count): string => I18N::plural('ancestor', 'ancestors', $count); |
|
62 | + } |
|
63 | + |
|
64 | + /** |
|
65 | + * {@inheritDoc} |
|
66 | + * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::results() |
|
67 | + */ |
|
68 | + public function results(Tree $tree, int $depth): GeoAnalysisResults |
|
69 | + { |
|
70 | + $results = new GeoAnalysisResults(); |
|
71 | + |
|
72 | + $unique_ancestors = $this->records_service |
|
73 | + ->listAncestors($tree, Auth::user()) |
|
74 | + ->uniqueStrict(fn(stdClass $item): string => $item->majs_i_id); |
|
75 | + |
|
76 | + foreach ($unique_ancestors as $item) { |
|
77 | + $ancestor = Registry::individualFactory()->make($item->majs_i_id, $tree); |
|
78 | + if ($ancestor === null || !$ancestor->canShow()) { |
|
79 | + continue; |
|
80 | + } |
|
81 | + $generation = $this->records_service->generation((int) $item->majs_sosa); |
|
82 | + $significantplace = new GeoAnalysisPlace($tree, null, $depth); |
|
83 | + foreach ($this->significantPlaces($ancestor) as $place) { |
|
84 | + $significantplace = new GeoAnalysisPlace($tree, $place, $depth, true); |
|
85 | + if ($significantplace->isKnown()) { |
|
86 | + break; |
|
87 | + } |
|
88 | + } |
|
89 | + $results->addPlace($significantplace); |
|
90 | + $results->addPlaceInCategory( |
|
91 | + I18N::translate('Generation %s', I18N::number($generation)), |
|
92 | + $generation, |
|
93 | + $significantplace |
|
94 | + ); |
|
95 | + } |
|
96 | + |
|
97 | + return $results; |
|
98 | + } |
|
99 | + |
|
100 | + /** |
|
101 | + * Returns significant places in order of priority for an individual |
|
102 | + * |
|
103 | + * @param Individual $individual |
|
104 | + * @return Generator<\Fisharebest\Webtrees\Place> |
|
105 | + */ |
|
106 | + protected function significantPlaces(Individual $individual): Generator |
|
107 | + { |
|
108 | + yield $individual->getBirthPlace(); |
|
109 | + |
|
110 | + /** @var \Fisharebest\Webtrees\Fact $fact */ |
|
111 | + foreach ($individual->facts(['RESI']) as $fact) { |
|
112 | + yield $fact->place(); |
|
113 | + } |
|
114 | + |
|
115 | + yield $individual->getDeathPlace(); |
|
116 | + |
|
117 | + /** @var \Fisharebest\Webtrees\Family $family */ |
|
118 | + foreach ($individual->childFamilies() as $family) { |
|
119 | + foreach ($family->facts(['RESI']) as $fact) { |
|
120 | + yield $fact->place(); |
|
121 | + } |
|
122 | + } |
|
123 | + |
|
124 | + /** @var \Fisharebest\Webtrees\Family $family */ |
|
125 | + foreach ($individual->spouseFamilies() as $family) { |
|
126 | + foreach ($family->facts(['RESI']) as $fact) { |
|
127 | + yield $fact->place(); |
|
128 | + } |
|
129 | + } |
|
130 | + } |
|
131 | 131 | } |