@@ -30,10 +30,10 @@ |
||
30 | 30 | * @param string $gedcom |
31 | 31 | * @return NULL|\MyArtJaub\Webtrees\Family |
32 | 32 | */ |
33 | - public static function getIntance($xref, Tree $tree, $gedcom = null){ |
|
33 | + public static function getIntance($xref, Tree $tree, $gedcom = null) { |
|
34 | 34 | $dfam = null; |
35 | 35 | $fam = fw\Family::getInstance($xref, $tree, $gedcom); |
36 | - if($fam){ |
|
36 | + if ($fam) { |
|
37 | 37 | $dfam = new Family($fam); |
38 | 38 | } |
39 | 39 | return $dfam; |
@@ -67,7 +67,7 @@ |
||
67 | 67 | if (($fact->getDate() || $fact->getPlace()) && $fact->canShow()) { |
68 | 68 | switch ($style) { |
69 | 69 | case 10: |
70 | - return '<i>'.$fact->getLabel().' '. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactDateShort($fact) .' '. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1') .'</i>'; |
|
70 | + return '<i>'.$fact->getLabel().' '. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactDateShort($fact) .' '. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1') .'</i>'; |
|
71 | 71 | default: |
72 | 72 | return $this->gedcomrecord->formatFirstMajorFact($facts, $style); |
73 | 73 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @param \Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in The GedcomRecord to extend |
29 | 29 | */ |
30 | - public function __construct(\Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in){ |
|
30 | + public function __construct(\Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in) { |
|
31 | 31 | $this->gedcomrecord = $gedcomrecord_in; |
32 | 32 | } |
33 | 33 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @return \Fisharebest\Webtrees\GedcomRecord Embedded gedcom record |
38 | 38 | */ |
39 | - public function getDerivedRecord(){ |
|
39 | + public function getDerivedRecord() { |
|
40 | 40 | return $this->gedcomrecord; |
41 | 41 | } |
42 | 42 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | if (($fact->getDate() || $fact->getPlace()) && $fact->canShow()) { |
68 | 68 | switch ($style) { |
69 | 69 | case 10: |
70 | - return '<i>'.$fact->getLabel().' '. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactDateShort($fact) .' '. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1') .'</i>'; |
|
70 | + return '<i>'.$fact->getLabel().' '.\MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactDateShort($fact).' '.\MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1').'</i>'; |
|
71 | 71 | default: |
72 | 72 | return $this->gedcomrecord->formatFirstMajorFact($facts, $style); |
73 | 73 | } |
@@ -19,10 +19,10 @@ |
||
19 | 19 | */ |
20 | 20 | interface ModuleMapDefinitionProviderInterface |
21 | 21 | { |
22 | - /** |
|
23 | - * List map definitions provided by the module as an array. |
|
24 | - * |
|
25 | - * @return MapDefinitionInterface[] List of map definitions |
|
26 | - */ |
|
27 | - public function listMapDefinition(): array; |
|
22 | + /** |
|
23 | + * List map definitions provided by the module as an array. |
|
24 | + * |
|
25 | + * @return MapDefinitionInterface[] List of map definitions |
|
26 | + */ |
|
27 | + public function listMapDefinition(): array; |
|
28 | 28 | } |
@@ -21,26 +21,26 @@ |
||
21 | 21 | */ |
22 | 22 | interface GeoAnalysisInterface |
23 | 23 | { |
24 | - /** |
|
25 | - * Get the geographical dispersion analysis title |
|
26 | - * |
|
27 | - * @return string |
|
28 | - */ |
|
29 | - function title(): string; |
|
24 | + /** |
|
25 | + * Get the geographical dispersion analysis title |
|
26 | + * |
|
27 | + * @return string |
|
28 | + */ |
|
29 | + function title(): string; |
|
30 | 30 | |
31 | - /** |
|
32 | - * Gets the function to translate |
|
33 | - * |
|
34 | - * @return callable(int $count): string |
|
35 | - */ |
|
36 | - function itemsDescription(): callable; |
|
31 | + /** |
|
32 | + * Gets the function to translate |
|
33 | + * |
|
34 | + * @return callable(int $count): string |
|
35 | + */ |
|
36 | + function itemsDescription(): callable; |
|
37 | 37 | |
38 | - /** |
|
39 | - * Get the results of the geographical dispersion analysis |
|
40 | - * |
|
41 | - * @param Tree $tree |
|
42 | - * @param int $depth |
|
43 | - * @return GeoAnalysisResults |
|
44 | - */ |
|
45 | - function results(Tree $tree, int $depth): GeoAnalysisResults; |
|
38 | + /** |
|
39 | + * Get the results of the geographical dispersion analysis |
|
40 | + * |
|
41 | + * @param Tree $tree |
|
42 | + * @param int $depth |
|
43 | + * @return GeoAnalysisResults |
|
44 | + */ |
|
45 | + function results(Tree $tree, int $depth): GeoAnalysisResults; |
|
46 | 46 | } |
47 | 47 | \ No newline at end of file |
@@ -18,24 +18,24 @@ |
||
18 | 18 | */ |
19 | 19 | interface MapDefinitionInterface |
20 | 20 | { |
21 | - /** |
|
22 | - * Get the map ID |
|
23 | - * |
|
24 | - * @return string |
|
25 | - */ |
|
26 | - function id(): string; |
|
21 | + /** |
|
22 | + * Get the map ID |
|
23 | + * |
|
24 | + * @return string |
|
25 | + */ |
|
26 | + function id(): string; |
|
27 | 27 | |
28 | - /** |
|
29 | - * Get the map title |
|
30 | - * |
|
31 | - * @return string |
|
32 | - */ |
|
33 | - function title(): string; |
|
28 | + /** |
|
29 | + * Get the map title |
|
30 | + * |
|
31 | + * @return string |
|
32 | + */ |
|
33 | + function title(): string; |
|
34 | 34 | |
35 | - /** |
|
36 | - * Get the features in the map |
|
37 | - * |
|
38 | - * @return \Brick\Geo\IO\GeoJSON\Feature[] |
|
39 | - */ |
|
40 | - function features(): array; |
|
35 | + /** |
|
36 | + * Get the features in the map |
|
37 | + * |
|
38 | + * @return \Brick\Geo\IO\GeoJSON\Feature[] |
|
39 | + */ |
|
40 | + function features(): array; |
|
41 | 41 | } |
42 | 42 | \ No newline at end of file |
@@ -30,43 +30,43 @@ |
||
30 | 30 | */ |
31 | 31 | class AuthTreePreference implements MiddlewareInterface |
32 | 32 | { |
33 | - /** |
|
34 | - * {@inheritDoc} |
|
35 | - * @see \Psr\Http\Server\MiddlewareInterface::process() |
|
36 | - */ |
|
37 | - public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
38 | - { |
|
39 | - $tree = $request->getAttribute('tree'); |
|
40 | - assert($tree instanceof Tree); |
|
41 | - /** @var Tree $tree */ |
|
33 | + /** |
|
34 | + * {@inheritDoc} |
|
35 | + * @see \Psr\Http\Server\MiddlewareInterface::process() |
|
36 | + */ |
|
37 | + public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
|
38 | + { |
|
39 | + $tree = $request->getAttribute('tree'); |
|
40 | + assert($tree instanceof Tree); |
|
41 | + /** @var Tree $tree */ |
|
42 | 42 | |
43 | - $route = $request->getAttribute('route'); |
|
44 | - assert($route instanceof \Aura\Router\Route); |
|
45 | - /** @var \Aura\Router\Route $route */ |
|
43 | + $route = $request->getAttribute('route'); |
|
44 | + assert($route instanceof \Aura\Router\Route); |
|
45 | + /** @var \Aura\Router\Route $route */ |
|
46 | 46 | |
47 | - $user = $request->getAttribute('user'); |
|
47 | + $user = $request->getAttribute('user'); |
|
48 | 48 | |
49 | - $permission_preference = $route->extras['permission_preference'] ?? ''; |
|
50 | - $permission_level = $permission_preference === '' ? '' : $tree->getPreference($permission_preference); |
|
49 | + $permission_preference = $route->extras['permission_preference'] ?? ''; |
|
50 | + $permission_level = $permission_preference === '' ? '' : $tree->getPreference($permission_preference); |
|
51 | 51 | |
52 | - // Permissions are configured |
|
53 | - if (is_numeric($permission_level)) { |
|
54 | - // Logged in with the correct role? |
|
55 | - if (Auth::accessLevel($tree, $user) <= (int) $permission_level) { |
|
56 | - return $handler->handle($request); |
|
57 | - } |
|
52 | + // Permissions are configured |
|
53 | + if (is_numeric($permission_level)) { |
|
54 | + // Logged in with the correct role? |
|
55 | + if (Auth::accessLevel($tree, $user) <= (int) $permission_level) { |
|
56 | + return $handler->handle($request); |
|
57 | + } |
|
58 | 58 | |
59 | - // Logged in, but without the correct role? |
|
60 | - if ($user instanceof User) { |
|
61 | - throw new HttpAccessDeniedException(); |
|
62 | - } |
|
63 | - } |
|
59 | + // Logged in, but without the correct role? |
|
60 | + if ($user instanceof User) { |
|
61 | + throw new HttpAccessDeniedException(); |
|
62 | + } |
|
63 | + } |
|
64 | 64 | |
65 | - // Permissions no configured, or not logged in |
|
66 | - if ($request->getMethod() === RequestMethodInterface::METHOD_POST) { |
|
67 | - throw new HttpAccessDeniedException(); |
|
68 | - } |
|
65 | + // Permissions no configured, or not logged in |
|
66 | + if ($request->getMethod() === RequestMethodInterface::METHOD_POST) { |
|
67 | + throw new HttpAccessDeniedException(); |
|
68 | + } |
|
69 | 69 | |
70 | - return redirect(route(LoginPage::class, ['tree' => $tree->name(), 'url' => $request->getUri()])); |
|
71 | - } |
|
70 | + return redirect(route(LoginPage::class, ['tree' => $tree->name(), 'url' => $request->getUri()])); |
|
71 | + } |
|
72 | 72 | } |
@@ -52,7 +52,7 @@ |
||
52 | 52 | // Permissions are configured |
53 | 53 | if (is_numeric($permission_level)) { |
54 | 54 | // Logged in with the correct role? |
55 | - if (Auth::accessLevel($tree, $user) <= (int) $permission_level) { |
|
55 | + if (Auth::accessLevel($tree, $user) <= (int)$permission_level) { |
|
56 | 56 | return $handler->handle($request); |
57 | 57 | } |
58 | 58 |
@@ -105,29 +105,29 @@ |
||
105 | 105 | * @return string|array Estimated birth place if found, null otherwise |
106 | 106 | */ |
107 | 107 | public function getSignificantPlace(){ |
108 | - if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
109 | - return $bplace; |
|
110 | - } |
|
108 | + if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
109 | + return $bplace; |
|
110 | + } |
|
111 | 111 | |
112 | - foreach ($this->gedcomrecord->getAllEventPlaces('RESI') as $rplace) { |
|
113 | - if ($rplace) { |
|
114 | - return $rplace; |
|
115 | - } |
|
116 | - } |
|
112 | + foreach ($this->gedcomrecord->getAllEventPlaces('RESI') as $rplace) { |
|
113 | + if ($rplace) { |
|
114 | + return $rplace; |
|
115 | + } |
|
116 | + } |
|
117 | 117 | |
118 | - if($dplace = $this->gedcomrecord->getDeathPlace()){ |
|
119 | - return $dplace; |
|
120 | - } |
|
118 | + if($dplace = $this->gedcomrecord->getDeathPlace()){ |
|
119 | + return $dplace; |
|
120 | + } |
|
121 | 121 | |
122 | - foreach($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
123 | - foreach ($fams->getAllEventPlaces('RESI') as $rplace) { |
|
124 | - if ($rplace) { |
|
125 | - return $rplace; |
|
126 | - } |
|
127 | - } |
|
128 | - } |
|
122 | + foreach($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
123 | + foreach ($fams->getAllEventPlaces('RESI') as $rplace) { |
|
124 | + if ($rplace) { |
|
125 | + return $rplace; |
|
126 | + } |
|
127 | + } |
|
128 | + } |
|
129 | 129 | |
130 | - return null; |
|
130 | + return null; |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | class Individual extends GedcomRecord { |
22 | 22 | |
23 | 23 | /** @var array|null List of titles the individal holds */ |
24 | - protected $titles=null; |
|
24 | + protected $titles = null; |
|
25 | 25 | |
26 | 26 | /** @var string|null Individual's primary surname, without any privacy applied to it */ |
27 | 27 | protected $unprotected_prim_surname = null; |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @param null|string $gedcom |
36 | 36 | * @return null|Individual |
37 | 37 | */ |
38 | - public static function getIntance($xref, Tree $tree, $gedcom = null){ |
|
38 | + public static function getIntance($xref, Tree $tree, $gedcom = null) { |
|
39 | 39 | $indi = \Fisharebest\Webtrees\Individual::getInstance($xref, $tree, $gedcom); |
40 | - if($indi){ |
|
40 | + if ($indi) { |
|
41 | 41 | return new Individual($indi); |
42 | 42 | } |
43 | 43 | return null; |
@@ -48,18 +48,18 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return array Array of titles |
50 | 50 | */ |
51 | - public function getTitles(){ |
|
52 | - if(is_null($this->titles) && $module = Module::getModuleByName(Constants::MODULE_MAJ_MISC_NAME)){ |
|
51 | + public function getTitles() { |
|
52 | + if (is_null($this->titles) && $module = Module::getModuleByName(Constants::MODULE_MAJ_MISC_NAME)) { |
|
53 | 53 | $pattern = '/(.*) (('.$module->getSetting('MAJ_TITLE_PREFIX', '').')(.*))/'; |
54 | - $this->titles=array(); |
|
54 | + $this->titles = array(); |
|
55 | 55 | $titlefacts = $this->gedcomrecord->getFacts('TITL'); |
56 | - foreach($titlefacts as $titlefact){ |
|
56 | + foreach ($titlefacts as $titlefact) { |
|
57 | 57 | $ct2 = preg_match_all($pattern, $titlefact->getValue(), $match2); |
58 | - if($ct2>0){ |
|
59 | - $this->titles[$match2[1][0]][]= trim($match2[2][0]); |
|
58 | + if ($ct2 > 0) { |
|
59 | + $this->titles[$match2[1][0]][] = trim($match2[2][0]); |
|
60 | 60 | } |
61 | - else{ |
|
62 | - $this->titles[$titlefact->getValue()][]=''; |
|
61 | + else { |
|
62 | + $this->titles[$titlefact->getValue()][] = ''; |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | } |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * @return string Primary surname |
74 | 74 | */ |
75 | 75 | public function getUnprotectedPrimarySurname() { |
76 | - if(!$this->unprotected_prim_surname){ |
|
77 | - $tmp=$this->gedcomrecord->getAllNames(); |
|
76 | + if (!$this->unprotected_prim_surname) { |
|
77 | + $tmp = $this->gedcomrecord->getAllNames(); |
|
78 | 78 | $this->unprotected_prim_surname = $tmp[$this->gedcomrecord->getPrimaryName()]['surname']; |
79 | 79 | } |
80 | 80 | return $this->unprotected_prim_surname; |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | * @param boolean $perc Should the coefficient of reliability be returned |
87 | 87 | * @return string|array Estimated birth place if found, null otherwise |
88 | 88 | */ |
89 | - public function getEstimatedBirthPlace($perc=false){ |
|
90 | - if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
91 | - if($perc){ |
|
92 | - return array ($bplace, 1); |
|
89 | + public function getEstimatedBirthPlace($perc = false) { |
|
90 | + if ($bplace = $this->gedcomrecord->getBirthPlace()) { |
|
91 | + if ($perc) { |
|
92 | + return array($bplace, 1); |
|
93 | 93 | } |
94 | - else{ |
|
94 | + else { |
|
95 | 95 | return $bplace; |
96 | 96 | } |
97 | 97 | } |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param boolean $perc Should the coefficient of reliability be returned |
105 | 105 | * @return string|array Estimated birth place if found, null otherwise |
106 | 106 | */ |
107 | - public function getSignificantPlace(){ |
|
108 | - if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
107 | + public function getSignificantPlace() { |
|
108 | + if ($bplace = $this->gedcomrecord->getBirthPlace()) { |
|
109 | 109 | return $bplace; |
110 | 110 | } |
111 | 111 | |
@@ -115,11 +115,11 @@ discard block |
||
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | - if($dplace = $this->gedcomrecord->getDeathPlace()){ |
|
118 | + if ($dplace = $this->gedcomrecord->getDeathPlace()) { |
|
119 | 119 | return $dplace; |
120 | 120 | } |
121 | 121 | |
122 | - foreach($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
122 | + foreach ($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
123 | 123 | foreach ($fams->getAllEventPlaces('RESI') as $rplace) { |
124 | 124 | if ($rplace) { |
125 | 125 | return $rplace; |
@@ -57,8 +57,7 @@ discard block |
||
57 | 57 | $ct2 = preg_match_all($pattern, $titlefact->getValue(), $match2); |
58 | 58 | if($ct2>0){ |
59 | 59 | $this->titles[$match2[1][0]][]= trim($match2[2][0]); |
60 | - } |
|
61 | - else{ |
|
60 | + } else{ |
|
62 | 61 | $this->titles[$titlefact->getValue()][]=''; |
63 | 62 | } |
64 | 63 | } |
@@ -90,8 +89,7 @@ discard block |
||
90 | 89 | if($bplace = $this->gedcomrecord->getBirthPlace()){ |
91 | 90 | if($perc){ |
92 | 91 | return array ($bplace, 1); |
93 | - } |
|
94 | - else{ |
|
92 | + } else{ |
|
95 | 93 | return $bplace; |
96 | 94 | } |
97 | 95 | } |
@@ -31,69 +31,69 @@ |
||
31 | 31 | */ |
32 | 32 | class LineagesPage implements RequestHandlerInterface |
33 | 33 | { |
34 | - use ViewResponseTrait; |
|
35 | - |
|
36 | - /** |
|
37 | - * @var PatronymicLineageModule|null $module |
|
38 | - */ |
|
39 | - private $module; |
|
40 | - |
|
41 | - /** |
|
42 | - * @var IndividualListModule|null $indilist_module |
|
43 | - */ |
|
44 | - private $indilist_module; |
|
45 | - |
|
46 | - /** |
|
47 | - * Constructor for LineagesPage Request handler |
|
48 | - * |
|
49 | - * @param ModuleService $module_service |
|
50 | - */ |
|
51 | - public function __construct(ModuleService $module_service) |
|
52 | - { |
|
53 | - $this->module = $module_service->findByInterface(PatronymicLineageModule::class)->first(); |
|
54 | - $this->indilist_module = $module_service->findByInterface(IndividualListModule::class)->first(); |
|
55 | - } |
|
56 | - |
|
57 | - /** |
|
58 | - * {@inheritDoc} |
|
59 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
60 | - */ |
|
61 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
62 | - { |
|
63 | - if ($this->module === null) { |
|
64 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
65 | - } |
|
66 | - |
|
67 | - if ($this->indilist_module === null) { |
|
68 | - throw new HttpNotFoundException(I18N::translate('There is no module to handle individual lists.')); |
|
69 | - } |
|
70 | - |
|
71 | - $tree = $request->getAttribute('tree'); |
|
72 | - assert($tree instanceof Tree); |
|
73 | - |
|
74 | - $surname = $request->getAttribute('surname'); |
|
75 | - |
|
76 | - $initial = mb_substr($surname, 0, 1); |
|
77 | - $initials_list = collect($this->indilist_module->surnameAlpha($tree, false, false, I18N::locale())) |
|
78 | - ->reject(function (int $count, string $initial): bool { |
|
79 | - |
|
80 | - return $initial === '@' || $initial === ','; |
|
81 | - }); |
|
82 | - |
|
83 | - $title = I18N::translate('Patronymic Lineages') . ' — ' . $surname; |
|
84 | - |
|
85 | - $lineages = app()->make(LineageBuilder::class, ['surname' => $surname])->buildLineages(); |
|
86 | - |
|
87 | - return $this->viewResponse($this->module->name() . '::lineages-page', [ |
|
88 | - 'title' => $title, |
|
89 | - 'module' => $this->module, |
|
90 | - 'tree' => $tree, |
|
91 | - 'initials_list' => $initials_list, |
|
92 | - 'initial' => $initial, |
|
93 | - 'show_all' => 'no', |
|
94 | - 'surname' => $surname, |
|
95 | - 'lineages' => $lineages, |
|
96 | - 'nb_lineages' => $lineages !== null ? $lineages->count() : 0 |
|
97 | - ]); |
|
98 | - } |
|
34 | + use ViewResponseTrait; |
|
35 | + |
|
36 | + /** |
|
37 | + * @var PatronymicLineageModule|null $module |
|
38 | + */ |
|
39 | + private $module; |
|
40 | + |
|
41 | + /** |
|
42 | + * @var IndividualListModule|null $indilist_module |
|
43 | + */ |
|
44 | + private $indilist_module; |
|
45 | + |
|
46 | + /** |
|
47 | + * Constructor for LineagesPage Request handler |
|
48 | + * |
|
49 | + * @param ModuleService $module_service |
|
50 | + */ |
|
51 | + public function __construct(ModuleService $module_service) |
|
52 | + { |
|
53 | + $this->module = $module_service->findByInterface(PatronymicLineageModule::class)->first(); |
|
54 | + $this->indilist_module = $module_service->findByInterface(IndividualListModule::class)->first(); |
|
55 | + } |
|
56 | + |
|
57 | + /** |
|
58 | + * {@inheritDoc} |
|
59 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
60 | + */ |
|
61 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
62 | + { |
|
63 | + if ($this->module === null) { |
|
64 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
65 | + } |
|
66 | + |
|
67 | + if ($this->indilist_module === null) { |
|
68 | + throw new HttpNotFoundException(I18N::translate('There is no module to handle individual lists.')); |
|
69 | + } |
|
70 | + |
|
71 | + $tree = $request->getAttribute('tree'); |
|
72 | + assert($tree instanceof Tree); |
|
73 | + |
|
74 | + $surname = $request->getAttribute('surname'); |
|
75 | + |
|
76 | + $initial = mb_substr($surname, 0, 1); |
|
77 | + $initials_list = collect($this->indilist_module->surnameAlpha($tree, false, false, I18N::locale())) |
|
78 | + ->reject(function (int $count, string $initial): bool { |
|
79 | + |
|
80 | + return $initial === '@' || $initial === ','; |
|
81 | + }); |
|
82 | + |
|
83 | + $title = I18N::translate('Patronymic Lineages') . ' — ' . $surname; |
|
84 | + |
|
85 | + $lineages = app()->make(LineageBuilder::class, ['surname' => $surname])->buildLineages(); |
|
86 | + |
|
87 | + return $this->viewResponse($this->module->name() . '::lineages-page', [ |
|
88 | + 'title' => $title, |
|
89 | + 'module' => $this->module, |
|
90 | + 'tree' => $tree, |
|
91 | + 'initials_list' => $initials_list, |
|
92 | + 'initial' => $initial, |
|
93 | + 'show_all' => 'no', |
|
94 | + 'surname' => $surname, |
|
95 | + 'lineages' => $lineages, |
|
96 | + 'nb_lineages' => $lineages !== null ? $lineages->count() : 0 |
|
97 | + ]); |
|
98 | + } |
|
99 | 99 | } |
@@ -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, |
@@ -30,74 +30,74 @@ |
||
30 | 30 | */ |
31 | 31 | class SurnamesList implements RequestHandlerInterface |
32 | 32 | { |
33 | - use ViewResponseTrait; |
|
34 | - |
|
35 | - /** |
|
36 | - * @var PatronymicLineageModule|null $module |
|
37 | - */ |
|
38 | - private $module; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var IndividualListModule|null $indilist_module |
|
42 | - */ |
|
43 | - private $indilist_module; |
|
44 | - |
|
45 | - /** |
|
46 | - * Constructor for SurnamesList Request Handler |
|
47 | - * |
|
48 | - * @param ModuleService $module_service |
|
49 | - */ |
|
50 | - public function __construct(ModuleService $module_service) |
|
51 | - { |
|
52 | - $this->module = $module_service->findByInterface(PatronymicLineageModule::class)->first(); |
|
53 | - $this->indilist_module = $module_service->findByInterface(IndividualListModule::class)->first(); |
|
54 | - } |
|
55 | - |
|
56 | - /** |
|
57 | - * {@inheritDoc} |
|
58 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
59 | - */ |
|
60 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
61 | - { |
|
62 | - if ($this->module === null) { |
|
63 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
64 | - } |
|
65 | - |
|
66 | - if ($this->indilist_module === null) { |
|
67 | - throw new HttpNotFoundException(I18N::translate('There is no module to handle individual lists.')); |
|
68 | - } |
|
69 | - |
|
70 | - $tree = $request->getAttribute('tree'); |
|
71 | - assert($tree instanceof Tree); |
|
72 | - |
|
73 | - $initial = $request->getAttribute('alpha'); |
|
74 | - $initials_list = collect($this->indilist_module->surnameAlpha($tree, false, false, I18N::locale())) |
|
75 | - ->reject(function (int $count, string $initial): bool { |
|
76 | - |
|
77 | - return $initial === '@' || $initial === ','; |
|
78 | - }); |
|
79 | - |
|
80 | - $show_all = $request->getQueryParams()['show_all'] ?? 'no'; |
|
81 | - |
|
82 | - if ($show_all === 'yes') { |
|
83 | - $title = I18N::translate('Patronymic Lineages') . ' — ' . I18N::translate('All'); |
|
84 | - $surnames = $this->indilist_module->surnames($tree, '', '', false, false, I18N::locale()); |
|
85 | - } elseif ($initial !== null && mb_strlen($initial) == 1) { |
|
86 | - $title = I18N::translate('Patronymic Lineages') . ' — ' . $initial; |
|
87 | - $surnames = $this->indilist_module->surnames($tree, '', $initial, false, false, I18N::locale()); |
|
88 | - } else { |
|
89 | - $title = I18N::translate('Patronymic Lineages'); |
|
90 | - $surnames = []; |
|
91 | - } |
|
92 | - |
|
93 | - return $this->viewResponse($this->module->name() . '::surnames-page', [ |
|
94 | - 'title' => $title, |
|
95 | - 'module' => $this->module, |
|
96 | - 'tree' => $tree, |
|
97 | - 'initials_list' => $initials_list, |
|
98 | - 'initial' => $initial, |
|
99 | - 'show_all' => $show_all, |
|
100 | - 'surnames' => $surnames |
|
101 | - ]); |
|
102 | - } |
|
33 | + use ViewResponseTrait; |
|
34 | + |
|
35 | + /** |
|
36 | + * @var PatronymicLineageModule|null $module |
|
37 | + */ |
|
38 | + private $module; |
|
39 | + |
|
40 | + /** |
|
41 | + * @var IndividualListModule|null $indilist_module |
|
42 | + */ |
|
43 | + private $indilist_module; |
|
44 | + |
|
45 | + /** |
|
46 | + * Constructor for SurnamesList Request Handler |
|
47 | + * |
|
48 | + * @param ModuleService $module_service |
|
49 | + */ |
|
50 | + public function __construct(ModuleService $module_service) |
|
51 | + { |
|
52 | + $this->module = $module_service->findByInterface(PatronymicLineageModule::class)->first(); |
|
53 | + $this->indilist_module = $module_service->findByInterface(IndividualListModule::class)->first(); |
|
54 | + } |
|
55 | + |
|
56 | + /** |
|
57 | + * {@inheritDoc} |
|
58 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
59 | + */ |
|
60 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
61 | + { |
|
62 | + if ($this->module === null) { |
|
63 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
64 | + } |
|
65 | + |
|
66 | + if ($this->indilist_module === null) { |
|
67 | + throw new HttpNotFoundException(I18N::translate('There is no module to handle individual lists.')); |
|
68 | + } |
|
69 | + |
|
70 | + $tree = $request->getAttribute('tree'); |
|
71 | + assert($tree instanceof Tree); |
|
72 | + |
|
73 | + $initial = $request->getAttribute('alpha'); |
|
74 | + $initials_list = collect($this->indilist_module->surnameAlpha($tree, false, false, I18N::locale())) |
|
75 | + ->reject(function (int $count, string $initial): bool { |
|
76 | + |
|
77 | + return $initial === '@' || $initial === ','; |
|
78 | + }); |
|
79 | + |
|
80 | + $show_all = $request->getQueryParams()['show_all'] ?? 'no'; |
|
81 | + |
|
82 | + if ($show_all === 'yes') { |
|
83 | + $title = I18N::translate('Patronymic Lineages') . ' — ' . I18N::translate('All'); |
|
84 | + $surnames = $this->indilist_module->surnames($tree, '', '', false, false, I18N::locale()); |
|
85 | + } elseif ($initial !== null && mb_strlen($initial) == 1) { |
|
86 | + $title = I18N::translate('Patronymic Lineages') . ' — ' . $initial; |
|
87 | + $surnames = $this->indilist_module->surnames($tree, '', $initial, false, false, I18N::locale()); |
|
88 | + } else { |
|
89 | + $title = I18N::translate('Patronymic Lineages'); |
|
90 | + $surnames = []; |
|
91 | + } |
|
92 | + |
|
93 | + return $this->viewResponse($this->module->name() . '::surnames-page', [ |
|
94 | + 'title' => $title, |
|
95 | + 'module' => $this->module, |
|
96 | + 'tree' => $tree, |
|
97 | + 'initials_list' => $initials_list, |
|
98 | + 'initial' => $initial, |
|
99 | + 'show_all' => $show_all, |
|
100 | + 'surnames' => $surnames |
|
101 | + ]); |
|
102 | + } |
|
103 | 103 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | $initial = $request->getAttribute('alpha'); |
74 | 74 | $initials_list = collect($this->indilist_module->surnameAlpha($tree, false, false, I18N::locale())) |
75 | - ->reject(function (int $count, string $initial): bool { |
|
75 | + ->reject(function(int $count, string $initial): bool { |
|
76 | 76 | |
77 | 77 | return $initial === '@' || $initial === ','; |
78 | 78 | }); |
@@ -80,17 +80,17 @@ discard block |
||
80 | 80 | $show_all = $request->getQueryParams()['show_all'] ?? 'no'; |
81 | 81 | |
82 | 82 | if ($show_all === 'yes') { |
83 | - $title = I18N::translate('Patronymic Lineages') . ' — ' . I18N::translate('All'); |
|
83 | + $title = I18N::translate('Patronymic Lineages').' — '.I18N::translate('All'); |
|
84 | 84 | $surnames = $this->indilist_module->surnames($tree, '', '', false, false, I18N::locale()); |
85 | 85 | } elseif ($initial !== null && mb_strlen($initial) == 1) { |
86 | - $title = I18N::translate('Patronymic Lineages') . ' — ' . $initial; |
|
86 | + $title = I18N::translate('Patronymic Lineages').' — '.$initial; |
|
87 | 87 | $surnames = $this->indilist_module->surnames($tree, '', $initial, false, false, I18N::locale()); |
88 | 88 | } else { |
89 | - $title = I18N::translate('Patronymic Lineages'); |
|
89 | + $title = I18N::translate('Patronymic Lineages'); |
|
90 | 90 | $surnames = []; |
91 | 91 | } |
92 | 92 | |
93 | - return $this->viewResponse($this->module->name() . '::surnames-page', [ |
|
93 | + return $this->viewResponse($this->module->name().'::surnames-page', [ |
|
94 | 94 | 'title' => $title, |
95 | 95 | 'module' => $this->module, |
96 | 96 | 'tree' => $tree, |