@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | /** @var SosaStatisticsService $sosa_stats_service */ |
72 | 72 | $sosa_stats_service = app()->makeWith(SosaStatisticsService::class, ['tree' => $tree, 'user' => $user]); |
73 | 73 | |
74 | - return $this->viewResponse($this->module->name() . '::statistics-page', [ |
|
74 | + return $this->viewResponse($this->module->name().'::statistics-page', [ |
|
75 | 75 | 'module_name' => $this->module->name(), |
76 | 76 | 'title' => I18N::translate('Sosa Statistics'), |
77 | 77 | 'tree' => $tree, |
@@ -126,37 +126,34 @@ discard block |
||
126 | 126 | |
127 | 127 | foreach ($stats_by_gen as $gen => $stats_gen) { |
128 | 128 | $gen_diff = $gen > 1 ? |
129 | - (int) $stats_gen['diffSosaTotalCount'] - (int) $stats_by_gen[$gen - 1]['diffSosaTotalCount'] : |
|
130 | - 1; |
|
129 | + (int)$stats_gen['diffSosaTotalCount'] - (int)$stats_by_gen[$gen - 1]['diffSosaTotalCount'] : 1; |
|
131 | 130 | $generation_stats[$gen] = array( |
132 | - 'gen_min_birth' => $stats_gen['firstBirth'] ?? (int) $stats_gen['firstEstimatedBirth'], |
|
133 | - 'gen_max_birth' => $stats_gen['lastBirth'] ?? (int) $stats_gen['lastEstimatedBirth'], |
|
131 | + 'gen_min_birth' => $stats_gen['firstBirth'] ?? (int)$stats_gen['firstEstimatedBirth'], |
|
132 | + 'gen_max_birth' => $stats_gen['lastBirth'] ?? (int)$stats_gen['lastEstimatedBirth'], |
|
134 | 133 | 'theoretical' => BigInteger::of(2)->power($gen - 1)->toInt(), |
135 | - 'known' => (int) $stats_gen['sosaCount'], |
|
134 | + 'known' => (int)$stats_gen['sosaCount'], |
|
136 | 135 | 'perc_known' => $this->safeDivision( |
137 | - BigInteger::of((int) $stats_gen['sosaCount']), |
|
136 | + BigInteger::of((int)$stats_gen['sosaCount']), |
|
138 | 137 | BigInteger::of(2)->power($gen - 1) |
139 | 138 | ), |
140 | 139 | 'missing' => $gen > 1 ? |
141 | - 2 * (int) $stats_by_gen[$gen - 1]['sosaCount'] - (int) $stats_gen['sosaCount'] : |
|
142 | - 0, |
|
140 | + 2 * (int)$stats_by_gen[$gen - 1]['sosaCount'] - (int)$stats_gen['sosaCount'] : 0, |
|
143 | 141 | 'perc_missing' => $gen > 1 ? |
144 | 142 | 1 - $this->safeDivision( |
145 | - BigInteger::of((int) $stats_gen['sosaCount']), |
|
146 | - BigInteger::of(2 * (int) $stats_by_gen[$gen - 1]['sosaCount']) |
|
147 | - ) : |
|
148 | - 0, |
|
149 | - 'total_known' => (int) $stats_gen['sosaTotalCount'], |
|
143 | + BigInteger::of((int)$stats_gen['sosaCount']), |
|
144 | + BigInteger::of(2 * (int)$stats_by_gen[$gen - 1]['sosaCount']) |
|
145 | + ) : 0, |
|
146 | + 'total_known' => (int)$stats_gen['sosaTotalCount'], |
|
150 | 147 | 'perc_total_known' => $this->safeDivision( |
151 | - BigInteger::of((int) $stats_gen['sosaTotalCount']), |
|
148 | + BigInteger::of((int)$stats_gen['sosaTotalCount']), |
|
152 | 149 | BigInteger::of(2)->power($gen)->minus(1) |
153 | 150 | ), |
154 | 151 | 'different' => $gen_diff, |
155 | 152 | 'perc_different' => $this->safeDivision( |
156 | 153 | BigInteger::of($gen_diff), |
157 | - BigInteger::of((int) $stats_gen['sosaCount']) |
|
154 | + BigInteger::of((int)$stats_gen['sosaCount']) |
|
158 | 155 | ), |
159 | - 'total_different' => (int) $stats_gen['diffSosaTotalCount'] |
|
156 | + 'total_different' => (int)$stats_gen['diffSosaTotalCount'] |
|
160 | 157 | ); |
161 | 158 | } |
162 | 159 |
@@ -67,10 +67,10 @@ |
||
67 | 67 | $sosa_stats_service = app()->makeWith(SosaStatisticsService::class, ['tree' => $tree, 'user' => $user]); |
68 | 68 | $pedi_collapse_data = $sosa_stats_service->pedigreeCollapseByGenerationData(); |
69 | 69 | |
70 | - $response = [ 'cells' => [] ]; |
|
70 | + $response = ['cells' => []]; |
|
71 | 71 | $last_pedi_collapse = 0; |
72 | 72 | foreach ($pedi_collapse_data as $gen => $rec) { |
73 | - $response['cells'][$gen] = view($this->module->name() . '::components/pedigree-collapse-cell', [ |
|
73 | + $response['cells'][$gen] = view($this->module->name().'::components/pedigree-collapse-cell', [ |
|
74 | 74 | 'pedi_collapse_roots' => $rec['pedi_collapse_roots'], |
75 | 75 | 'pedi_collapse_xgen' => $rec['pedi_collapse_xgen'] |
76 | 76 | ]); |
@@ -57,7 +57,7 @@ |
||
57 | 57 | $params = $request->getParsedBody(); |
58 | 58 | assert(is_array($params)); |
59 | 59 | |
60 | - $user_id = (int) $params['sosa-userid']; |
|
60 | + $user_id = (int)$params['sosa-userid']; |
|
61 | 61 | $root_id = $params['sosa-rootid'] ?? ''; |
62 | 62 | $max_gen = $params['sosa-maxgen'] ?? ''; |
63 | 63 |
@@ -86,16 +86,15 @@ |
||
86 | 86 | $max_gen_system = app(SosaRecordsService::class)->maxSystemGenerations(); |
87 | 87 | foreach ($users_root as $key => $user_root) { |
88 | 88 | $users_root[$key]['max_gen'] = is_numeric($user_root['max_gen']) ? |
89 | - (int) $user_root['max_gen'] : |
|
90 | - $max_gen_system; |
|
89 | + (int)$user_root['max_gen'] : $max_gen_system; |
|
91 | 90 | }; |
92 | 91 | |
93 | - return $this->viewResponse($this->module->name() . '::config-page', [ |
|
92 | + return $this->viewResponse($this->module->name().'::config-page', [ |
|
94 | 93 | 'module_name' => $this->module->name(), |
95 | 94 | 'title' => I18N::translate('Sosa Configuration'), |
96 | 95 | 'tree' => $tree, |
97 | 96 | 'user_id' => $request->getAttribute('user'), |
98 | - 'selected_user_id' => (int) ($request->getQueryParams()['user_id'] ?? 0), |
|
97 | + 'selected_user_id' => (int)($request->getQueryParams()['user_id'] ?? 0), |
|
99 | 98 | 'immediate_compute' => ($request->getQueryParams()['compute'] ?? '') == 'yes', |
100 | 99 | 'users_root' => $users_root |
101 | 100 | ]); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function boot() : void |
36 | 36 | { |
37 | - View::registerNamespace($this->name(), $this->resourcesFolder() . 'views/'); |
|
37 | + View::registerNamespace($this->name(), $this->resourcesFolder().'views/'); |
|
38 | 38 | |
39 | 39 | $this->loadRoutes(app(RouterContainer::class)->getMap()); |
40 | 40 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function resourcesFolder(): string |
47 | 47 | { |
48 | - return Webtrees::MODULES_DIR . trim($this->name(), '_') . '/resources/'; |
|
48 | + return Webtrees::MODULES_DIR.trim($this->name(), '_').'/resources/'; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function customTranslations(string $language) : array |
74 | 74 | { |
75 | - $translation_file = $this->resourcesFolder() . 'lang/' . $language . '/messages.php'; |
|
75 | + $translation_file = $this->resourcesFolder().'lang/'.$language.'/messages.php'; |
|
76 | 76 | |
77 | 77 | try { |
78 | 78 | $translation = new Translation($translation_file); |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | { |
101 | 101 | /** @var ModuleThemeInterface $theme */ |
102 | 102 | $theme = app(ModuleThemeInterface::class); |
103 | - $css_file = $this->resourcesFolder() . 'css/' . $theme->name() . '.min.css'; |
|
103 | + $css_file = $this->resourcesFolder().'css/'.$theme->name().'.min.css'; |
|
104 | 104 | |
105 | - if(file_exists($css_file)) { |
|
106 | - return $this->assetUrl('css/' . $theme->name() . '.min.css'); |
|
105 | + if (file_exists($css_file)) { |
|
106 | + return $this->assetUrl('css/'.$theme->name().'.min.css'); |
|
107 | 107 | } |
108 | 108 | else { |
109 | 109 | return $this->assetUrl('css/default.min.css'); |
@@ -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; |
@@ -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 | } |
@@ -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 |
@@ -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; |