@@ -19,10 +19,10 @@ |
||
19 | 19 | */ |
20 | 20 | interface ModulePlaceMapperProviderInterface |
21 | 21 | { |
22 | - /** |
|
23 | - * List place mappers provided by the module as an array. |
|
24 | - * |
|
25 | - * @return string[] List of place mappers |
|
26 | - */ |
|
27 | - public function listPlaceMappers(): array; |
|
22 | + /** |
|
23 | + * List place mappers provided by the module as an array. |
|
24 | + * |
|
25 | + * @return string[] List of place mappers |
|
26 | + */ |
|
27 | + public function listPlaceMappers(): array; |
|
28 | 28 | } |
@@ -22,26 +22,26 @@ |
||
22 | 22 | */ |
23 | 23 | interface GeoAnalysisInterface |
24 | 24 | { |
25 | - /** |
|
26 | - * Get the geographical dispersion analysis title |
|
27 | - * |
|
28 | - * @return string |
|
29 | - */ |
|
30 | - public function title(): string; |
|
25 | + /** |
|
26 | + * Get the geographical dispersion analysis title |
|
27 | + * |
|
28 | + * @return string |
|
29 | + */ |
|
30 | + public function title(): string; |
|
31 | 31 | |
32 | - /** |
|
33 | - * Gets the function to translate |
|
34 | - * |
|
35 | - * @return callable(int $count): string |
|
36 | - */ |
|
37 | - public function itemsDescription(): callable; |
|
32 | + /** |
|
33 | + * Gets the function to translate |
|
34 | + * |
|
35 | + * @return callable(int $count): string |
|
36 | + */ |
|
37 | + public function itemsDescription(): callable; |
|
38 | 38 | |
39 | - /** |
|
40 | - * Get the results of the geographical dispersion analysis |
|
41 | - * |
|
42 | - * @param Tree $tree |
|
43 | - * @param int $depth |
|
44 | - * @return GeoAnalysisResults |
|
45 | - */ |
|
46 | - public function results(Tree $tree, int $depth): GeoAnalysisResults; |
|
39 | + /** |
|
40 | + * Get the results of the geographical dispersion analysis |
|
41 | + * |
|
42 | + * @param Tree $tree |
|
43 | + * @param int $depth |
|
44 | + * @return GeoAnalysisResults |
|
45 | + */ |
|
46 | + public function results(Tree $tree, int $depth): GeoAnalysisResults; |
|
47 | 47 | } |
@@ -19,24 +19,24 @@ |
||
19 | 19 | */ |
20 | 20 | interface MapDefinitionInterface |
21 | 21 | { |
22 | - /** |
|
23 | - * Get the map ID |
|
24 | - * |
|
25 | - * @return string |
|
26 | - */ |
|
27 | - public function id(): string; |
|
22 | + /** |
|
23 | + * Get the map ID |
|
24 | + * |
|
25 | + * @return string |
|
26 | + */ |
|
27 | + public function id(): string; |
|
28 | 28 | |
29 | - /** |
|
30 | - * Get the map title |
|
31 | - * |
|
32 | - * @return string |
|
33 | - */ |
|
34 | - public function title(): string; |
|
29 | + /** |
|
30 | + * Get the map title |
|
31 | + * |
|
32 | + * @return string |
|
33 | + */ |
|
34 | + public function title(): string; |
|
35 | 35 | |
36 | - /** |
|
37 | - * Get the features in the map |
|
38 | - * |
|
39 | - * @return \Brick\Geo\IO\GeoJSON\Feature[] |
|
40 | - */ |
|
41 | - public function features(): array; |
|
36 | + /** |
|
37 | + * Get the features in the map |
|
38 | + * |
|
39 | + * @return \Brick\Geo\IO\GeoJSON\Feature[] |
|
40 | + */ |
|
41 | + public function features(): array; |
|
42 | 42 | } |
@@ -19,26 +19,26 @@ |
||
19 | 19 | */ |
20 | 20 | interface MapViewConfigInterface |
21 | 21 | { |
22 | - /** |
|
23 | - * Get the feature property to be used for mapping the map feature with the analysis results |
|
24 | - * |
|
25 | - * @return string |
|
26 | - */ |
|
27 | - public function mapMappingProperty(): string; |
|
22 | + /** |
|
23 | + * Get the feature property to be used for mapping the map feature with the analysis results |
|
24 | + * |
|
25 | + * @return string |
|
26 | + */ |
|
27 | + public function mapMappingProperty(): string; |
|
28 | 28 | |
29 | - /** |
|
30 | - * Get the config of the mapper associated with the map view |
|
31 | - * |
|
32 | - * @return PlaceMapperConfigInterface |
|
33 | - */ |
|
34 | - public function mapperConfig(): PlaceMapperConfigInterface; |
|
29 | + /** |
|
30 | + * Get the config of the mapper associated with the map view |
|
31 | + * |
|
32 | + * @return PlaceMapperConfigInterface |
|
33 | + */ |
|
34 | + public function mapperConfig(): PlaceMapperConfigInterface; |
|
35 | 35 | |
36 | - /** |
|
37 | - * Get a MapViewConfigInterface object with the new properties |
|
38 | - * |
|
39 | - * @param string $mapping_property |
|
40 | - * @param PlaceMapperConfigInterface $mapper_config |
|
41 | - * @return static |
|
42 | - */ |
|
43 | - public function with(string $mapping_property, PlaceMapperConfigInterface $mapper_config): self; |
|
36 | + /** |
|
37 | + * Get a MapViewConfigInterface object with the new properties |
|
38 | + * |
|
39 | + * @param string $mapping_property |
|
40 | + * @param PlaceMapperConfigInterface $mapper_config |
|
41 | + * @return static |
|
42 | + */ |
|
43 | + public function with(string $mapping_property, PlaceMapperConfigInterface $mapper_config): self; |
|
44 | 44 | } |
@@ -22,54 +22,54 @@ |
||
22 | 22 | */ |
23 | 23 | interface PlaceMapperInterface |
24 | 24 | { |
25 | - /** |
|
26 | - * Get the Place mapper title |
|
27 | - * |
|
28 | - * @return string |
|
29 | - */ |
|
30 | - public function title(): string; |
|
25 | + /** |
|
26 | + * Get the Place mapper title |
|
27 | + * |
|
28 | + * @return string |
|
29 | + */ |
|
30 | + public function title(): string; |
|
31 | 31 | |
32 | - /** |
|
33 | - * Boot the Place mapper |
|
34 | - */ |
|
35 | - public function boot(): void; |
|
32 | + /** |
|
33 | + * Boot the Place mapper |
|
34 | + */ |
|
35 | + public function boot(): void; |
|
36 | 36 | |
37 | - /** |
|
38 | - * Get the configuration associated to the mapper |
|
39 | - * |
|
40 | - * @return PlaceMapperConfigInterface |
|
41 | - */ |
|
42 | - public function config(): PlaceMapperConfigInterface; |
|
37 | + /** |
|
38 | + * Get the configuration associated to the mapper |
|
39 | + * |
|
40 | + * @return PlaceMapperConfigInterface |
|
41 | + */ |
|
42 | + public function config(): PlaceMapperConfigInterface; |
|
43 | 43 | |
44 | - /** |
|
45 | - * Set the configured associated to the mapper |
|
46 | - * |
|
47 | - * @param PlaceMapperConfigInterface $config |
|
48 | - */ |
|
49 | - public function setConfig(PlaceMapperConfigInterface $config): void; |
|
44 | + /** |
|
45 | + * Set the configured associated to the mapper |
|
46 | + * |
|
47 | + * @param PlaceMapperConfigInterface $config |
|
48 | + */ |
|
49 | + public function setConfig(PlaceMapperConfigInterface $config): void; |
|
50 | 50 | |
51 | - /** |
|
52 | - * Get the data associated to the mapper, for a specific key |
|
53 | - * |
|
54 | - * @param string $key |
|
55 | - * @return null|mixed |
|
56 | - */ |
|
57 | - public function data(string $key); |
|
51 | + /** |
|
52 | + * Get the data associated to the mapper, for a specific key |
|
53 | + * |
|
54 | + * @param string $key |
|
55 | + * @return null|mixed |
|
56 | + */ |
|
57 | + public function data(string $key); |
|
58 | 58 | |
59 | - /** |
|
60 | - * Set the data associated to the mapper, for a specific key |
|
61 | - * |
|
62 | - * @param string $key |
|
63 | - * @param mixed $data |
|
64 | - */ |
|
65 | - public function setData(string $key, $data): void; |
|
59 | + /** |
|
60 | + * Set the data associated to the mapper, for a specific key |
|
61 | + * |
|
62 | + * @param string $key |
|
63 | + * @param mixed $data |
|
64 | + */ |
|
65 | + public function setData(string $key, $data): void; |
|
66 | 66 | |
67 | - /** |
|
68 | - * Return the property value of the feature identifying a place in a GeoJson map. |
|
69 | - * |
|
70 | - * @param Place $place |
|
71 | - * @param string $feature_property |
|
72 | - * @return string|NULL |
|
73 | - */ |
|
74 | - public function map(Place $place, string $feature_property): ?string; |
|
67 | + /** |
|
68 | + * Return the property value of the feature identifying a place in a GeoJson map. |
|
69 | + * |
|
70 | + * @param Place $place |
|
71 | + * @param string $feature_property |
|
72 | + * @return string|NULL |
|
73 | + */ |
|
74 | + public function map(Place $place, string $feature_property): ?string; |
|
75 | 75 | } |
@@ -24,45 +24,45 @@ |
||
24 | 24 | */ |
25 | 25 | interface PlaceMapperConfigInterface extends JsonSerializable |
26 | 26 | { |
27 | - /** |
|
28 | - * Deserialise the mapper configuration from a string or an array |
|
29 | - * |
|
30 | - * @param mixed $config |
|
31 | - * @return $this |
|
32 | - */ |
|
33 | - public function jsonDeserialize($config): self; |
|
27 | + /** |
|
28 | + * Deserialise the mapper configuration from a string or an array |
|
29 | + * |
|
30 | + * @param mixed $config |
|
31 | + * @return $this |
|
32 | + */ |
|
33 | + public function jsonDeserialize($config): self; |
|
34 | 34 | |
35 | - /** |
|
36 | - * Check if the configuration contains a specific key |
|
37 | - * |
|
38 | - * @param string $key |
|
39 | - * @return bool |
|
40 | - */ |
|
41 | - public function has(string $key): bool; |
|
35 | + /** |
|
36 | + * Check if the configuration contains a specific key |
|
37 | + * |
|
38 | + * @param string $key |
|
39 | + * @return bool |
|
40 | + */ |
|
41 | + public function has(string $key): bool; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Return the configuration associated with a key, or a default value if none found. |
|
45 | - * |
|
46 | - * @param string $key |
|
47 | - * @param mixed|null $default |
|
48 | - * @return mixed|null |
|
49 | - */ |
|
50 | - public function get(string $key, $default = null); |
|
43 | + /** |
|
44 | + * Return the configuration associated with a key, or a default value if none found. |
|
45 | + * |
|
46 | + * @param string $key |
|
47 | + * @param mixed|null $default |
|
48 | + * @return mixed|null |
|
49 | + */ |
|
50 | + public function get(string $key, $default = null); |
|
51 | 51 | |
52 | - /** |
|
53 | - * Return the content of the mapper configuration section of the config page |
|
54 | - * |
|
55 | - * @param ModuleInterface $module |
|
56 | - * @param Tree $tree |
|
57 | - * @return string |
|
58 | - */ |
|
59 | - public function configContent(ModuleInterface $module, Tree $tree): string; |
|
52 | + /** |
|
53 | + * Return the content of the mapper configuration section of the config page |
|
54 | + * |
|
55 | + * @param ModuleInterface $module |
|
56 | + * @param Tree $tree |
|
57 | + * @return string |
|
58 | + */ |
|
59 | + public function configContent(ModuleInterface $module, Tree $tree): string; |
|
60 | 60 | |
61 | - /** |
|
62 | - * Return a PlaceMapperConfigInterface object updated according to its mapper configuration rules |
|
63 | - * |
|
64 | - * @param ServerRequestInterface $request |
|
65 | - * @return static |
|
66 | - */ |
|
67 | - public function withConfigUpdate(ServerRequestInterface $request): self; |
|
61 | + /** |
|
62 | + * Return a PlaceMapperConfigInterface object updated according to its mapper configuration rules |
|
63 | + * |
|
64 | + * @param ServerRequestInterface $request |
|
65 | + * @return static |
|
66 | + */ |
|
67 | + public function withConfigUpdate(ServerRequestInterface $request): self; |
|
68 | 68 | } |
@@ -19,25 +19,25 @@ |
||
19 | 19 | */ |
20 | 20 | interface TaskInterface |
21 | 21 | { |
22 | - /** |
|
23 | - * Display name of the task |
|
24 | - * |
|
25 | - * @return string |
|
26 | - */ |
|
27 | - public function name(): string; |
|
22 | + /** |
|
23 | + * Display name of the task |
|
24 | + * |
|
25 | + * @return string |
|
26 | + */ |
|
27 | + public function name(): string; |
|
28 | 28 | |
29 | - /** |
|
30 | - * Return the default frequency for the execution of the task, in minutes. |
|
31 | - * |
|
32 | - * @return int Frequency for the execution of the task |
|
33 | - */ |
|
34 | - public function defaultFrequency(): int; |
|
29 | + /** |
|
30 | + * Return the default frequency for the execution of the task, in minutes. |
|
31 | + * |
|
32 | + * @return int Frequency for the execution of the task |
|
33 | + */ |
|
34 | + public function defaultFrequency(): int; |
|
35 | 35 | |
36 | - /** |
|
37 | - * Run the task's actions, and return whether the execution has been successful. |
|
38 | - * |
|
39 | - * @param TaskSchedule $task_schedule |
|
40 | - * @return bool Has the execution been a success |
|
41 | - */ |
|
42 | - public function run(TaskSchedule $task_schedule): bool; |
|
36 | + /** |
|
37 | + * Run the task's actions, and return whether the execution has been successful. |
|
38 | + * |
|
39 | + * @param TaskSchedule $task_schedule |
|
40 | + * @return bool Has the execution been a success |
|
41 | + */ |
|
42 | + public function run(TaskSchedule $task_schedule): bool; |
|
43 | 43 | } |
@@ -75,16 +75,16 @@ |
||
75 | 75 | |
76 | 76 | $initial = mb_substr($surname, 0, 1); |
77 | 77 | $initials_list = collect($this->indilist_module->surnameAlpha($tree, false, false, I18N::locale())) |
78 | - ->reject(function (int $count, string $initial): bool { |
|
78 | + ->reject(function(int $count, string $initial): bool { |
|
79 | 79 | |
80 | 80 | return $initial === '@' || $initial === ','; |
81 | 81 | }); |
82 | 82 | |
83 | - $title = I18N::translate('Patronymic Lineages') . ' — ' . $surname; |
|
83 | + $title = I18N::translate('Patronymic Lineages').' — '.$surname; |
|
84 | 84 | |
85 | 85 | $lineages = app()->make(LineageBuilder::class, ['surname' => $surname])->buildLineages(); |
86 | 86 | |
87 | - return $this->viewResponse($this->module->name() . '::lineages-page', [ |
|
87 | + return $this->viewResponse($this->module->name().'::lineages-page', [ |
|
88 | 88 | 'title' => $title, |
89 | 89 | 'module' => $this->module, |
90 | 90 | 'tree' => $tree, |
@@ -32,66 +32,66 @@ |
||
32 | 32 | */ |
33 | 33 | class LineagesPage implements RequestHandlerInterface |
34 | 34 | { |
35 | - use ViewResponseTrait; |
|
35 | + use ViewResponseTrait; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @var PatronymicLineageModule|null $module |
|
39 | - */ |
|
40 | - private $module; |
|
37 | + /** |
|
38 | + * @var PatronymicLineageModule|null $module |
|
39 | + */ |
|
40 | + private $module; |
|
41 | 41 | |
42 | - /** |
|
43 | - * @var IndividualListModule|null $indilist_module |
|
44 | - */ |
|
45 | - private $indilist_module; |
|
42 | + /** |
|
43 | + * @var IndividualListModule|null $indilist_module |
|
44 | + */ |
|
45 | + private $indilist_module; |
|
46 | 46 | |
47 | - /** |
|
48 | - * Constructor for LineagesPage Request handler |
|
49 | - * |
|
50 | - * @param ModuleService $module_service |
|
51 | - */ |
|
52 | - public function __construct(ModuleService $module_service) |
|
53 | - { |
|
54 | - $this->module = $module_service->findByInterface(PatronymicLineageModule::class)->first(); |
|
55 | - $this->indilist_module = $module_service->findByInterface(IndividualListModule::class)->first(); |
|
56 | - } |
|
47 | + /** |
|
48 | + * Constructor for LineagesPage Request handler |
|
49 | + * |
|
50 | + * @param ModuleService $module_service |
|
51 | + */ |
|
52 | + public function __construct(ModuleService $module_service) |
|
53 | + { |
|
54 | + $this->module = $module_service->findByInterface(PatronymicLineageModule::class)->first(); |
|
55 | + $this->indilist_module = $module_service->findByInterface(IndividualListModule::class)->first(); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * {@inheritDoc} |
|
60 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
61 | - */ |
|
62 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
63 | - { |
|
64 | - if ($this->module === null) { |
|
65 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
66 | - } |
|
58 | + /** |
|
59 | + * {@inheritDoc} |
|
60 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
61 | + */ |
|
62 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
63 | + { |
|
64 | + if ($this->module === null) { |
|
65 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
66 | + } |
|
67 | 67 | |
68 | - if ($this->indilist_module === null) { |
|
69 | - throw new HttpNotFoundException(I18N::translate('There is no module to handle individual lists.')); |
|
70 | - } |
|
68 | + if ($this->indilist_module === null) { |
|
69 | + throw new HttpNotFoundException(I18N::translate('There is no module to handle individual lists.')); |
|
70 | + } |
|
71 | 71 | |
72 | - $tree = Validator::attributes($request)->tree(); |
|
73 | - $surname = Validator::attributes($request)->string('surname', ''); |
|
72 | + $tree = Validator::attributes($request)->tree(); |
|
73 | + $surname = Validator::attributes($request)->string('surname', ''); |
|
74 | 74 | |
75 | - $initial = mb_substr($surname, 0, 1); |
|
76 | - $initials_list = collect($this->indilist_module->surnameAlpha($tree, false, false, I18N::locale())) |
|
77 | - ->reject(function (int $count, string $initial): bool { |
|
78 | - return $initial === '@' || $initial === ','; |
|
79 | - }); |
|
75 | + $initial = mb_substr($surname, 0, 1); |
|
76 | + $initials_list = collect($this->indilist_module->surnameAlpha($tree, false, false, I18N::locale())) |
|
77 | + ->reject(function (int $count, string $initial): bool { |
|
78 | + return $initial === '@' || $initial === ','; |
|
79 | + }); |
|
80 | 80 | |
81 | - $title = I18N::translate('Patronymic Lineages') . ' — ' . $surname; |
|
81 | + $title = I18N::translate('Patronymic Lineages') . ' — ' . $surname; |
|
82 | 82 | |
83 | - $lineages = app()->make(LineageBuilder::class, ['surname' => $surname])->buildLineages(); |
|
83 | + $lineages = app()->make(LineageBuilder::class, ['surname' => $surname])->buildLineages(); |
|
84 | 84 | |
85 | - return $this->viewResponse($this->module->name() . '::lineages-page', [ |
|
86 | - 'title' => $title, |
|
87 | - 'module' => $this->module, |
|
88 | - 'tree' => $tree, |
|
89 | - 'initials_list' => $initials_list, |
|
90 | - 'initial' => $initial, |
|
91 | - 'show_all' => 'no', |
|
92 | - 'surname' => $surname, |
|
93 | - 'lineages' => $lineages, |
|
94 | - 'nb_lineages' => $lineages !== null ? $lineages->count() : 0 |
|
95 | - ]); |
|
96 | - } |
|
85 | + return $this->viewResponse($this->module->name() . '::lineages-page', [ |
|
86 | + 'title' => $title, |
|
87 | + 'module' => $this->module, |
|
88 | + 'tree' => $tree, |
|
89 | + 'initials_list' => $initials_list, |
|
90 | + 'initial' => $initial, |
|
91 | + 'show_all' => 'no', |
|
92 | + 'surname' => $surname, |
|
93 | + 'lineages' => $lineages, |
|
94 | + 'nb_lineages' => $lineages !== null ? $lineages->count() : 0 |
|
95 | + ]); |
|
96 | + } |
|
97 | 97 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public function addFamily(Family $fams): object |
69 | 69 | { |
70 | 70 | if (!$this->linked_fams->has($fams->xref())) { |
71 | - $this->linked_fams->put($fams->xref(), (object) [ |
|
71 | + $this->linked_fams->put($fams->xref(), (object)[ |
|
72 | 72 | 'family' => $fams, |
73 | 73 | 'children' => new Collection() |
74 | 74 | ]); |
@@ -135,6 +135,6 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function hasFollowUpSurname(): bool |
137 | 137 | { |
138 | - return mb_strlen($this->followUpSurname()) > 0 ; |
|
138 | + return mb_strlen($this->followUpSurname()) > 0; |
|
139 | 139 | } |
140 | 140 | } |
@@ -24,106 +24,106 @@ |
||
24 | 24 | */ |
25 | 25 | class LineageNode |
26 | 26 | { |
27 | - /** |
|
28 | - * @var Collection<string, stdClass> $linked_fams Spouse families linked to the node |
|
29 | - */ |
|
30 | - private Collection $linked_fams; |
|
27 | + /** |
|
28 | + * @var Collection<string, stdClass> $linked_fams Spouse families linked to the node |
|
29 | + */ |
|
30 | + private Collection $linked_fams; |
|
31 | 31 | |
32 | - private ?Individual $node_indi; |
|
33 | - private LineageRootNode $root_node; |
|
34 | - private ?string $alt_surname; |
|
32 | + private ?Individual $node_indi; |
|
33 | + private LineageRootNode $root_node; |
|
34 | + private ?string $alt_surname; |
|
35 | 35 | |
36 | - /** |
|
37 | - * Constructor for Lineage node |
|
38 | - * |
|
39 | - * @param Individual $node_indi Main individual |
|
40 | - * @param LineageRootNode $root_node Node of the lineage root |
|
41 | - * @param null|string $alt_surname Follow-up surname |
|
42 | - */ |
|
43 | - public function __construct(?Individual $node_indi = null, LineageRootNode $root_node, $alt_surname = null) |
|
44 | - { |
|
45 | - $this->node_indi = $node_indi; |
|
46 | - $this->root_node = $root_node; |
|
47 | - $this->alt_surname = $alt_surname; |
|
48 | - $this->linked_fams = new Collection(); |
|
49 | - } |
|
36 | + /** |
|
37 | + * Constructor for Lineage node |
|
38 | + * |
|
39 | + * @param Individual $node_indi Main individual |
|
40 | + * @param LineageRootNode $root_node Node of the lineage root |
|
41 | + * @param null|string $alt_surname Follow-up surname |
|
42 | + */ |
|
43 | + public function __construct(?Individual $node_indi = null, LineageRootNode $root_node, $alt_surname = null) |
|
44 | + { |
|
45 | + $this->node_indi = $node_indi; |
|
46 | + $this->root_node = $root_node; |
|
47 | + $this->alt_surname = $alt_surname; |
|
48 | + $this->linked_fams = new Collection(); |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Add a spouse family to the node |
|
53 | - * |
|
54 | - * @param Family $fams |
|
55 | - * @return stdClass |
|
56 | - */ |
|
57 | - public function addFamily(Family $fams): object |
|
58 | - { |
|
59 | - if (!$this->linked_fams->has($fams->xref())) { |
|
60 | - $this->linked_fams->put($fams->xref(), (object) [ |
|
61 | - 'family' => $fams, |
|
62 | - 'children' => new Collection() |
|
63 | - ]); |
|
64 | - } |
|
65 | - return $this->linked_fams->get($fams->xref()); |
|
66 | - } |
|
51 | + /** |
|
52 | + * Add a spouse family to the node |
|
53 | + * |
|
54 | + * @param Family $fams |
|
55 | + * @return stdClass |
|
56 | + */ |
|
57 | + public function addFamily(Family $fams): object |
|
58 | + { |
|
59 | + if (!$this->linked_fams->has($fams->xref())) { |
|
60 | + $this->linked_fams->put($fams->xref(), (object) [ |
|
61 | + 'family' => $fams, |
|
62 | + 'children' => new Collection() |
|
63 | + ]); |
|
64 | + } |
|
65 | + return $this->linked_fams->get($fams->xref()); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * Add a child LineageNode to the node |
|
70 | - * |
|
71 | - * @param Family $fams |
|
72 | - * @param LineageNode $child |
|
73 | - */ |
|
74 | - public function addChild(Family $fams, LineageNode $child = null): void |
|
75 | - { |
|
76 | - $this->addFamily($fams)->children->push($child); |
|
77 | - $this->root_node->incrementChildNodes(); |
|
78 | - } |
|
68 | + /** |
|
69 | + * Add a child LineageNode to the node |
|
70 | + * |
|
71 | + * @param Family $fams |
|
72 | + * @param LineageNode $child |
|
73 | + */ |
|
74 | + public function addChild(Family $fams, LineageNode $child = null): void |
|
75 | + { |
|
76 | + $this->addFamily($fams)->children->push($child); |
|
77 | + $this->root_node->incrementChildNodes(); |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * Returns the node individual |
|
82 | - * |
|
83 | - * @return Individual|NULL |
|
84 | - */ |
|
85 | - public function individual(): ?Individual |
|
86 | - { |
|
87 | - return $this->node_indi; |
|
88 | - } |
|
80 | + /** |
|
81 | + * Returns the node individual |
|
82 | + * |
|
83 | + * @return Individual|NULL |
|
84 | + */ |
|
85 | + public function individual(): ?Individual |
|
86 | + { |
|
87 | + return $this->node_indi; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * Returns the lineage root node individual |
|
92 | - * |
|
93 | - * @return LineageRootNode |
|
94 | - */ |
|
95 | - public function rootNode(): LineageRootNode |
|
96 | - { |
|
97 | - return $this->root_node; |
|
98 | - } |
|
90 | + /** |
|
91 | + * Returns the lineage root node individual |
|
92 | + * |
|
93 | + * @return LineageRootNode |
|
94 | + */ |
|
95 | + public function rootNode(): LineageRootNode |
|
96 | + { |
|
97 | + return $this->root_node; |
|
98 | + } |
|
99 | 99 | |
100 | - /** |
|
101 | - * Returns the spouse families linked to the node |
|
102 | - * |
|
103 | - * @return Collection<string, \stdClass> |
|
104 | - */ |
|
105 | - public function families(): Collection |
|
106 | - { |
|
107 | - return $this->linked_fams; |
|
108 | - } |
|
100 | + /** |
|
101 | + * Returns the spouse families linked to the node |
|
102 | + * |
|
103 | + * @return Collection<string, \stdClass> |
|
104 | + */ |
|
105 | + public function families(): Collection |
|
106 | + { |
|
107 | + return $this->linked_fams; |
|
108 | + } |
|
109 | 109 | |
110 | - /** |
|
111 | - * Returns the follow-up surname |
|
112 | - * |
|
113 | - * @return string |
|
114 | - */ |
|
115 | - public function followUpSurname(): string |
|
116 | - { |
|
117 | - return $this->alt_surname ?? ''; |
|
118 | - } |
|
110 | + /** |
|
111 | + * Returns the follow-up surname |
|
112 | + * |
|
113 | + * @return string |
|
114 | + */ |
|
115 | + public function followUpSurname(): string |
|
116 | + { |
|
117 | + return $this->alt_surname ?? ''; |
|
118 | + } |
|
119 | 119 | |
120 | - /** |
|
121 | - * Indicates whether the node has a follow up surname |
|
122 | - * |
|
123 | - * @return boolean |
|
124 | - */ |
|
125 | - public function hasFollowUpSurname(): bool |
|
126 | - { |
|
127 | - return mb_strlen($this->followUpSurname()) > 0 ; |
|
128 | - } |
|
120 | + /** |
|
121 | + * Indicates whether the node has a follow up surname |
|
122 | + * |
|
123 | + * @return boolean |
|
124 | + */ |
|
125 | + public function hasFollowUpSurname(): bool |
|
126 | + { |
|
127 | + return mb_strlen($this->followUpSurname()) > 0 ; |
|
128 | + } |
|
129 | 129 | } |