@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | public function visitsThisYear(WelcomeBlockModule $module, int $block_id): ?int |
41 | 41 | { |
42 | 42 | return Registry::cache()->file()->remember( |
43 | - $module->name() . '-matomovisits-yearly-' . $block_id, |
|
44 | - function () use ($module, $block_id): ?int { |
|
43 | + $module->name().'-matomovisits-yearly-'.$block_id, |
|
44 | + function() use ($module, $block_id) : ?int { |
|
45 | 45 | $visits_year = $this->visits($module, $block_id, 'year'); |
46 | 46 | if ($visits_year === null) { |
47 | 47 | return null; |
48 | 48 | } |
49 | - $visits_today = (int) $this->visits($module, $block_id, 'day'); |
|
49 | + $visits_today = (int)$this->visits($module, $block_id, 'day'); |
|
50 | 50 | |
51 | 51 | return $visits_year - $visits_today; |
52 | 52 | }, |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | public function visitsToday(WelcomeBlockModule $module, int $block_id): ?int |
65 | 65 | { |
66 | 66 | return Registry::cache()->array()->remember( |
67 | - $module->name() . '-matomovisits-daily-' . $block_id, |
|
68 | - function () use ($module, $block_id): ?int { |
|
67 | + $module->name().'-matomovisits-daily-'.$block_id, |
|
68 | + function() use ($module, $block_id) : ?int { |
|
69 | 69 | return $this->visits($module, $block_id, 'day'); |
70 | 70 | } |
71 | 71 | ); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | ]); |
108 | 108 | |
109 | 109 | if ($response->getStatusCode() === StatusCodeInterface::STATUS_OK) { |
110 | - $result = json_decode((string) $response->getBody(), true)['value'] ?? null; |
|
110 | + $result = json_decode((string)$response->getBody(), true)['value'] ?? null; |
|
111 | 111 | if ($result !== null) { |
112 | 112 | return (int)$result; |
113 | 113 | } |
@@ -28,93 +28,93 @@ |
||
28 | 28 | */ |
29 | 29 | class MatomoStatsService |
30 | 30 | { |
31 | - /** |
|
32 | - * Returns the number of visits for the current year (up to the day before). |
|
33 | - * That statistic is cached for the day, to avoid unecessary calls to Matomo API. |
|
34 | - * |
|
35 | - * @param WelcomeBlockModule $module |
|
36 | - * @param int $block_id |
|
37 | - * @return int|NULL |
|
38 | - */ |
|
39 | - public function visitsThisYear(WelcomeBlockModule $module, int $block_id): ?int |
|
40 | - { |
|
41 | - return Registry::cache()->file()->remember( |
|
42 | - $module->name() . '-matomovisits-yearly-' . $block_id, |
|
43 | - function () use ($module, $block_id): ?int { |
|
44 | - $visits_year = $this->visits($module, $block_id, 'year'); |
|
45 | - if ($visits_year === null) { |
|
46 | - return null; |
|
47 | - } |
|
48 | - $visits_today = (int) $this->visits($module, $block_id, 'day'); |
|
31 | + /** |
|
32 | + * Returns the number of visits for the current year (up to the day before). |
|
33 | + * That statistic is cached for the day, to avoid unecessary calls to Matomo API. |
|
34 | + * |
|
35 | + * @param WelcomeBlockModule $module |
|
36 | + * @param int $block_id |
|
37 | + * @return int|NULL |
|
38 | + */ |
|
39 | + public function visitsThisYear(WelcomeBlockModule $module, int $block_id): ?int |
|
40 | + { |
|
41 | + return Registry::cache()->file()->remember( |
|
42 | + $module->name() . '-matomovisits-yearly-' . $block_id, |
|
43 | + function () use ($module, $block_id): ?int { |
|
44 | + $visits_year = $this->visits($module, $block_id, 'year'); |
|
45 | + if ($visits_year === null) { |
|
46 | + return null; |
|
47 | + } |
|
48 | + $visits_today = (int) $this->visits($module, $block_id, 'day'); |
|
49 | 49 | |
50 | - return $visits_year - $visits_today; |
|
51 | - }, |
|
52 | - Carbon::now()->addDay()->startOfDay()->diffInSeconds(Carbon::now()) // Valid until midnight |
|
53 | - ); |
|
54 | - } |
|
50 | + return $visits_year - $visits_today; |
|
51 | + }, |
|
52 | + Carbon::now()->addDay()->startOfDay()->diffInSeconds(Carbon::now()) // Valid until midnight |
|
53 | + ); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * Returns the number of visits for the current day. |
|
58 | - * |
|
59 | - * @param WelcomeBlockModule $module |
|
60 | - * @param int $block_id |
|
61 | - * @return int|NULL |
|
62 | - */ |
|
63 | - public function visitsToday(WelcomeBlockModule $module, int $block_id): ?int |
|
64 | - { |
|
65 | - return Registry::cache()->array()->remember( |
|
66 | - $module->name() . '-matomovisits-daily-' . $block_id, |
|
67 | - function () use ($module, $block_id): ?int { |
|
68 | - return $this->visits($module, $block_id, 'day'); |
|
69 | - } |
|
70 | - ); |
|
71 | - } |
|
56 | + /** |
|
57 | + * Returns the number of visits for the current day. |
|
58 | + * |
|
59 | + * @param WelcomeBlockModule $module |
|
60 | + * @param int $block_id |
|
61 | + * @return int|NULL |
|
62 | + */ |
|
63 | + public function visitsToday(WelcomeBlockModule $module, int $block_id): ?int |
|
64 | + { |
|
65 | + return Registry::cache()->array()->remember( |
|
66 | + $module->name() . '-matomovisits-daily-' . $block_id, |
|
67 | + function () use ($module, $block_id): ?int { |
|
68 | + return $this->visits($module, $block_id, 'day'); |
|
69 | + } |
|
70 | + ); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Invoke the Matomo API to retrieve the number of visits over a period. |
|
75 | - * |
|
76 | - * @param WelcomeBlockModule $module |
|
77 | - * @param int $block_id |
|
78 | - * @param string $period |
|
79 | - * @return int|NULL |
|
80 | - */ |
|
81 | - protected function visits(WelcomeBlockModule $module, int $block_id, string $period): ?int |
|
82 | - { |
|
83 | - $settings = $module->matomoSettings($block_id); |
|
73 | + /** |
|
74 | + * Invoke the Matomo API to retrieve the number of visits over a period. |
|
75 | + * |
|
76 | + * @param WelcomeBlockModule $module |
|
77 | + * @param int $block_id |
|
78 | + * @param string $period |
|
79 | + * @return int|NULL |
|
80 | + */ |
|
81 | + protected function visits(WelcomeBlockModule $module, int $block_id, string $period): ?int |
|
82 | + { |
|
83 | + $settings = $module->matomoSettings($block_id); |
|
84 | 84 | |
85 | - if ( |
|
86 | - $settings['matomo_enabled'] === true |
|
87 | - && mb_strlen($settings['matomo_url']) > 0 |
|
88 | - && mb_strlen($settings['matomo_token']) > 0 |
|
89 | - && $settings['matomo_siteid'] > 0 |
|
90 | - ) { |
|
91 | - try { |
|
92 | - $http_client = new Client([ |
|
93 | - RequestOptions::TIMEOUT => 30 |
|
94 | - ]); |
|
85 | + if ( |
|
86 | + $settings['matomo_enabled'] === true |
|
87 | + && mb_strlen($settings['matomo_url']) > 0 |
|
88 | + && mb_strlen($settings['matomo_token']) > 0 |
|
89 | + && $settings['matomo_siteid'] > 0 |
|
90 | + ) { |
|
91 | + try { |
|
92 | + $http_client = new Client([ |
|
93 | + RequestOptions::TIMEOUT => 30 |
|
94 | + ]); |
|
95 | 95 | |
96 | - $response = $http_client->get($settings['matomo_url'], [ |
|
97 | - 'query' => [ |
|
98 | - 'module' => 'API', |
|
99 | - 'method' => 'VisitsSummary.getVisits', |
|
100 | - 'idSite' => $settings['matomo_siteid'], |
|
101 | - 'period' => $period, |
|
102 | - 'date' => 'today', |
|
103 | - 'token_auth' => $settings['matomo_token'], |
|
104 | - 'format' => 'json' |
|
105 | - ] |
|
106 | - ]); |
|
96 | + $response = $http_client->get($settings['matomo_url'], [ |
|
97 | + 'query' => [ |
|
98 | + 'module' => 'API', |
|
99 | + 'method' => 'VisitsSummary.getVisits', |
|
100 | + 'idSite' => $settings['matomo_siteid'], |
|
101 | + 'period' => $period, |
|
102 | + 'date' => 'today', |
|
103 | + 'token_auth' => $settings['matomo_token'], |
|
104 | + 'format' => 'json' |
|
105 | + ] |
|
106 | + ]); |
|
107 | 107 | |
108 | - if ($response->getStatusCode() === StatusCodeInterface::STATUS_OK) { |
|
109 | - $result = json_decode((string) $response->getBody(), true)['value'] ?? null; |
|
110 | - if ($result !== null) { |
|
111 | - return (int)$result; |
|
112 | - } |
|
113 | - } |
|
114 | - } catch (GuzzleException $ex) { |
|
115 | - } |
|
116 | - } |
|
108 | + if ($response->getStatusCode() === StatusCodeInterface::STATUS_OK) { |
|
109 | + $result = json_decode((string) $response->getBody(), true)['value'] ?? null; |
|
110 | + if ($result !== null) { |
|
111 | + return (int)$result; |
|
112 | + } |
|
113 | + } |
|
114 | + } catch (GuzzleException $ex) { |
|
115 | + } |
|
116 | + } |
|
117 | 117 | |
118 | - return null; |
|
119 | - } |
|
118 | + return null; |
|
119 | + } |
|
120 | 120 | } |
@@ -25,63 +25,63 @@ |
||
25 | 25 | */ |
26 | 26 | class IsSourcedStatusHook implements RecordNameTextExtenderInterface |
27 | 27 | { |
28 | - private ModuleInterface $module; |
|
29 | - private SourceStatusService $source_status_service; |
|
28 | + private ModuleInterface $module; |
|
29 | + private SourceStatusService $source_status_service; |
|
30 | 30 | |
31 | - /** |
|
32 | - * Constructor for IsSourcedStatusHook |
|
33 | - * |
|
34 | - * @param ModuleInterface $module |
|
35 | - * @param SourceStatusService $source_status_service |
|
36 | - */ |
|
37 | - public function __construct(ModuleInterface $module, SourceStatusService $source_status_service) |
|
38 | - { |
|
39 | - $this->module = $module; |
|
40 | - $this->source_status_service = $source_status_service; |
|
41 | - } |
|
31 | + /** |
|
32 | + * Constructor for IsSourcedStatusHook |
|
33 | + * |
|
34 | + * @param ModuleInterface $module |
|
35 | + * @param SourceStatusService $source_status_service |
|
36 | + */ |
|
37 | + public function __construct(ModuleInterface $module, SourceStatusService $source_status_service) |
|
38 | + { |
|
39 | + $this->module = $module; |
|
40 | + $this->source_status_service = $source_status_service; |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * {@inheritDoc} |
|
45 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookInterface::module() |
|
46 | - */ |
|
47 | - public function module(): ModuleInterface |
|
48 | - { |
|
49 | - return $this->module; |
|
50 | - } |
|
43 | + /** |
|
44 | + * {@inheritDoc} |
|
45 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookInterface::module() |
|
46 | + */ |
|
47 | + public function module(): ModuleInterface |
|
48 | + { |
|
49 | + return $this->module; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * {@inheritDoc} |
|
54 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\RecordNameTextExtenderInterface::recordNamePrepend() |
|
55 | - */ |
|
56 | - public function recordNamePrepend(GedcomRecord $record, bool $use_long = false, string $size = ''): string |
|
57 | - { |
|
58 | - return ''; |
|
59 | - } |
|
52 | + /** |
|
53 | + * {@inheritDoc} |
|
54 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\RecordNameTextExtenderInterface::recordNamePrepend() |
|
55 | + */ |
|
56 | + public function recordNamePrepend(GedcomRecord $record, bool $use_long = false, string $size = ''): string |
|
57 | + { |
|
58 | + return ''; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * {@inheritDoc} |
|
63 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\RecordNameTextExtenderInterface::recordNameAppend() |
|
64 | - */ |
|
65 | - public function recordNameAppend(GedcomRecord $record, bool $use_long = false, string $size = ''): string |
|
66 | - { |
|
67 | - if ($use_long && $record instanceof Individual) { |
|
68 | - return |
|
69 | - view($this->module()->name() . '::icons/source-status', [ |
|
70 | - 'module_name' => $this->module()->name(), |
|
71 | - 'source_status' => $this->source_status_service->sourceStatusForRecord($record), |
|
72 | - 'context' => 'INDI', |
|
73 | - 'size_style' => $size ]) . |
|
74 | - view($this->module()->name() . '::icons/source-status', [ |
|
75 | - 'module_name' => $this->module()->name(), |
|
76 | - 'source_status' => $this->source_status_service->sourceStatusForBirth($record), |
|
77 | - 'context' => 'INDI:BIRT', |
|
78 | - 'size_style' => $size ]) . |
|
79 | - ($record->isDead() ? view($this->module()->name() . '::icons/source-status', [ |
|
80 | - 'module_name' => $this->module()->name(), |
|
81 | - 'source_status' => $this->source_status_service->sourceStatusForDeath($record), |
|
82 | - 'context' => 'INDI:DEAT', |
|
83 | - 'size_style' => $size ]) : '') ; |
|
84 | - } |
|
85 | - return ''; |
|
86 | - } |
|
61 | + /** |
|
62 | + * {@inheritDoc} |
|
63 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\RecordNameTextExtenderInterface::recordNameAppend() |
|
64 | + */ |
|
65 | + public function recordNameAppend(GedcomRecord $record, bool $use_long = false, string $size = ''): string |
|
66 | + { |
|
67 | + if ($use_long && $record instanceof Individual) { |
|
68 | + return |
|
69 | + view($this->module()->name() . '::icons/source-status', [ |
|
70 | + 'module_name' => $this->module()->name(), |
|
71 | + 'source_status' => $this->source_status_service->sourceStatusForRecord($record), |
|
72 | + 'context' => 'INDI', |
|
73 | + 'size_style' => $size ]) . |
|
74 | + view($this->module()->name() . '::icons/source-status', [ |
|
75 | + 'module_name' => $this->module()->name(), |
|
76 | + 'source_status' => $this->source_status_service->sourceStatusForBirth($record), |
|
77 | + 'context' => 'INDI:BIRT', |
|
78 | + 'size_style' => $size ]) . |
|
79 | + ($record->isDead() ? view($this->module()->name() . '::icons/source-status', [ |
|
80 | + 'module_name' => $this->module()->name(), |
|
81 | + 'source_status' => $this->source_status_service->sourceStatusForDeath($record), |
|
82 | + 'context' => 'INDI:DEAT', |
|
83 | + 'size_style' => $size ]) : '') ; |
|
84 | + } |
|
85 | + return ''; |
|
86 | + } |
|
87 | 87 | } |
@@ -66,21 +66,21 @@ |
||
66 | 66 | { |
67 | 67 | if ($use_long && $record instanceof Individual) { |
68 | 68 | return |
69 | - view($this->module()->name() . '::icons/source-status', [ |
|
69 | + view($this->module()->name().'::icons/source-status', [ |
|
70 | 70 | 'module_name' => $this->module()->name(), |
71 | 71 | 'source_status' => $this->source_status_service->sourceStatusForRecord($record), |
72 | 72 | 'context' => 'INDI', |
73 | - 'size_style' => $size ]) . |
|
74 | - view($this->module()->name() . '::icons/source-status', [ |
|
73 | + 'size_style' => $size]). |
|
74 | + view($this->module()->name().'::icons/source-status', [ |
|
75 | 75 | 'module_name' => $this->module()->name(), |
76 | 76 | 'source_status' => $this->source_status_service->sourceStatusForBirth($record), |
77 | 77 | 'context' => 'INDI:BIRT', |
78 | - 'size_style' => $size ]) . |
|
79 | - ($record->isDead() ? view($this->module()->name() . '::icons/source-status', [ |
|
78 | + 'size_style' => $size]). |
|
79 | + ($record->isDead() ? view($this->module()->name().'::icons/source-status', [ |
|
80 | 80 | 'module_name' => $this->module()->name(), |
81 | 81 | 'source_status' => $this->source_status_service->sourceStatusForDeath($record), |
82 | 82 | 'context' => 'INDI:DEAT', |
83 | - 'size_style' => $size ]) : '') ; |
|
83 | + 'size_style' => $size]) : ''); |
|
84 | 84 | } |
85 | 85 | return ''; |
86 | 86 | } |
@@ -30,183 +30,183 @@ |
||
30 | 30 | * Hook for adding columns with source statuses in datatables. |
31 | 31 | */ |
32 | 32 | class IsSourcedStatusColumnsHook implements |
33 | - FamilyDatatablesExtenderInterface, |
|
34 | - IndividualDatatablesExtenderInterface, |
|
35 | - SosaFamilyDatatablesExtenderInterface, |
|
36 | - SosaIndividualDatatablesExtenderInterface, |
|
37 | - SosaMissingDatatablesExtenderInterface |
|
33 | + FamilyDatatablesExtenderInterface, |
|
34 | + IndividualDatatablesExtenderInterface, |
|
35 | + SosaFamilyDatatablesExtenderInterface, |
|
36 | + SosaIndividualDatatablesExtenderInterface, |
|
37 | + SosaMissingDatatablesExtenderInterface |
|
38 | 38 | { |
39 | - private ModuleInterface $module; |
|
40 | - private SourceStatusService $source_status_service; |
|
39 | + private ModuleInterface $module; |
|
40 | + private SourceStatusService $source_status_service; |
|
41 | 41 | |
42 | - /** |
|
43 | - * Constructor for IsSourcedStatusColumnsHook |
|
44 | - * |
|
45 | - * @param ModuleInterface $module |
|
46 | - * @param SourceStatusService $source_status_service |
|
47 | - */ |
|
48 | - public function __construct(ModuleInterface $module, SourceStatusService $source_status_service) |
|
49 | - { |
|
50 | - $this->module = $module; |
|
51 | - $this->source_status_service = $source_status_service; |
|
52 | - } |
|
42 | + /** |
|
43 | + * Constructor for IsSourcedStatusColumnsHook |
|
44 | + * |
|
45 | + * @param ModuleInterface $module |
|
46 | + * @param SourceStatusService $source_status_service |
|
47 | + */ |
|
48 | + public function __construct(ModuleInterface $module, SourceStatusService $source_status_service) |
|
49 | + { |
|
50 | + $this->module = $module; |
|
51 | + $this->source_status_service = $source_status_service; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * {@inheritDoc} |
|
56 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookInterface::module() |
|
57 | - */ |
|
58 | - public function module(): ModuleInterface |
|
59 | - { |
|
60 | - return $this->module; |
|
61 | - } |
|
54 | + /** |
|
55 | + * {@inheritDoc} |
|
56 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookInterface::module() |
|
57 | + */ |
|
58 | + public function module(): ModuleInterface |
|
59 | + { |
|
60 | + return $this->module; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * {@inheritDoc} |
|
65 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\IndividualDatatablesExtenderInterface::individualColumns() |
|
66 | - */ |
|
67 | - public function individualColumns(iterable $records): array |
|
68 | - { |
|
69 | - $records = collect($records); |
|
70 | - return [ |
|
71 | - 'issourced' => [ |
|
72 | - 'birth' => [ |
|
73 | - 'position' => 7, |
|
74 | - 'column_def' => [ 'class' => 'text-center' ], |
|
75 | - 'th' => view($this->module()->name() . '::components/column-th-issourced', [ |
|
76 | - 'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI:BIRT')->label()) |
|
77 | - ]), |
|
78 | - 'records' => $records->map(function (Individual $individual): array { |
|
79 | - $source_status = $this->source_status_service->sourceStatusForBirth($individual); |
|
80 | - return [ |
|
81 | - 'order' => $source_status->order(), |
|
82 | - 'text' => view($this->module()->name() . '::icons/source-status', [ |
|
83 | - 'module_name' => $this->module()->name(), |
|
84 | - 'source_status' => $source_status, |
|
85 | - 'context' => 'INDI:BIRT', |
|
86 | - 'size_style' => '' ]) |
|
87 | - ]; |
|
88 | - })->toArray() |
|
89 | - ], |
|
90 | - 'death' => [ |
|
91 | - 'position' => 12, |
|
92 | - 'column_def' => [ 'class' => 'text-center' ], |
|
93 | - 'th' => view($this->module()->name() . '::components/column-th-issourced', [ |
|
94 | - 'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI:DEAT')->label()) |
|
95 | - ]), |
|
96 | - 'records' => $records->map(function (Individual $individual): array { |
|
97 | - $source_status = $this->source_status_service->sourceStatusForDeath($individual); |
|
98 | - return $individual->isDead() ? [ |
|
99 | - 'order' => $source_status->order(), |
|
100 | - 'text' => view($this->module()->name() . '::icons/source-status', [ |
|
101 | - 'module_name' => $this->module()->name(), |
|
102 | - 'source_status' => $source_status, |
|
103 | - 'context' => 'INDI:DEAT', |
|
104 | - 'size_style' => '' ]) |
|
105 | - ] : ['order' => 0, 'text' => '']; |
|
106 | - })->toArray() |
|
107 | - ] |
|
108 | - ] |
|
109 | - ]; |
|
110 | - } |
|
63 | + /** |
|
64 | + * {@inheritDoc} |
|
65 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\IndividualDatatablesExtenderInterface::individualColumns() |
|
66 | + */ |
|
67 | + public function individualColumns(iterable $records): array |
|
68 | + { |
|
69 | + $records = collect($records); |
|
70 | + return [ |
|
71 | + 'issourced' => [ |
|
72 | + 'birth' => [ |
|
73 | + 'position' => 7, |
|
74 | + 'column_def' => [ 'class' => 'text-center' ], |
|
75 | + 'th' => view($this->module()->name() . '::components/column-th-issourced', [ |
|
76 | + 'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI:BIRT')->label()) |
|
77 | + ]), |
|
78 | + 'records' => $records->map(function (Individual $individual): array { |
|
79 | + $source_status = $this->source_status_service->sourceStatusForBirth($individual); |
|
80 | + return [ |
|
81 | + 'order' => $source_status->order(), |
|
82 | + 'text' => view($this->module()->name() . '::icons/source-status', [ |
|
83 | + 'module_name' => $this->module()->name(), |
|
84 | + 'source_status' => $source_status, |
|
85 | + 'context' => 'INDI:BIRT', |
|
86 | + 'size_style' => '' ]) |
|
87 | + ]; |
|
88 | + })->toArray() |
|
89 | + ], |
|
90 | + 'death' => [ |
|
91 | + 'position' => 12, |
|
92 | + 'column_def' => [ 'class' => 'text-center' ], |
|
93 | + 'th' => view($this->module()->name() . '::components/column-th-issourced', [ |
|
94 | + 'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI:DEAT')->label()) |
|
95 | + ]), |
|
96 | + 'records' => $records->map(function (Individual $individual): array { |
|
97 | + $source_status = $this->source_status_service->sourceStatusForDeath($individual); |
|
98 | + return $individual->isDead() ? [ |
|
99 | + 'order' => $source_status->order(), |
|
100 | + 'text' => view($this->module()->name() . '::icons/source-status', [ |
|
101 | + 'module_name' => $this->module()->name(), |
|
102 | + 'source_status' => $source_status, |
|
103 | + 'context' => 'INDI:DEAT', |
|
104 | + 'size_style' => '' ]) |
|
105 | + ] : ['order' => 0, 'text' => '']; |
|
106 | + })->toArray() |
|
107 | + ] |
|
108 | + ] |
|
109 | + ]; |
|
110 | + } |
|
111 | 111 | |
112 | - /** |
|
113 | - * {@inheritDoc} |
|
114 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\FamilyDatatablesExtenderInterface::familyColumns() |
|
115 | - */ |
|
116 | - public function familyColumns(iterable $records): array |
|
117 | - { |
|
118 | - $records = collect($records); |
|
119 | - return [ |
|
120 | - 'issourced' => [ |
|
121 | - 'marr' => [ |
|
122 | - 'position' => 10, |
|
123 | - 'column_def' => [ 'class' => 'text-center' ], |
|
124 | - 'th' => view($this->module()->name() . '::components/column-th-issourced', [ |
|
125 | - 'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('FAM:MARR')->label()) |
|
126 | - ]), |
|
127 | - 'records' => $records->map(function (Family $family): array { |
|
128 | - $source_status = $this->source_status_service->sourceStatusForMarriage($family); |
|
129 | - return $family->getMarriage() !== null ? [ |
|
130 | - 'order' => $source_status->order(), |
|
131 | - 'text' => view($this->module()->name() . '::icons/source-status', [ |
|
132 | - 'module_name' => $this->module()->name(), |
|
133 | - 'source_status' => $source_status, |
|
134 | - 'context' => 'FAM:MARR', |
|
135 | - 'size_style' => '' ]) |
|
136 | - ] : ['order' => 0, 'text' => '']; |
|
137 | - })->toArray() |
|
138 | - ] |
|
139 | - ] |
|
140 | - ]; |
|
141 | - } |
|
112 | + /** |
|
113 | + * {@inheritDoc} |
|
114 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\FamilyDatatablesExtenderInterface::familyColumns() |
|
115 | + */ |
|
116 | + public function familyColumns(iterable $records): array |
|
117 | + { |
|
118 | + $records = collect($records); |
|
119 | + return [ |
|
120 | + 'issourced' => [ |
|
121 | + 'marr' => [ |
|
122 | + 'position' => 10, |
|
123 | + 'column_def' => [ 'class' => 'text-center' ], |
|
124 | + 'th' => view($this->module()->name() . '::components/column-th-issourced', [ |
|
125 | + 'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('FAM:MARR')->label()) |
|
126 | + ]), |
|
127 | + 'records' => $records->map(function (Family $family): array { |
|
128 | + $source_status = $this->source_status_service->sourceStatusForMarriage($family); |
|
129 | + return $family->getMarriage() !== null ? [ |
|
130 | + 'order' => $source_status->order(), |
|
131 | + 'text' => view($this->module()->name() . '::icons/source-status', [ |
|
132 | + 'module_name' => $this->module()->name(), |
|
133 | + 'source_status' => $source_status, |
|
134 | + 'context' => 'FAM:MARR', |
|
135 | + 'size_style' => '' ]) |
|
136 | + ] : ['order' => 0, 'text' => '']; |
|
137 | + })->toArray() |
|
138 | + ] |
|
139 | + ] |
|
140 | + ]; |
|
141 | + } |
|
142 | 142 | |
143 | - /** |
|
144 | - * {@inheritDoc} |
|
145 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaIndividualDatatablesExtenderInterface::sosaIndividualColumns() |
|
146 | - */ |
|
147 | - public function sosaIndividualColumns(iterable $records): array |
|
148 | - { |
|
149 | - $columns = $this->individualColumns($records); |
|
150 | - $columns['issourced']['birth']['position'] = 5; |
|
151 | - $columns['issourced']['death']['position'] = 8; |
|
152 | - return $columns; |
|
153 | - } |
|
143 | + /** |
|
144 | + * {@inheritDoc} |
|
145 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaIndividualDatatablesExtenderInterface::sosaIndividualColumns() |
|
146 | + */ |
|
147 | + public function sosaIndividualColumns(iterable $records): array |
|
148 | + { |
|
149 | + $columns = $this->individualColumns($records); |
|
150 | + $columns['issourced']['birth']['position'] = 5; |
|
151 | + $columns['issourced']['death']['position'] = 8; |
|
152 | + return $columns; |
|
153 | + } |
|
154 | 154 | |
155 | - /** |
|
156 | - * {@inheritDoc} |
|
157 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaFamilyDatatablesExtenderInterface::sosaFamilyColumns() |
|
158 | - */ |
|
159 | - public function sosaFamilyColumns(iterable $records): array |
|
160 | - { |
|
161 | - return $this->familyColumns($records); |
|
162 | - } |
|
155 | + /** |
|
156 | + * {@inheritDoc} |
|
157 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaFamilyDatatablesExtenderInterface::sosaFamilyColumns() |
|
158 | + */ |
|
159 | + public function sosaFamilyColumns(iterable $records): array |
|
160 | + { |
|
161 | + return $this->familyColumns($records); |
|
162 | + } |
|
163 | 163 | |
164 | - /** |
|
165 | - * {@inheritDoc} |
|
166 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaMissingDatatablesExtenderInterface::sosaMissingColumns() |
|
167 | - */ |
|
168 | - public function sosaMissingColumns(iterable $records): array |
|
169 | - { |
|
170 | - $records = collect($records); |
|
171 | - return [ |
|
172 | - 'issourced' => [ |
|
173 | - 'indi' => [ |
|
174 | - 'position' => 3, |
|
175 | - 'column_def' => [ 'class' => 'text-center' ], |
|
176 | - 'th' => view($this->module()->name() . '::components/column-th-issourced', [ |
|
177 | - 'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI')->label()) |
|
178 | - ]), |
|
179 | - 'records' => $records->map(function (Individual $individual): array { |
|
180 | - $source_status = $this->source_status_service->sourceStatusForRecord($individual); |
|
181 | - return [ |
|
182 | - 'order' => $source_status->order(), |
|
183 | - 'text' => view($this->module()->name() . '::icons/source-status', [ |
|
184 | - 'module_name' => $this->module()->name(), |
|
185 | - 'source_status' => $source_status, |
|
186 | - 'context' => 'INDI', |
|
187 | - 'size_style' => '' ]) |
|
188 | - ]; |
|
189 | - })->toArray() |
|
190 | - ], |
|
191 | - 'birth' => [ |
|
192 | - 'position' => 7, |
|
193 | - 'column_def' => [ 'class' => 'text-center' ], |
|
194 | - 'th' => view($this->module()->name() . '::components/column-th-issourced', [ |
|
195 | - 'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI:BIRT')->label()) |
|
196 | - ]), |
|
197 | - 'records' => $records->map(function (Individual $individual): array { |
|
198 | - $source_status = $this->source_status_service->sourceStatusForBirth($individual); |
|
199 | - return [ |
|
200 | - 'order' => $source_status->order(), |
|
201 | - 'text' => view($this->module()->name() . '::icons/source-status', [ |
|
202 | - 'module_name' => $this->module()->name(), |
|
203 | - 'source_status' => $source_status, |
|
204 | - 'context' => 'INDI:BIRT', |
|
205 | - 'size_style' => '' ]) |
|
206 | - ]; |
|
207 | - })->toArray() |
|
208 | - ] |
|
209 | - ] |
|
210 | - ]; |
|
211 | - } |
|
164 | + /** |
|
165 | + * {@inheritDoc} |
|
166 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaMissingDatatablesExtenderInterface::sosaMissingColumns() |
|
167 | + */ |
|
168 | + public function sosaMissingColumns(iterable $records): array |
|
169 | + { |
|
170 | + $records = collect($records); |
|
171 | + return [ |
|
172 | + 'issourced' => [ |
|
173 | + 'indi' => [ |
|
174 | + 'position' => 3, |
|
175 | + 'column_def' => [ 'class' => 'text-center' ], |
|
176 | + 'th' => view($this->module()->name() . '::components/column-th-issourced', [ |
|
177 | + 'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI')->label()) |
|
178 | + ]), |
|
179 | + 'records' => $records->map(function (Individual $individual): array { |
|
180 | + $source_status = $this->source_status_service->sourceStatusForRecord($individual); |
|
181 | + return [ |
|
182 | + 'order' => $source_status->order(), |
|
183 | + 'text' => view($this->module()->name() . '::icons/source-status', [ |
|
184 | + 'module_name' => $this->module()->name(), |
|
185 | + 'source_status' => $source_status, |
|
186 | + 'context' => 'INDI', |
|
187 | + 'size_style' => '' ]) |
|
188 | + ]; |
|
189 | + })->toArray() |
|
190 | + ], |
|
191 | + 'birth' => [ |
|
192 | + 'position' => 7, |
|
193 | + 'column_def' => [ 'class' => 'text-center' ], |
|
194 | + 'th' => view($this->module()->name() . '::components/column-th-issourced', [ |
|
195 | + 'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI:BIRT')->label()) |
|
196 | + ]), |
|
197 | + 'records' => $records->map(function (Individual $individual): array { |
|
198 | + $source_status = $this->source_status_service->sourceStatusForBirth($individual); |
|
199 | + return [ |
|
200 | + 'order' => $source_status->order(), |
|
201 | + 'text' => view($this->module()->name() . '::icons/source-status', [ |
|
202 | + 'module_name' => $this->module()->name(), |
|
203 | + 'source_status' => $source_status, |
|
204 | + 'context' => 'INDI:BIRT', |
|
205 | + 'size_style' => '' ]) |
|
206 | + ]; |
|
207 | + })->toArray() |
|
208 | + ] |
|
209 | + ] |
|
210 | + ]; |
|
211 | + } |
|
212 | 212 | } |
@@ -71,37 +71,37 @@ discard block |
||
71 | 71 | 'issourced' => [ |
72 | 72 | 'birth' => [ |
73 | 73 | 'position' => 7, |
74 | - 'column_def' => [ 'class' => 'text-center' ], |
|
75 | - 'th' => view($this->module()->name() . '::components/column-th-issourced', [ |
|
74 | + 'column_def' => ['class' => 'text-center'], |
|
75 | + 'th' => view($this->module()->name().'::components/column-th-issourced', [ |
|
76 | 76 | 'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI:BIRT')->label()) |
77 | 77 | ]), |
78 | - 'records' => $records->map(function (Individual $individual): array { |
|
78 | + 'records' => $records->map(function(Individual $individual): array { |
|
79 | 79 | $source_status = $this->source_status_service->sourceStatusForBirth($individual); |
80 | 80 | return [ |
81 | 81 | 'order' => $source_status->order(), |
82 | - 'text' => view($this->module()->name() . '::icons/source-status', [ |
|
82 | + 'text' => view($this->module()->name().'::icons/source-status', [ |
|
83 | 83 | 'module_name' => $this->module()->name(), |
84 | 84 | 'source_status' => $source_status, |
85 | 85 | 'context' => 'INDI:BIRT', |
86 | - 'size_style' => '' ]) |
|
86 | + 'size_style' => '']) |
|
87 | 87 | ]; |
88 | 88 | })->toArray() |
89 | 89 | ], |
90 | 90 | 'death' => [ |
91 | 91 | 'position' => 12, |
92 | - 'column_def' => [ 'class' => 'text-center' ], |
|
93 | - 'th' => view($this->module()->name() . '::components/column-th-issourced', [ |
|
92 | + 'column_def' => ['class' => 'text-center'], |
|
93 | + 'th' => view($this->module()->name().'::components/column-th-issourced', [ |
|
94 | 94 | 'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI:DEAT')->label()) |
95 | 95 | ]), |
96 | - 'records' => $records->map(function (Individual $individual): array { |
|
96 | + 'records' => $records->map(function(Individual $individual): array { |
|
97 | 97 | $source_status = $this->source_status_service->sourceStatusForDeath($individual); |
98 | 98 | return $individual->isDead() ? [ |
99 | 99 | 'order' => $source_status->order(), |
100 | - 'text' => view($this->module()->name() . '::icons/source-status', [ |
|
100 | + 'text' => view($this->module()->name().'::icons/source-status', [ |
|
101 | 101 | 'module_name' => $this->module()->name(), |
102 | 102 | 'source_status' => $source_status, |
103 | 103 | 'context' => 'INDI:DEAT', |
104 | - 'size_style' => '' ]) |
|
104 | + 'size_style' => '']) |
|
105 | 105 | ] : ['order' => 0, 'text' => '']; |
106 | 106 | })->toArray() |
107 | 107 | ] |
@@ -120,19 +120,19 @@ discard block |
||
120 | 120 | 'issourced' => [ |
121 | 121 | 'marr' => [ |
122 | 122 | 'position' => 10, |
123 | - 'column_def' => [ 'class' => 'text-center' ], |
|
124 | - 'th' => view($this->module()->name() . '::components/column-th-issourced', [ |
|
123 | + 'column_def' => ['class' => 'text-center'], |
|
124 | + 'th' => view($this->module()->name().'::components/column-th-issourced', [ |
|
125 | 125 | 'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('FAM:MARR')->label()) |
126 | 126 | ]), |
127 | - 'records' => $records->map(function (Family $family): array { |
|
127 | + 'records' => $records->map(function(Family $family): array { |
|
128 | 128 | $source_status = $this->source_status_service->sourceStatusForMarriage($family); |
129 | 129 | return $family->getMarriage() !== null ? [ |
130 | 130 | 'order' => $source_status->order(), |
131 | - 'text' => view($this->module()->name() . '::icons/source-status', [ |
|
131 | + 'text' => view($this->module()->name().'::icons/source-status', [ |
|
132 | 132 | 'module_name' => $this->module()->name(), |
133 | 133 | 'source_status' => $source_status, |
134 | 134 | 'context' => 'FAM:MARR', |
135 | - 'size_style' => '' ]) |
|
135 | + 'size_style' => '']) |
|
136 | 136 | ] : ['order' => 0, 'text' => '']; |
137 | 137 | })->toArray() |
138 | 138 | ] |
@@ -172,37 +172,37 @@ discard block |
||
172 | 172 | 'issourced' => [ |
173 | 173 | 'indi' => [ |
174 | 174 | 'position' => 3, |
175 | - 'column_def' => [ 'class' => 'text-center' ], |
|
176 | - 'th' => view($this->module()->name() . '::components/column-th-issourced', [ |
|
175 | + 'column_def' => ['class' => 'text-center'], |
|
176 | + 'th' => view($this->module()->name().'::components/column-th-issourced', [ |
|
177 | 177 | 'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI')->label()) |
178 | 178 | ]), |
179 | - 'records' => $records->map(function (Individual $individual): array { |
|
179 | + 'records' => $records->map(function(Individual $individual): array { |
|
180 | 180 | $source_status = $this->source_status_service->sourceStatusForRecord($individual); |
181 | 181 | return [ |
182 | 182 | 'order' => $source_status->order(), |
183 | - 'text' => view($this->module()->name() . '::icons/source-status', [ |
|
183 | + 'text' => view($this->module()->name().'::icons/source-status', [ |
|
184 | 184 | 'module_name' => $this->module()->name(), |
185 | 185 | 'source_status' => $source_status, |
186 | 186 | 'context' => 'INDI', |
187 | - 'size_style' => '' ]) |
|
187 | + 'size_style' => '']) |
|
188 | 188 | ]; |
189 | 189 | })->toArray() |
190 | 190 | ], |
191 | 191 | 'birth' => [ |
192 | 192 | 'position' => 7, |
193 | - 'column_def' => [ 'class' => 'text-center' ], |
|
194 | - 'th' => view($this->module()->name() . '::components/column-th-issourced', [ |
|
193 | + 'column_def' => ['class' => 'text-center'], |
|
194 | + 'th' => view($this->module()->name().'::components/column-th-issourced', [ |
|
195 | 195 | 'title' => I18N::translate('%s sourced', Registry::elementFactory()->make('INDI:BIRT')->label()) |
196 | 196 | ]), |
197 | - 'records' => $records->map(function (Individual $individual): array { |
|
197 | + 'records' => $records->map(function(Individual $individual): array { |
|
198 | 198 | $source_status = $this->source_status_service->sourceStatusForBirth($individual); |
199 | 199 | return [ |
200 | 200 | 'order' => $source_status->order(), |
201 | - 'text' => view($this->module()->name() . '::icons/source-status', [ |
|
201 | + 'text' => view($this->module()->name().'::icons/source-status', [ |
|
202 | 202 | 'module_name' => $this->module()->name(), |
203 | 203 | 'source_status' => $source_status, |
204 | 204 | 'context' => 'INDI:BIRT', |
205 | - 'size_style' => '' ]) |
|
205 | + 'size_style' => '']) |
|
206 | 206 | ]; |
207 | 207 | })->toArray() |
208 | 208 | ] |
@@ -22,148 +22,148 @@ |
||
22 | 22 | */ |
23 | 23 | class SourceStatus |
24 | 24 | { |
25 | - /** |
|
26 | - * @var boolean $source_exist |
|
27 | - */ |
|
28 | - private $source_exist = false; |
|
29 | - |
|
30 | - /** |
|
31 | - * @var boolean $has_document |
|
32 | - */ |
|
33 | - private $has_document = false; |
|
34 | - |
|
35 | - /** |
|
36 | - * Return whether the SourceStatus object contains relevant data. |
|
37 | - * |
|
38 | - * @return bool |
|
39 | - */ |
|
40 | - public function isSet(): bool |
|
41 | - { |
|
42 | - return true; |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * Returns whether the record contains a source. |
|
47 | - * |
|
48 | - * @return bool |
|
49 | - */ |
|
50 | - public function hasSource(): bool |
|
51 | - { |
|
52 | - return $this->source_exist; |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * Set whether the record contains a source. |
|
57 | - * |
|
58 | - * @param bool $source_exist |
|
59 | - * @return $this |
|
60 | - */ |
|
61 | - public function setHasSource(bool $source_exist): self |
|
62 | - { |
|
63 | - $this->source_exist = $source_exist; |
|
64 | - return $this; |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * Combine whether the record contains a source with the previous status. |
|
69 | - * |
|
70 | - * @param bool $source_exist |
|
71 | - * @return $this |
|
72 | - */ |
|
73 | - public function addHasSource(bool $source_exist): self |
|
74 | - { |
|
75 | - $this->source_exist = $this->source_exist || $source_exist; |
|
76 | - return $this; |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * Return whether the source citation is supported by a document. |
|
81 | - * Uses the _ACT tag from the MyArtJaub Certificates module. |
|
82 | - * |
|
83 | - * @return bool |
|
84 | - */ |
|
85 | - public function hasSupportingDocument(): bool |
|
86 | - { |
|
87 | - return $this->hasSource() && $this->has_document; |
|
88 | - } |
|
89 | - |
|
90 | - /** |
|
91 | - * Set whether the source citation is supported by a document. |
|
92 | - * |
|
93 | - * @param bool $has_document |
|
94 | - * @return $this |
|
95 | - */ |
|
96 | - public function setHasSupportingDocument(bool $has_document): self |
|
97 | - { |
|
98 | - $this->has_document = $has_document; |
|
99 | - return $this; |
|
100 | - } |
|
101 | - |
|
102 | - /** |
|
103 | - * Combine whether the source citation is supported by a document with the previous status. |
|
104 | - * |
|
105 | - * @param bool $has_document |
|
106 | - * @return $this |
|
107 | - */ |
|
108 | - public function addHasSupportingDocument(bool $has_document): self |
|
109 | - { |
|
110 | - $this->has_document = $this->has_document || $has_document; |
|
111 | - return $this; |
|
112 | - } |
|
113 | - |
|
114 | - /** |
|
115 | - * Check whether all possible criteria for defining a sourced element have been met. |
|
116 | - * |
|
117 | - * @return bool |
|
118 | - */ |
|
119 | - public function isFullySourced(): bool |
|
120 | - { |
|
121 | - return $this->hasSupportingDocument(); |
|
122 | - } |
|
123 | - |
|
124 | - /** |
|
125 | - * Get the label to display to describe the source status. |
|
126 | - * |
|
127 | - * @param string $context |
|
128 | - * @return string |
|
129 | - */ |
|
130 | - public function label(string $context): string |
|
131 | - { |
|
132 | - $context_label = Registry::elementFactory()->make($context)->label(); |
|
133 | - |
|
134 | - if (!$this->hasSource()) { |
|
135 | - return I18N::translate('%s not sourced', $context_label); |
|
136 | - } |
|
137 | - |
|
138 | - if ($this->hasSupportingDocument()) { |
|
139 | - return I18N::translate('%s sourced with a certificate', $context_label); |
|
140 | - } |
|
141 | - |
|
142 | - return I18N::translate('%s sourced', $context_label); |
|
143 | - } |
|
144 | - |
|
145 | - /** |
|
146 | - * Get an indicative value to order source statuses |
|
147 | - * |
|
148 | - * @return int |
|
149 | - */ |
|
150 | - public function order(): int |
|
151 | - { |
|
152 | - return ($this->hasSource() ? 1 : 0) * (1 + ($this->hasSupportingDocument() ? 1 : 0)); |
|
153 | - } |
|
154 | - |
|
155 | - /** |
|
156 | - * Return an element combining properties of the current object with another SourceStatus. |
|
157 | - * Do not use the initial object anymore, it may not appropriately describe the status anymore. |
|
158 | - * |
|
159 | - * @template T of SourceStatus |
|
160 | - * @param T $other |
|
161 | - * @return $this|T |
|
162 | - */ |
|
163 | - public function combineWith(SourceStatus $other) |
|
164 | - { |
|
165 | - $this->addHasSource($other->hasSource()); |
|
166 | - $this->addHasSupportingDocument($other->hasSource()); |
|
167 | - return $this; |
|
168 | - } |
|
25 | + /** |
|
26 | + * @var boolean $source_exist |
|
27 | + */ |
|
28 | + private $source_exist = false; |
|
29 | + |
|
30 | + /** |
|
31 | + * @var boolean $has_document |
|
32 | + */ |
|
33 | + private $has_document = false; |
|
34 | + |
|
35 | + /** |
|
36 | + * Return whether the SourceStatus object contains relevant data. |
|
37 | + * |
|
38 | + * @return bool |
|
39 | + */ |
|
40 | + public function isSet(): bool |
|
41 | + { |
|
42 | + return true; |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * Returns whether the record contains a source. |
|
47 | + * |
|
48 | + * @return bool |
|
49 | + */ |
|
50 | + public function hasSource(): bool |
|
51 | + { |
|
52 | + return $this->source_exist; |
|
53 | + } |
|
54 | + |
|
55 | + /** |
|
56 | + * Set whether the record contains a source. |
|
57 | + * |
|
58 | + * @param bool $source_exist |
|
59 | + * @return $this |
|
60 | + */ |
|
61 | + public function setHasSource(bool $source_exist): self |
|
62 | + { |
|
63 | + $this->source_exist = $source_exist; |
|
64 | + return $this; |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * Combine whether the record contains a source with the previous status. |
|
69 | + * |
|
70 | + * @param bool $source_exist |
|
71 | + * @return $this |
|
72 | + */ |
|
73 | + public function addHasSource(bool $source_exist): self |
|
74 | + { |
|
75 | + $this->source_exist = $this->source_exist || $source_exist; |
|
76 | + return $this; |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * Return whether the source citation is supported by a document. |
|
81 | + * Uses the _ACT tag from the MyArtJaub Certificates module. |
|
82 | + * |
|
83 | + * @return bool |
|
84 | + */ |
|
85 | + public function hasSupportingDocument(): bool |
|
86 | + { |
|
87 | + return $this->hasSource() && $this->has_document; |
|
88 | + } |
|
89 | + |
|
90 | + /** |
|
91 | + * Set whether the source citation is supported by a document. |
|
92 | + * |
|
93 | + * @param bool $has_document |
|
94 | + * @return $this |
|
95 | + */ |
|
96 | + public function setHasSupportingDocument(bool $has_document): self |
|
97 | + { |
|
98 | + $this->has_document = $has_document; |
|
99 | + return $this; |
|
100 | + } |
|
101 | + |
|
102 | + /** |
|
103 | + * Combine whether the source citation is supported by a document with the previous status. |
|
104 | + * |
|
105 | + * @param bool $has_document |
|
106 | + * @return $this |
|
107 | + */ |
|
108 | + public function addHasSupportingDocument(bool $has_document): self |
|
109 | + { |
|
110 | + $this->has_document = $this->has_document || $has_document; |
|
111 | + return $this; |
|
112 | + } |
|
113 | + |
|
114 | + /** |
|
115 | + * Check whether all possible criteria for defining a sourced element have been met. |
|
116 | + * |
|
117 | + * @return bool |
|
118 | + */ |
|
119 | + public function isFullySourced(): bool |
|
120 | + { |
|
121 | + return $this->hasSupportingDocument(); |
|
122 | + } |
|
123 | + |
|
124 | + /** |
|
125 | + * Get the label to display to describe the source status. |
|
126 | + * |
|
127 | + * @param string $context |
|
128 | + * @return string |
|
129 | + */ |
|
130 | + public function label(string $context): string |
|
131 | + { |
|
132 | + $context_label = Registry::elementFactory()->make($context)->label(); |
|
133 | + |
|
134 | + if (!$this->hasSource()) { |
|
135 | + return I18N::translate('%s not sourced', $context_label); |
|
136 | + } |
|
137 | + |
|
138 | + if ($this->hasSupportingDocument()) { |
|
139 | + return I18N::translate('%s sourced with a certificate', $context_label); |
|
140 | + } |
|
141 | + |
|
142 | + return I18N::translate('%s sourced', $context_label); |
|
143 | + } |
|
144 | + |
|
145 | + /** |
|
146 | + * Get an indicative value to order source statuses |
|
147 | + * |
|
148 | + * @return int |
|
149 | + */ |
|
150 | + public function order(): int |
|
151 | + { |
|
152 | + return ($this->hasSource() ? 1 : 0) * (1 + ($this->hasSupportingDocument() ? 1 : 0)); |
|
153 | + } |
|
154 | + |
|
155 | + /** |
|
156 | + * Return an element combining properties of the current object with another SourceStatus. |
|
157 | + * Do not use the initial object anymore, it may not appropriately describe the status anymore. |
|
158 | + * |
|
159 | + * @template T of SourceStatus |
|
160 | + * @param T $other |
|
161 | + * @return $this|T |
|
162 | + */ |
|
163 | + public function combineWith(SourceStatus $other) |
|
164 | + { |
|
165 | + $this->addHasSource($other->hasSource()); |
|
166 | + $this->addHasSupportingDocument($other->hasSource()); |
|
167 | + return $this; |
|
168 | + } |
|
169 | 169 | } |
@@ -149,7 +149,7 @@ |
||
149 | 149 | */ |
150 | 150 | public function order(): int |
151 | 151 | { |
152 | - return ($this->hasSource() ? 1 : 0) * (1 + ($this->hasSupportingDocument() ? 1 : 0)); |
|
152 | + return ($this->hasSource() ? 1 : 0) * (1 + ($this->hasSupportingDocument() ? 1 : 0)); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
@@ -228,7 +228,7 @@ |
||
228 | 228 | public function order(): int |
229 | 229 | { |
230 | 230 | return ($this->factHasDate() ? 1 : 0) * ($this->hasSource() ? 1 : -1) * |
231 | - ( 1 + ($this->factHasPreciseDate() ? 1 : 0) * (1 + |
|
231 | + (1 + ($this->factHasPreciseDate() ? 1 : 0) * (1 + |
|
232 | 232 | 0b010 * ($this->sourceMatchesFactDate() ? 1 : 0) + |
233 | 233 | 0b100 * ($this->hasSupportingDocument() ? 1 : 0) |
234 | 234 | ) |
@@ -22,233 +22,233 @@ |
||
22 | 22 | */ |
23 | 23 | class FactSourceStatus extends SourceStatus |
24 | 24 | { |
25 | - /** |
|
26 | - * @var boolean $has_date |
|
27 | - */ |
|
28 | - private $has_date = false; |
|
29 | - |
|
30 | - /** |
|
31 | - * @var boolean $has_precise_date |
|
32 | - */ |
|
33 | - private $has_precise_date = false; |
|
34 | - |
|
35 | - /** |
|
36 | - * @var boolean $has_source_date |
|
37 | - */ |
|
38 | - private $has_source_date = false; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var boolean $source_date_match |
|
42 | - */ |
|
43 | - private $source_date_match = false; |
|
44 | - |
|
45 | - /** |
|
46 | - * Return whether the fact is dated. |
|
47 | - * |
|
48 | - * @return bool |
|
49 | - */ |
|
50 | - public function factHasDate(): bool |
|
51 | - { |
|
52 | - return $this->has_date; |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * Set whether the fact is dated. |
|
57 | - * |
|
58 | - * @param bool $has_date |
|
59 | - * @return $this |
|
60 | - */ |
|
61 | - public function setFactHasDate(bool $has_date): self |
|
62 | - { |
|
63 | - $this->has_date = $has_date; |
|
64 | - return $this; |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * Combinate whether the fact is dated with the previous status. |
|
69 | - * |
|
70 | - * @param bool $has_date |
|
71 | - * @return $this |
|
72 | - */ |
|
73 | - public function addFactHasDate(bool $has_date): self |
|
74 | - { |
|
75 | - $this->has_date = $this->has_date || $has_date; |
|
76 | - return $this; |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * Return whether the fact is dated with a precise day. |
|
81 | - * Any date modifier will be considered as not precise. |
|
82 | - * A month or year will be considered as not precise. |
|
83 | - * |
|
84 | - * @return bool |
|
85 | - */ |
|
86 | - public function factHasPreciseDate(): bool |
|
87 | - { |
|
88 | - return $this->has_date && $this->has_precise_date; |
|
89 | - } |
|
90 | - |
|
91 | - /** |
|
92 | - * Set whather the fact is dated with a precise day. |
|
93 | - * |
|
94 | - * @param bool $has_precise_date |
|
95 | - * @return $this |
|
96 | - */ |
|
97 | - public function setFactHasPreciseDate(bool $has_precise_date): self |
|
98 | - { |
|
99 | - $this->has_precise_date = $has_precise_date; |
|
100 | - return $this; |
|
101 | - } |
|
102 | - |
|
103 | - /** |
|
104 | - * Combine whether the fact is dated with a precise day. |
|
105 | - * |
|
106 | - * @param bool $has_precise_date |
|
107 | - * @return $this |
|
108 | - */ |
|
109 | - public function addFactHasPreciseDate(bool $has_precise_date): self |
|
110 | - { |
|
111 | - $this->has_precise_date = $this->has_precise_date || $has_precise_date; |
|
112 | - return $this; |
|
113 | - } |
|
114 | - |
|
115 | - /** |
|
116 | - * Return whether the source citation is dated. |
|
117 | - * |
|
118 | - * @return bool |
|
119 | - */ |
|
120 | - public function sourceHasDate(): bool |
|
121 | - { |
|
122 | - return $this->has_source_date; |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * Set whether the source citation is dated. |
|
127 | - * |
|
128 | - * @param bool $has_source_date |
|
129 | - * @return $this |
|
130 | - */ |
|
131 | - public function setSourceHasDate(bool $has_source_date): self |
|
132 | - { |
|
133 | - $this->has_source_date = $has_source_date; |
|
134 | - return $this; |
|
135 | - } |
|
136 | - |
|
137 | - /** |
|
138 | - * Combine whether the source citation is dated with the previous status. |
|
139 | - * |
|
140 | - * @param bool $has_source_date |
|
141 | - * @return $this |
|
142 | - */ |
|
143 | - public function addSourceHasDate(bool $has_source_date): self |
|
144 | - { |
|
145 | - $this->has_source_date = $this->has_source_date || $has_source_date; |
|
146 | - return $this; |
|
147 | - } |
|
148 | - |
|
149 | - /** |
|
150 | - * Return whether the source citation date is close to the fact date. |
|
151 | - * |
|
152 | - * @return bool |
|
153 | - */ |
|
154 | - public function sourceMatchesFactDate(): bool |
|
155 | - { |
|
156 | - return $this->has_precise_date && $this->has_source_date && $this->source_date_match; |
|
157 | - } |
|
158 | - |
|
159 | - /** |
|
160 | - * Set whether the source citation date is close to the fact date. |
|
161 | - * |
|
162 | - * @param bool $source_date_match |
|
163 | - * @return $this |
|
164 | - */ |
|
165 | - public function setSourceMatchesFactDate(bool $source_date_match): self |
|
166 | - { |
|
167 | - $this->source_date_match = $source_date_match; |
|
168 | - return $this; |
|
169 | - } |
|
170 | - |
|
171 | - /** |
|
172 | - * Combine whether the source citation date is close to the fact date with the previous status. |
|
173 | - * |
|
174 | - * @param bool $source_date_match |
|
175 | - * @return $this |
|
176 | - */ |
|
177 | - public function addSourceMatchesFactDate(bool $source_date_match): self |
|
178 | - { |
|
179 | - $this->source_date_match = $this->source_date_match || $source_date_match; |
|
180 | - return $this; |
|
181 | - } |
|
182 | - |
|
183 | - /** |
|
184 | - * {@inheritDoc} |
|
185 | - * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus::isFullySourced() |
|
186 | - */ |
|
187 | - public function isFullySourced(): bool |
|
188 | - { |
|
189 | - return parent::isFullySourced() && $this->sourceMatchesFactDate(); |
|
190 | - } |
|
191 | - |
|
192 | - /** |
|
193 | - * {@inheritDoc} |
|
194 | - * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus::label() |
|
195 | - */ |
|
196 | - public function label(string $context): string |
|
197 | - { |
|
198 | - $context_label = Registry::elementFactory()->make($context)->label(); |
|
199 | - |
|
200 | - if ($this->factHasPreciseDate()) { |
|
201 | - if ($this->hasSource()) { |
|
202 | - if ($this->hasSupportingDocument()) { |
|
203 | - if ($this->sourceMatchesFactDate()) { |
|
204 | - return I18N::translate('%s sourced with exact certificate', $context_label); |
|
205 | - } else { |
|
206 | - return I18N::translate('%s sourced with a certificate', $context_label); |
|
207 | - } |
|
208 | - } |
|
209 | - |
|
210 | - if ($this->sourceMatchesFactDate()) { |
|
211 | - return I18N::translate('%s precisely sourced', $context_label); |
|
212 | - } |
|
213 | - return I18N::translate('%s sourced', $context_label); |
|
214 | - } |
|
215 | - return I18N::translate('%s not sourced', $context_label); |
|
216 | - } |
|
217 | - |
|
218 | - if ($this->factHasDate()) { |
|
219 | - return I18N::translate('%s not precise', $context_label); |
|
220 | - } |
|
221 | - return I18N::translate('%s not found', $context_label); |
|
222 | - } |
|
223 | - |
|
224 | - /** |
|
225 | - * {@inheritDoc} |
|
226 | - * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus::order() |
|
227 | - */ |
|
228 | - public function order(): int |
|
229 | - { |
|
230 | - return ($this->factHasDate() ? 1 : 0) * ($this->hasSource() ? 1 : -1) * |
|
231 | - ( 1 + ($this->factHasPreciseDate() ? 1 : 0) * (1 + |
|
232 | - 0b010 * ($this->sourceMatchesFactDate() ? 1 : 0) + |
|
233 | - 0b100 * ($this->hasSupportingDocument() ? 1 : 0) |
|
234 | - ) |
|
235 | - ); |
|
236 | - } |
|
237 | - |
|
238 | - /** |
|
239 | - * {@inheritDoc} |
|
240 | - * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus::combineWith() |
|
241 | - */ |
|
242 | - public function combineWith(SourceStatus $other) |
|
243 | - { |
|
244 | - if ($other instanceof FactSourceStatus) { |
|
245 | - $this->addFactHasDate($other->factHasDate()); |
|
246 | - $this->addFactHasPreciseDate($other->factHasPreciseDate()); |
|
247 | - $this->addSourceHasDate($other->sourceHasDate()); |
|
248 | - $this->addSourceMatchesFactDate($other->sourceMatchesFactDate()); |
|
249 | - } |
|
250 | - |
|
251 | - parent::combineWith($other); |
|
252 | - return $this; |
|
253 | - } |
|
25 | + /** |
|
26 | + * @var boolean $has_date |
|
27 | + */ |
|
28 | + private $has_date = false; |
|
29 | + |
|
30 | + /** |
|
31 | + * @var boolean $has_precise_date |
|
32 | + */ |
|
33 | + private $has_precise_date = false; |
|
34 | + |
|
35 | + /** |
|
36 | + * @var boolean $has_source_date |
|
37 | + */ |
|
38 | + private $has_source_date = false; |
|
39 | + |
|
40 | + /** |
|
41 | + * @var boolean $source_date_match |
|
42 | + */ |
|
43 | + private $source_date_match = false; |
|
44 | + |
|
45 | + /** |
|
46 | + * Return whether the fact is dated. |
|
47 | + * |
|
48 | + * @return bool |
|
49 | + */ |
|
50 | + public function factHasDate(): bool |
|
51 | + { |
|
52 | + return $this->has_date; |
|
53 | + } |
|
54 | + |
|
55 | + /** |
|
56 | + * Set whether the fact is dated. |
|
57 | + * |
|
58 | + * @param bool $has_date |
|
59 | + * @return $this |
|
60 | + */ |
|
61 | + public function setFactHasDate(bool $has_date): self |
|
62 | + { |
|
63 | + $this->has_date = $has_date; |
|
64 | + return $this; |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * Combinate whether the fact is dated with the previous status. |
|
69 | + * |
|
70 | + * @param bool $has_date |
|
71 | + * @return $this |
|
72 | + */ |
|
73 | + public function addFactHasDate(bool $has_date): self |
|
74 | + { |
|
75 | + $this->has_date = $this->has_date || $has_date; |
|
76 | + return $this; |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * Return whether the fact is dated with a precise day. |
|
81 | + * Any date modifier will be considered as not precise. |
|
82 | + * A month or year will be considered as not precise. |
|
83 | + * |
|
84 | + * @return bool |
|
85 | + */ |
|
86 | + public function factHasPreciseDate(): bool |
|
87 | + { |
|
88 | + return $this->has_date && $this->has_precise_date; |
|
89 | + } |
|
90 | + |
|
91 | + /** |
|
92 | + * Set whather the fact is dated with a precise day. |
|
93 | + * |
|
94 | + * @param bool $has_precise_date |
|
95 | + * @return $this |
|
96 | + */ |
|
97 | + public function setFactHasPreciseDate(bool $has_precise_date): self |
|
98 | + { |
|
99 | + $this->has_precise_date = $has_precise_date; |
|
100 | + return $this; |
|
101 | + } |
|
102 | + |
|
103 | + /** |
|
104 | + * Combine whether the fact is dated with a precise day. |
|
105 | + * |
|
106 | + * @param bool $has_precise_date |
|
107 | + * @return $this |
|
108 | + */ |
|
109 | + public function addFactHasPreciseDate(bool $has_precise_date): self |
|
110 | + { |
|
111 | + $this->has_precise_date = $this->has_precise_date || $has_precise_date; |
|
112 | + return $this; |
|
113 | + } |
|
114 | + |
|
115 | + /** |
|
116 | + * Return whether the source citation is dated. |
|
117 | + * |
|
118 | + * @return bool |
|
119 | + */ |
|
120 | + public function sourceHasDate(): bool |
|
121 | + { |
|
122 | + return $this->has_source_date; |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * Set whether the source citation is dated. |
|
127 | + * |
|
128 | + * @param bool $has_source_date |
|
129 | + * @return $this |
|
130 | + */ |
|
131 | + public function setSourceHasDate(bool $has_source_date): self |
|
132 | + { |
|
133 | + $this->has_source_date = $has_source_date; |
|
134 | + return $this; |
|
135 | + } |
|
136 | + |
|
137 | + /** |
|
138 | + * Combine whether the source citation is dated with the previous status. |
|
139 | + * |
|
140 | + * @param bool $has_source_date |
|
141 | + * @return $this |
|
142 | + */ |
|
143 | + public function addSourceHasDate(bool $has_source_date): self |
|
144 | + { |
|
145 | + $this->has_source_date = $this->has_source_date || $has_source_date; |
|
146 | + return $this; |
|
147 | + } |
|
148 | + |
|
149 | + /** |
|
150 | + * Return whether the source citation date is close to the fact date. |
|
151 | + * |
|
152 | + * @return bool |
|
153 | + */ |
|
154 | + public function sourceMatchesFactDate(): bool |
|
155 | + { |
|
156 | + return $this->has_precise_date && $this->has_source_date && $this->source_date_match; |
|
157 | + } |
|
158 | + |
|
159 | + /** |
|
160 | + * Set whether the source citation date is close to the fact date. |
|
161 | + * |
|
162 | + * @param bool $source_date_match |
|
163 | + * @return $this |
|
164 | + */ |
|
165 | + public function setSourceMatchesFactDate(bool $source_date_match): self |
|
166 | + { |
|
167 | + $this->source_date_match = $source_date_match; |
|
168 | + return $this; |
|
169 | + } |
|
170 | + |
|
171 | + /** |
|
172 | + * Combine whether the source citation date is close to the fact date with the previous status. |
|
173 | + * |
|
174 | + * @param bool $source_date_match |
|
175 | + * @return $this |
|
176 | + */ |
|
177 | + public function addSourceMatchesFactDate(bool $source_date_match): self |
|
178 | + { |
|
179 | + $this->source_date_match = $this->source_date_match || $source_date_match; |
|
180 | + return $this; |
|
181 | + } |
|
182 | + |
|
183 | + /** |
|
184 | + * {@inheritDoc} |
|
185 | + * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus::isFullySourced() |
|
186 | + */ |
|
187 | + public function isFullySourced(): bool |
|
188 | + { |
|
189 | + return parent::isFullySourced() && $this->sourceMatchesFactDate(); |
|
190 | + } |
|
191 | + |
|
192 | + /** |
|
193 | + * {@inheritDoc} |
|
194 | + * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus::label() |
|
195 | + */ |
|
196 | + public function label(string $context): string |
|
197 | + { |
|
198 | + $context_label = Registry::elementFactory()->make($context)->label(); |
|
199 | + |
|
200 | + if ($this->factHasPreciseDate()) { |
|
201 | + if ($this->hasSource()) { |
|
202 | + if ($this->hasSupportingDocument()) { |
|
203 | + if ($this->sourceMatchesFactDate()) { |
|
204 | + return I18N::translate('%s sourced with exact certificate', $context_label); |
|
205 | + } else { |
|
206 | + return I18N::translate('%s sourced with a certificate', $context_label); |
|
207 | + } |
|
208 | + } |
|
209 | + |
|
210 | + if ($this->sourceMatchesFactDate()) { |
|
211 | + return I18N::translate('%s precisely sourced', $context_label); |
|
212 | + } |
|
213 | + return I18N::translate('%s sourced', $context_label); |
|
214 | + } |
|
215 | + return I18N::translate('%s not sourced', $context_label); |
|
216 | + } |
|
217 | + |
|
218 | + if ($this->factHasDate()) { |
|
219 | + return I18N::translate('%s not precise', $context_label); |
|
220 | + } |
|
221 | + return I18N::translate('%s not found', $context_label); |
|
222 | + } |
|
223 | + |
|
224 | + /** |
|
225 | + * {@inheritDoc} |
|
226 | + * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus::order() |
|
227 | + */ |
|
228 | + public function order(): int |
|
229 | + { |
|
230 | + return ($this->factHasDate() ? 1 : 0) * ($this->hasSource() ? 1 : -1) * |
|
231 | + ( 1 + ($this->factHasPreciseDate() ? 1 : 0) * (1 + |
|
232 | + 0b010 * ($this->sourceMatchesFactDate() ? 1 : 0) + |
|
233 | + 0b100 * ($this->hasSupportingDocument() ? 1 : 0) |
|
234 | + ) |
|
235 | + ); |
|
236 | + } |
|
237 | + |
|
238 | + /** |
|
239 | + * {@inheritDoc} |
|
240 | + * @see \MyArtJaub\Webtrees\Module\IsSourced\Data\SourceStatus::combineWith() |
|
241 | + */ |
|
242 | + public function combineWith(SourceStatus $other) |
|
243 | + { |
|
244 | + if ($other instanceof FactSourceStatus) { |
|
245 | + $this->addFactHasDate($other->factHasDate()); |
|
246 | + $this->addFactHasPreciseDate($other->factHasPreciseDate()); |
|
247 | + $this->addSourceHasDate($other->sourceHasDate()); |
|
248 | + $this->addSourceMatchesFactDate($other->sourceMatchesFactDate()); |
|
249 | + } |
|
250 | + |
|
251 | + parent::combineWith($other); |
|
252 | + return $this; |
|
253 | + } |
|
254 | 254 | } |
@@ -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 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function headContent(): string |
77 | 77 | { |
78 | - return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">'; |
|
78 | + return '<link rel="stylesheet" href="'.e($this->moduleCssUrl()).'">'; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function bodyContent(): string |
86 | 86 | { |
87 | - return '<script src="' . $this->assetUrl('js/issourced.min.js') . '"></script>'; |
|
87 | + return '<script src="'.$this->assetUrl('js/issourced.min.js').'"></script>'; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -106,14 +106,14 @@ discard block |
||
106 | 106 | $source_status_service = app(SourceStatusService::class); |
107 | 107 | |
108 | 108 | $spouse_families_status = $individual->spouseFamilies()->map( |
109 | - function (Family $sfamily) use ($source_status_service): array { |
|
110 | - return [ $sfamily, $source_status_service->sourceStatusForMarriage($sfamily)]; |
|
109 | + function(Family $sfamily) use ($source_status_service): array { |
|
110 | + return [$sfamily, $source_status_service->sourceStatusForMarriage($sfamily)]; |
|
111 | 111 | } |
112 | - )->filter(function (array $item): bool { |
|
112 | + )->filter(function(array $item): bool { |
|
113 | 113 | return $item[1]->isSet(); |
114 | 114 | }); |
115 | 115 | |
116 | - return view($this->name() . '::sidebar/content', [ |
|
116 | + return view($this->name().'::sidebar/content', [ |
|
117 | 117 | 'module_name' => $this->name(), |
118 | 118 | 'individual' => $individual, |
119 | 119 | 'source_status_individual' => $source_status_service->sourceStatusForRecord($individual), |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | public function listSubscribedHooks(): array |
131 | 131 | { |
132 | 132 | return [ |
133 | - app()->makeWith(IsSourcedStatusHook::class, [ 'module' => $this ]), |
|
134 | - app()->makeWith(IsSourcedStatusColumnsHook::class, [ 'module' => $this ]) |
|
133 | + app()->makeWith(IsSourcedStatusHook::class, ['module' => $this]), |
|
134 | + app()->makeWith(IsSourcedStatusColumnsHook::class, ['module' => $this]) |
|
135 | 135 | ]; |
136 | 136 | } |
137 | 137 | } |
@@ -33,105 +33,105 @@ |
||
33 | 33 | * IsSourced Module |
34 | 34 | */ |
35 | 35 | class IsSourcedModule extends AbstractModule implements |
36 | - ModuleMyArtJaubInterface, |
|
37 | - ModuleGlobalInterface, |
|
38 | - ModuleSidebarInterface, |
|
39 | - ModuleHookSubscriberInterface |
|
36 | + ModuleMyArtJaubInterface, |
|
37 | + ModuleGlobalInterface, |
|
38 | + ModuleSidebarInterface, |
|
39 | + ModuleHookSubscriberInterface |
|
40 | 40 | { |
41 | - use ModuleMyArtJaubTrait; |
|
42 | - use ModuleGlobalTrait; |
|
43 | - use ModuleSidebarTrait; |
|
41 | + use ModuleMyArtJaubTrait; |
|
42 | + use ModuleGlobalTrait; |
|
43 | + use ModuleSidebarTrait; |
|
44 | 44 | |
45 | - /** |
|
46 | - * {@inheritDoc} |
|
47 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
|
48 | - */ |
|
49 | - public function title(): string |
|
50 | - { |
|
51 | - return I18N::translate('Sourced events'); |
|
52 | - } |
|
45 | + /** |
|
46 | + * {@inheritDoc} |
|
47 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
|
48 | + */ |
|
49 | + public function title(): string |
|
50 | + { |
|
51 | + return I18N::translate('Sourced events'); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * {@inheritDoc} |
|
56 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::description() |
|
57 | - */ |
|
58 | - public function description(): string |
|
59 | - { |
|
60 | - return I18N::translate('Indicate if events related to an record are sourced.'); |
|
61 | - } |
|
54 | + /** |
|
55 | + * {@inheritDoc} |
|
56 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::description() |
|
57 | + */ |
|
58 | + public function description(): string |
|
59 | + { |
|
60 | + return I18N::translate('Indicate if events related to an record are sourced.'); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * {@inheritDoc} |
|
65 | - * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion() |
|
66 | - */ |
|
67 | - public function customModuleVersion(): string |
|
68 | - { |
|
69 | - return '2.1.1-v.1'; |
|
70 | - } |
|
63 | + /** |
|
64 | + * {@inheritDoc} |
|
65 | + * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion() |
|
66 | + */ |
|
67 | + public function customModuleVersion(): string |
|
68 | + { |
|
69 | + return '2.1.1-v.1'; |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * {@inheritDoc} |
|
74 | - * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent() |
|
75 | - */ |
|
76 | - public function headContent(): string |
|
77 | - { |
|
78 | - return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">'; |
|
79 | - } |
|
72 | + /** |
|
73 | + * {@inheritDoc} |
|
74 | + * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent() |
|
75 | + */ |
|
76 | + public function headContent(): string |
|
77 | + { |
|
78 | + return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">'; |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * {@inheritDoc} |
|
83 | - * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::bodyContent() |
|
84 | - */ |
|
85 | - public function bodyContent(): string |
|
86 | - { |
|
87 | - return '<script src="' . $this->assetUrl('js/issourced.min.js') . '"></script>'; |
|
88 | - } |
|
81 | + /** |
|
82 | + * {@inheritDoc} |
|
83 | + * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::bodyContent() |
|
84 | + */ |
|
85 | + public function bodyContent(): string |
|
86 | + { |
|
87 | + return '<script src="' . $this->assetUrl('js/issourced.min.js') . '"></script>'; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * {@inheritDoc} |
|
92 | - * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::hasSidebarContent() |
|
93 | - */ |
|
94 | - public function hasSidebarContent(Individual $individual): bool |
|
95 | - { |
|
96 | - return true; |
|
97 | - } |
|
90 | + /** |
|
91 | + * {@inheritDoc} |
|
92 | + * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::hasSidebarContent() |
|
93 | + */ |
|
94 | + public function hasSidebarContent(Individual $individual): bool |
|
95 | + { |
|
96 | + return true; |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * {@inheritDoc} |
|
101 | - * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::getSidebarContent() |
|
102 | - */ |
|
103 | - public function getSidebarContent(Individual $individual): string |
|
104 | - { |
|
105 | - /** @var SourceStatusService $source_status_service */ |
|
106 | - $source_status_service = app(SourceStatusService::class); |
|
99 | + /** |
|
100 | + * {@inheritDoc} |
|
101 | + * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::getSidebarContent() |
|
102 | + */ |
|
103 | + public function getSidebarContent(Individual $individual): string |
|
104 | + { |
|
105 | + /** @var SourceStatusService $source_status_service */ |
|
106 | + $source_status_service = app(SourceStatusService::class); |
|
107 | 107 | |
108 | - $spouse_families_status = $individual->spouseFamilies()->map( |
|
109 | - function (Family $sfamily) use ($source_status_service): array { |
|
110 | - return [ $sfamily, $source_status_service->sourceStatusForMarriage($sfamily)]; |
|
111 | - } |
|
112 | - )->filter(function (array $item): bool { |
|
113 | - return $item[1]->isSet(); |
|
114 | - }); |
|
108 | + $spouse_families_status = $individual->spouseFamilies()->map( |
|
109 | + function (Family $sfamily) use ($source_status_service): array { |
|
110 | + return [ $sfamily, $source_status_service->sourceStatusForMarriage($sfamily)]; |
|
111 | + } |
|
112 | + )->filter(function (array $item): bool { |
|
113 | + return $item[1]->isSet(); |
|
114 | + }); |
|
115 | 115 | |
116 | - return view($this->name() . '::sidebar/content', [ |
|
117 | - 'module_name' => $this->name(), |
|
118 | - 'individual' => $individual, |
|
119 | - 'source_status_individual' => $source_status_service->sourceStatusForRecord($individual), |
|
120 | - 'source_status_birth' => $source_status_service->sourceStatusForBirth($individual), |
|
121 | - 'source_status_marriages' => $spouse_families_status, |
|
122 | - 'source_status_death' => $source_status_service->sourceStatusForDeath($individual) |
|
123 | - ]); |
|
124 | - } |
|
116 | + return view($this->name() . '::sidebar/content', [ |
|
117 | + 'module_name' => $this->name(), |
|
118 | + 'individual' => $individual, |
|
119 | + 'source_status_individual' => $source_status_service->sourceStatusForRecord($individual), |
|
120 | + 'source_status_birth' => $source_status_service->sourceStatusForBirth($individual), |
|
121 | + 'source_status_marriages' => $spouse_families_status, |
|
122 | + 'source_status_death' => $source_status_service->sourceStatusForDeath($individual) |
|
123 | + ]); |
|
124 | + } |
|
125 | 125 | |
126 | - /** |
|
127 | - * {@inheritDoc} |
|
128 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks() |
|
129 | - */ |
|
130 | - public function listSubscribedHooks(): array |
|
131 | - { |
|
132 | - return [ |
|
133 | - app()->makeWith(IsSourcedStatusHook::class, [ 'module' => $this ]), |
|
134 | - app()->makeWith(IsSourcedStatusColumnsHook::class, [ 'module' => $this ]) |
|
135 | - ]; |
|
136 | - } |
|
126 | + /** |
|
127 | + * {@inheritDoc} |
|
128 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks() |
|
129 | + */ |
|
130 | + public function listSubscribedHooks(): array |
|
131 | + { |
|
132 | + return [ |
|
133 | + app()->makeWith(IsSourcedStatusHook::class, [ 'module' => $this ]), |
|
134 | + app()->makeWith(IsSourcedStatusColumnsHook::class, [ 'module' => $this ]) |
|
135 | + ]; |
|
136 | + } |
|
137 | 137 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | // How to update the database schema for this module |
56 | 56 | private const SCHEMA_TARGET_VERSION = 2; |
57 | 57 | private const SCHEMA_SETTING_NAME = 'MAJ_HOOKS_SCHEMA_VERSION'; |
58 | - private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema'; |
|
58 | + private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__.'\Schema'; |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * {@inheritDoc} |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function loadRoutes(Map $router): void |
98 | 98 | { |
99 | - $router->attach('', '', static function (Map $router): void { |
|
99 | + $router->attach('', '', static function(Map $router): void { |
|
100 | 100 | |
101 | - $router->attach('', '/module-maj/hooks', static function (Map $router): void { |
|
101 | + $router->attach('', '/module-maj/hooks', static function(Map $router): void { |
|
102 | 102 | |
103 | - $router->attach('', '/config/admin', static function (Map $router): void { |
|
103 | + $router->attach('', '/config/admin', static function(Map $router): void { |
|
104 | 104 | |
105 | 105 | $router->get(AdminConfigPage::class, '', AdminConfigPage::class); |
106 | 106 | $router->get(ModulesHooksPage::class, '/{hook_name}', ModulesHooksPage::class); |
@@ -42,106 +42,106 @@ |
||
42 | 42 | * Provide entry points to extend core webtrees code. |
43 | 43 | */ |
44 | 44 | class HooksModule extends AbstractModule implements |
45 | - ModuleMyArtJaubInterface, |
|
46 | - ModuleConfigInterface, |
|
47 | - ModuleHookSubscriberInterface |
|
45 | + ModuleMyArtJaubInterface, |
|
46 | + ModuleConfigInterface, |
|
47 | + ModuleHookSubscriberInterface |
|
48 | 48 | { |
49 | - use ModuleMyArtJaubTrait { |
|
50 | - boot as traitBoot; |
|
51 | - } |
|
52 | - use ModuleConfigTrait; |
|
53 | - |
|
54 | - // How to update the database schema for this module |
|
55 | - private const SCHEMA_TARGET_VERSION = 2; |
|
56 | - private const SCHEMA_SETTING_NAME = 'MAJ_HOOKS_SCHEMA_VERSION'; |
|
57 | - private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema'; |
|
58 | - |
|
59 | - /** |
|
60 | - * {@inheritDoc} |
|
61 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
|
62 | - */ |
|
63 | - public function title(): string |
|
64 | - { |
|
65 | - return /* I18N: Name of the “Hooks” module */ I18N::translate('Hooks'); |
|
66 | - } |
|
67 | - |
|
68 | - /** |
|
69 | - * {@inheritDoc} |
|
70 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::description() |
|
71 | - */ |
|
72 | - public function description(): string |
|
73 | - { |
|
74 | - return /* I18N: Description of the “Hooks” module */ I18N::translate('Implements hooks management.'); |
|
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * {@inheritDoc} |
|
79 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::boot() |
|
80 | - */ |
|
81 | - public function boot(): void |
|
82 | - { |
|
83 | - $this->traitBoot(); |
|
84 | - app()->bind(HookServiceInterface::class, HookService::class); |
|
85 | - app(MigrationService::class)->updateSchema( |
|
86 | - self::SCHEMA_MIGRATION_PREFIX, |
|
87 | - self::SCHEMA_SETTING_NAME, |
|
88 | - self::SCHEMA_TARGET_VERSION |
|
89 | - ); |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * {@inheritDoc} |
|
94 | - * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes() |
|
95 | - */ |
|
96 | - public function loadRoutes(Map $router): void |
|
97 | - { |
|
98 | - $router->attach('', '', static function (Map $router): void { |
|
99 | - |
|
100 | - $router->attach('', '/module-maj/hooks', static function (Map $router): void { |
|
101 | - |
|
102 | - $router->attach('', '/config/admin', static function (Map $router): void { |
|
103 | - |
|
104 | - $router->get(AdminConfigPage::class, '', AdminConfigPage::class); |
|
105 | - $router->get(ModulesHooksPage::class, '/{hook_name}', ModulesHooksPage::class); |
|
106 | - $router->post(ModulesHooksAction::class, '/{hook_name}', ModulesHooksAction::class); |
|
107 | - }); |
|
108 | - }); |
|
109 | - }); |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * {@inheritDoc} |
|
114 | - * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion() |
|
115 | - */ |
|
116 | - public function customModuleVersion(): string |
|
117 | - { |
|
118 | - return '2.1.1-v.1'; |
|
119 | - } |
|
120 | - |
|
121 | - /** |
|
122 | - * {@inheritDoc} |
|
123 | - * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
124 | - */ |
|
125 | - public function getConfigLink(): string |
|
126 | - { |
|
127 | - return route(AdminConfigPage::class); |
|
128 | - } |
|
129 | - |
|
130 | - /** |
|
131 | - * {@inheritDoc} |
|
132 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks() |
|
133 | - */ |
|
134 | - public function listSubscribedHooks(): array |
|
135 | - { |
|
136 | - return [ |
|
137 | - app()->makeWith(FactSourceTextExtenderCollector::class, ['module' => $this]), |
|
138 | - app()->makeWith(FamilyDatatablesExtenderCollector::class, ['module' => $this]), |
|
139 | - app()->makeWith(IndividualDatatablesExtenderCollector::class, ['module' => $this]), |
|
140 | - app()->makeWith(NameAccordionExtenderCollector::class, ['module' => $this]), |
|
141 | - app()->makeWith(RecordNameTextExtenderCollector::class, ['module' => $this]), |
|
142 | - app()->makeWith(SosaFamilyDatatablesExtenderCollector::class, ['module' => $this]), |
|
143 | - app()->makeWith(SosaIndividualDatatablesExtenderCollector::class, ['module' => $this]), |
|
144 | - app()->makeWith(SosaMissingDatatablesExtenderCollector::class, ['module' => $this]) |
|
145 | - ]; |
|
146 | - } |
|
49 | + use ModuleMyArtJaubTrait { |
|
50 | + boot as traitBoot; |
|
51 | + } |
|
52 | + use ModuleConfigTrait; |
|
53 | + |
|
54 | + // How to update the database schema for this module |
|
55 | + private const SCHEMA_TARGET_VERSION = 2; |
|
56 | + private const SCHEMA_SETTING_NAME = 'MAJ_HOOKS_SCHEMA_VERSION'; |
|
57 | + private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema'; |
|
58 | + |
|
59 | + /** |
|
60 | + * {@inheritDoc} |
|
61 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
|
62 | + */ |
|
63 | + public function title(): string |
|
64 | + { |
|
65 | + return /* I18N: Name of the “Hooks” module */ I18N::translate('Hooks'); |
|
66 | + } |
|
67 | + |
|
68 | + /** |
|
69 | + * {@inheritDoc} |
|
70 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::description() |
|
71 | + */ |
|
72 | + public function description(): string |
|
73 | + { |
|
74 | + return /* I18N: Description of the “Hooks” module */ I18N::translate('Implements hooks management.'); |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * {@inheritDoc} |
|
79 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::boot() |
|
80 | + */ |
|
81 | + public function boot(): void |
|
82 | + { |
|
83 | + $this->traitBoot(); |
|
84 | + app()->bind(HookServiceInterface::class, HookService::class); |
|
85 | + app(MigrationService::class)->updateSchema( |
|
86 | + self::SCHEMA_MIGRATION_PREFIX, |
|
87 | + self::SCHEMA_SETTING_NAME, |
|
88 | + self::SCHEMA_TARGET_VERSION |
|
89 | + ); |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * {@inheritDoc} |
|
94 | + * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes() |
|
95 | + */ |
|
96 | + public function loadRoutes(Map $router): void |
|
97 | + { |
|
98 | + $router->attach('', '', static function (Map $router): void { |
|
99 | + |
|
100 | + $router->attach('', '/module-maj/hooks', static function (Map $router): void { |
|
101 | + |
|
102 | + $router->attach('', '/config/admin', static function (Map $router): void { |
|
103 | + |
|
104 | + $router->get(AdminConfigPage::class, '', AdminConfigPage::class); |
|
105 | + $router->get(ModulesHooksPage::class, '/{hook_name}', ModulesHooksPage::class); |
|
106 | + $router->post(ModulesHooksAction::class, '/{hook_name}', ModulesHooksAction::class); |
|
107 | + }); |
|
108 | + }); |
|
109 | + }); |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * {@inheritDoc} |
|
114 | + * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion() |
|
115 | + */ |
|
116 | + public function customModuleVersion(): string |
|
117 | + { |
|
118 | + return '2.1.1-v.1'; |
|
119 | + } |
|
120 | + |
|
121 | + /** |
|
122 | + * {@inheritDoc} |
|
123 | + * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
124 | + */ |
|
125 | + public function getConfigLink(): string |
|
126 | + { |
|
127 | + return route(AdminConfigPage::class); |
|
128 | + } |
|
129 | + |
|
130 | + /** |
|
131 | + * {@inheritDoc} |
|
132 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks() |
|
133 | + */ |
|
134 | + public function listSubscribedHooks(): array |
|
135 | + { |
|
136 | + return [ |
|
137 | + app()->makeWith(FactSourceTextExtenderCollector::class, ['module' => $this]), |
|
138 | + app()->makeWith(FamilyDatatablesExtenderCollector::class, ['module' => $this]), |
|
139 | + app()->makeWith(IndividualDatatablesExtenderCollector::class, ['module' => $this]), |
|
140 | + app()->makeWith(NameAccordionExtenderCollector::class, ['module' => $this]), |
|
141 | + app()->makeWith(RecordNameTextExtenderCollector::class, ['module' => $this]), |
|
142 | + app()->makeWith(SosaFamilyDatatablesExtenderCollector::class, ['module' => $this]), |
|
143 | + app()->makeWith(SosaIndividualDatatablesExtenderCollector::class, ['module' => $this]), |
|
144 | + app()->makeWith(SosaMissingDatatablesExtenderCollector::class, ['module' => $this]) |
|
145 | + ]; |
|
146 | + } |
|
147 | 147 | } |
@@ -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 | } |