18c2e8227SGreg Roach<?php 23976b470SGreg Roach 38c2e8227SGreg Roach/** 48c2e8227SGreg Roach * webtrees: online genealogy 55bfc6897SGreg Roach * Copyright (C) 2022 webtrees development team 68c2e8227SGreg Roach * This program is free software: you can redistribute it and/or modify 78c2e8227SGreg Roach * it under the terms of the GNU General Public License as published by 88c2e8227SGreg Roach * the Free Software Foundation, either version 3 of the License, or 98c2e8227SGreg Roach * (at your option) any later version. 108c2e8227SGreg Roach * This program is distributed in the hope that it will be useful, 118c2e8227SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 128c2e8227SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 138c2e8227SGreg Roach * GNU General Public License for more details. 148c2e8227SGreg Roach * You should have received a copy of the GNU General Public License 1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>. 168c2e8227SGreg Roach */ 17fcfa147eSGreg Roach 18e7f56f2aSGreg Roachdeclare(strict_types=1); 19e7f56f2aSGreg Roach 2076692c8bSGreg Roachnamespace Fisharebest\Webtrees\Module; 2176692c8bSGreg Roach 220e62c4b8SGreg Roachuse Fisharebest\Webtrees\Auth; 230e62c4b8SGreg Roachuse Fisharebest\Webtrees\I18N; 248fb4e87cSGreg Roachuse Fisharebest\Webtrees\Individual; 2567992b6aSRichard Cisseeuse Fisharebest\Webtrees\Services\ModuleService; 269219296aSGreg Roachuse Fisharebest\Webtrees\Statistics; 27e490cd80SGreg Roachuse Fisharebest\Webtrees\Tree; 28*748dbe15SGreg Roachuse Fisharebest\Webtrees\Validator; 291ae92905SGreg Roachuse Illuminate\Database\Capsule\Manager as DB; 30a69f5655SGreg Roachuse Illuminate\Database\Query\Expression; 311e7a7a28SGreg Roachuse Illuminate\Support\Str; 326ccdf4f0SGreg Roachuse Psr\Http\Message\ServerRequestInterface; 338c2e8227SGreg Roach 34cd1ec0d0SGreg Roachuse function app; 35cd1ec0d0SGreg Roachuse function extract; 36cd1ec0d0SGreg Roachuse function uksort; 37cd1ec0d0SGreg Roachuse function view; 38cd1ec0d0SGreg Roach 39cd1ec0d0SGreg Roachuse const EXTR_OVERWRITE; 40cd1ec0d0SGreg Roach 418c2e8227SGreg Roach/** 428c2e8227SGreg Roach * Class FamilyTreeStatisticsModule 438c2e8227SGreg Roach */ 4437eb8894SGreg Roachclass FamilyTreeStatisticsModule extends AbstractModule implements ModuleBlockInterface 45c1010edaSGreg Roach{ 4649a243cbSGreg Roach use ModuleBlockTrait; 4749a243cbSGreg Roach 48f36626dbSGreg Roach /** Show this number of surnames by default */ 4916d6367aSGreg Roach private const DEFAULT_NUMBER_OF_SURNAMES = '10'; 50f36626dbSGreg Roach 51b55cbc6bSGreg Roach private ModuleService $module_service; 52b55cbc6bSGreg Roach 53b55cbc6bSGreg Roach /** 54b55cbc6bSGreg Roach * @param ModuleService $module_service 55b55cbc6bSGreg Roach */ 56b55cbc6bSGreg Roach public function __construct(ModuleService $module_service) 57b55cbc6bSGreg Roach { 58b55cbc6bSGreg Roach $this->module_service = $module_service; 59b55cbc6bSGreg Roach } 60b55cbc6bSGreg Roach 61961ec755SGreg Roach /** 620cfd6963SGreg Roach * How should this module be identified in the control panel, etc.? 63961ec755SGreg Roach * 64961ec755SGreg Roach * @return string 65961ec755SGreg Roach */ 6649a243cbSGreg Roach public function title(): string 67c1010edaSGreg Roach { 68bbb76c12SGreg Roach /* I18N: Name of a module */ 69bbb76c12SGreg Roach return I18N::translate('Statistics'); 708c2e8227SGreg Roach } 718c2e8227SGreg Roach 72961ec755SGreg Roach /** 73961ec755SGreg Roach * A sentence describing what this module does. 74961ec755SGreg Roach * 75961ec755SGreg Roach * @return string 76961ec755SGreg Roach */ 7749a243cbSGreg Roach public function description(): string 78c1010edaSGreg Roach { 79bbb76c12SGreg Roach /* I18N: Description of “Statistics” module */ 80bbb76c12SGreg Roach return I18N::translate('The size of the family tree, earliest and latest events, common names, etc.'); 818c2e8227SGreg Roach } 828c2e8227SGreg Roach 8376692c8bSGreg Roach /** 8476692c8bSGreg Roach * Generate the HTML content of this block. 8576692c8bSGreg Roach * 86e490cd80SGreg Roach * @param Tree $tree 8776692c8bSGreg Roach * @param int $block_id 883caaa4d2SGreg Roach * @param string $context 8976d39c55SGreg Roach * @param array<string,string> $config 9076692c8bSGreg Roach * 9176692c8bSGreg Roach * @return string 9276692c8bSGreg Roach */ 933caaa4d2SGreg Roach public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string 94c1010edaSGreg Roach { 95cab242e7SGreg Roach $statistics = app(Statistics::class); 96bf57b580SGreg Roach 97e2a378d3SGreg Roach $show_last_update = $this->getBlockSetting($block_id, 'show_last_update', '1'); 98e2a378d3SGreg Roach $show_common_surnames = $this->getBlockSetting($block_id, 'show_common_surnames', '1'); 9980536c2dSGreg Roach $number_of_surnames = (int) $this->getBlockSetting($block_id, 'number_of_surnames', self::DEFAULT_NUMBER_OF_SURNAMES); 100e2a378d3SGreg Roach $stat_indi = $this->getBlockSetting($block_id, 'stat_indi', '1'); 101e2a378d3SGreg Roach $stat_fam = $this->getBlockSetting($block_id, 'stat_fam', '1'); 102e2a378d3SGreg Roach $stat_sour = $this->getBlockSetting($block_id, 'stat_sour', '1'); 103e2a378d3SGreg Roach $stat_media = $this->getBlockSetting($block_id, 'stat_media', '1'); 104e2a378d3SGreg Roach $stat_repo = $this->getBlockSetting($block_id, 'stat_repo', '1'); 105e2a378d3SGreg Roach $stat_surname = $this->getBlockSetting($block_id, 'stat_surname', '1'); 106e2a378d3SGreg Roach $stat_events = $this->getBlockSetting($block_id, 'stat_events', '1'); 107e2a378d3SGreg Roach $stat_users = $this->getBlockSetting($block_id, 'stat_users', '1'); 108e2a378d3SGreg Roach $stat_first_birth = $this->getBlockSetting($block_id, 'stat_first_birth', '1'); 109e2a378d3SGreg Roach $stat_last_birth = $this->getBlockSetting($block_id, 'stat_last_birth', '1'); 110e2a378d3SGreg Roach $stat_first_death = $this->getBlockSetting($block_id, 'stat_first_death', '1'); 111e2a378d3SGreg Roach $stat_last_death = $this->getBlockSetting($block_id, 'stat_last_death', '1'); 112e2a378d3SGreg Roach $stat_long_life = $this->getBlockSetting($block_id, 'stat_long_life', '1'); 113e2a378d3SGreg Roach $stat_avg_life = $this->getBlockSetting($block_id, 'stat_avg_life', '1'); 114e2a378d3SGreg Roach $stat_most_chil = $this->getBlockSetting($block_id, 'stat_most_chil', '1'); 115e2a378d3SGreg Roach $stat_avg_chil = $this->getBlockSetting($block_id, 'stat_avg_chil', '1'); 1168c2e8227SGreg Roach 1173caaa4d2SGreg Roach extract($config, EXTR_OVERWRITE); 1188c2e8227SGreg Roach 1198c2e8227SGreg Roach if ($show_common_surnames) { 12080536c2dSGreg Roach // Use the count of base surnames. 1211ae92905SGreg Roach $top_surnames = DB::table('name') 1221ae92905SGreg Roach ->where('n_file', '=', $tree->id()) 1231ae92905SGreg Roach ->where('n_type', '<>', '_MARNM') 1248fb4e87cSGreg Roach ->whereNotIn('n_surn', [Individual::NOMEN_NESCIO, '']) 1257f5c2944SGreg Roach ->groupBy(['n_surn']) 126a69f5655SGreg Roach ->orderByDesc(new Expression('COUNT(n_surn)')) 1271ae92905SGreg Roach ->take($number_of_surnames) 1281ae92905SGreg Roach ->pluck('n_surn'); 129e0275e5bSGreg Roach 13013abd6f3SGreg Roach $all_surnames = []; 1311ae92905SGreg Roach 13280536c2dSGreg Roach foreach ($top_surnames as $top_surname) { 1331ae92905SGreg Roach $variants = DB::table('name') 1341ae92905SGreg Roach ->where('n_file', '=', $tree->id()) 135a69f5655SGreg Roach ->where(new Expression('n_surn /*! COLLATE utf8_bin */'), '=', $top_surname) 1367f5c2944SGreg Roach ->groupBy(['surname']) 137a69f5655SGreg Roach ->select([new Expression('n_surname /*! COLLATE utf8_bin */ AS surname'), new Expression('count(*) AS total')]) 1381ae92905SGreg Roach ->pluck('total', 'surname') 1391ae92905SGreg Roach ->all(); 14080536c2dSGreg Roach 14180536c2dSGreg Roach $all_surnames[$top_surname] = $variants; 142f36626dbSGreg Roach } 14380536c2dSGreg Roach 14437646143SGreg Roach uksort($all_surnames, I18N::comparator()); 1451d3c0c1aSGreg Roach 146b55cbc6bSGreg Roach // Find a module providing individual lists 147b55cbc6bSGreg Roach $module = $this->module_service 148b55cbc6bSGreg Roach ->findByComponent(ModuleListInterface::class, $tree, Auth::user()) 149b55cbc6bSGreg Roach ->first(static fn (ModuleInterface $module): bool => $module instanceof IndividualListModule); 15067992b6aSRichard Cissee 151cd1ec0d0SGreg Roach $surnames = view('lists/surnames-compact-list', [ 152cd1ec0d0SGreg Roach 'module' => $module, 153cd1ec0d0SGreg Roach 'totals' => false, 154cd1ec0d0SGreg Roach 'surnames' => $all_surnames, 155cd1ec0d0SGreg Roach 'tree' => $tree, 156cd1ec0d0SGreg Roach ]); 1571d3c0c1aSGreg Roach } else { 1581d3c0c1aSGreg Roach $surnames = ''; 1598c2e8227SGreg Roach } 1601d3c0c1aSGreg Roach 161147e99aaSGreg Roach $content = view('modules/gedcom_stats/statistics', [ 1621d3c0c1aSGreg Roach 'show_last_update' => $show_last_update, 1631d3c0c1aSGreg Roach 'show_common_surnames' => $show_common_surnames, 1641d3c0c1aSGreg Roach 'number_of_surnames' => $number_of_surnames, 1651d3c0c1aSGreg Roach 'stat_indi' => $stat_indi, 1661d3c0c1aSGreg Roach 'stat_fam' => $stat_fam, 1671d3c0c1aSGreg Roach 'stat_sour' => $stat_sour, 1681d3c0c1aSGreg Roach 'stat_media' => $stat_media, 1691d3c0c1aSGreg Roach 'stat_repo' => $stat_repo, 1701d3c0c1aSGreg Roach 'stat_surname' => $stat_surname, 1711d3c0c1aSGreg Roach 'stat_events' => $stat_events, 1721d3c0c1aSGreg Roach 'stat_users' => $stat_users, 1731d3c0c1aSGreg Roach 'stat_first_birth' => $stat_first_birth, 1741d3c0c1aSGreg Roach 'stat_last_birth' => $stat_last_birth, 1751d3c0c1aSGreg Roach 'stat_first_death' => $stat_first_death, 1761d3c0c1aSGreg Roach 'stat_last_death' => $stat_last_death, 1771d3c0c1aSGreg Roach 'stat_long_life' => $stat_long_life, 1781d3c0c1aSGreg Roach 'stat_avg_life' => $stat_avg_life, 1791d3c0c1aSGreg Roach 'stat_most_chil' => $stat_most_chil, 1801d3c0c1aSGreg Roach 'stat_avg_chil' => $stat_avg_chil, 1811d3c0c1aSGreg Roach 'surnames' => $surnames, 1821d3c0c1aSGreg Roach ]); 18328941e3cSGreg Roach 184bd055353SGreg Roach $content = $statistics->embedTags($content); 185bd055353SGreg Roach 1863caaa4d2SGreg Roach if ($context !== self::CONTEXT_EMBED) { 187147e99aaSGreg Roach return view('modules/block-template', [ 1881e7a7a28SGreg Roach 'block' => Str::kebab($this->name()), 1899c6524dcSGreg Roach 'id' => $block_id, 1903caaa4d2SGreg Roach 'config_url' => $this->configUrl($tree, $context, $block_id), 19149a243cbSGreg Roach 'title' => $this->title(), 1929c6524dcSGreg Roach 'content' => $content, 1939c6524dcSGreg Roach ]); 1948c2e8227SGreg Roach } 195b2ce94c6SRico Sonntag 196b2ce94c6SRico Sonntag return $content; 1978c2e8227SGreg Roach } 1988c2e8227SGreg Roach 1993caaa4d2SGreg Roach /** 2003caaa4d2SGreg Roach * Should this block load asynchronously using AJAX? 2013caaa4d2SGreg Roach * 2023caaa4d2SGreg Roach * Simple blocks are faster in-line, more complex ones can be loaded later. 2033caaa4d2SGreg Roach * 2043caaa4d2SGreg Roach * @return bool 2053caaa4d2SGreg Roach */ 206c1010edaSGreg Roach public function loadAjax(): bool 207c1010edaSGreg Roach { 2088c2e8227SGreg Roach return true; 2098c2e8227SGreg Roach } 2108c2e8227SGreg Roach 2113caaa4d2SGreg Roach /** 2123caaa4d2SGreg Roach * Can this block be shown on the user’s home page? 2133caaa4d2SGreg Roach * 2143caaa4d2SGreg Roach * @return bool 2153caaa4d2SGreg Roach */ 216c1010edaSGreg Roach public function isUserBlock(): bool 217c1010edaSGreg Roach { 2188c2e8227SGreg Roach return true; 2198c2e8227SGreg Roach } 2208c2e8227SGreg Roach 2213caaa4d2SGreg Roach /** 2223caaa4d2SGreg Roach * Can this block be shown on the tree’s home page? 2233caaa4d2SGreg Roach * 2243caaa4d2SGreg Roach * @return bool 2253caaa4d2SGreg Roach */ 22663276d8fSGreg Roach public function isTreeBlock(): bool 227c1010edaSGreg Roach { 2288c2e8227SGreg Roach return true; 2298c2e8227SGreg Roach } 2308c2e8227SGreg Roach 23176692c8bSGreg Roach /** 232a45f9889SGreg Roach * Update the configuration for a block. 233a45f9889SGreg Roach * 2346ccdf4f0SGreg Roach * @param ServerRequestInterface $request 235a45f9889SGreg Roach * @param int $block_id 236a45f9889SGreg Roach * 237a45f9889SGreg Roach * @return void 238a45f9889SGreg Roach */ 2396ccdf4f0SGreg Roach public function saveBlockConfiguration(ServerRequestInterface $request, int $block_id): void 240a45f9889SGreg Roach { 241*748dbe15SGreg Roach $show_last_update = Validator::parsedBody($request)->boolean('show_last_update', false); 242*748dbe15SGreg Roach $show_common_surnames = Validator::parsedBody($request)->boolean('show_common_surnames', false); 243*748dbe15SGreg Roach $number_of_surnames = Validator::parsedBody($request)->integer('number_of_surnames'); 244*748dbe15SGreg Roach $stat_indi = Validator::parsedBody($request)->boolean('stat_indi', false); 245*748dbe15SGreg Roach $stat_fam = Validator::parsedBody($request)->boolean('stat_fam', false); 246*748dbe15SGreg Roach $stat_sour = Validator::parsedBody($request)->boolean('stat_sour', false); 247*748dbe15SGreg Roach $stat_other = Validator::parsedBody($request)->boolean('stat_other', false); 248*748dbe15SGreg Roach $stat_media = Validator::parsedBody($request)->boolean('stat_media', false); 249*748dbe15SGreg Roach $stat_repo = Validator::parsedBody($request)->boolean('stat_repo', false); 250*748dbe15SGreg Roach $stat_surname = Validator::parsedBody($request)->boolean('stat_surname', false); 251*748dbe15SGreg Roach $stat_events = Validator::parsedBody($request)->boolean('stat_events', false); 252*748dbe15SGreg Roach $stat_users = Validator::parsedBody($request)->boolean('stat_users', false); 253*748dbe15SGreg Roach $stat_first_birth = Validator::parsedBody($request)->boolean('stat_first_birth', false); 254*748dbe15SGreg Roach $stat_last_birth = Validator::parsedBody($request)->boolean('stat_last_birth', false); 255*748dbe15SGreg Roach $stat_first_death = Validator::parsedBody($request)->boolean('stat_first_death', false); 256*748dbe15SGreg Roach $stat_last_death = Validator::parsedBody($request)->boolean('stat_last_death', false); 257*748dbe15SGreg Roach $stat_long_life = Validator::parsedBody($request)->boolean('stat_long_life', false); 258*748dbe15SGreg Roach $stat_avg_life = Validator::parsedBody($request)->boolean('stat_avg_life', false); 259*748dbe15SGreg Roach $stat_most_chil = Validator::parsedBody($request)->boolean('stat_most_chil', false); 260*748dbe15SGreg Roach $stat_avg_chil = Validator::parsedBody($request)->boolean('stat_avg_chil', false); 261ac5f8ed1SGreg Roach 262*748dbe15SGreg Roach $this->setBlockSetting($block_id, 'show_last_update', (string) $show_last_update); 263*748dbe15SGreg Roach $this->setBlockSetting($block_id, 'show_common_surnames', (string) $show_common_surnames); 264*748dbe15SGreg Roach $this->setBlockSetting($block_id, 'number_of_surnames', (string) $number_of_surnames); 265*748dbe15SGreg Roach $this->setBlockSetting($block_id, 'stat_indi', (string) $stat_indi); 266*748dbe15SGreg Roach $this->setBlockSetting($block_id, 'stat_fam', (string) $stat_fam); 267*748dbe15SGreg Roach $this->setBlockSetting($block_id, 'stat_sour', (string) $stat_sour); 268*748dbe15SGreg Roach $this->setBlockSetting($block_id, 'stat_other', (string) $stat_other); 269*748dbe15SGreg Roach $this->setBlockSetting($block_id, 'stat_media', (string) $stat_media); 270*748dbe15SGreg Roach $this->setBlockSetting($block_id, 'stat_repo', (string) $stat_repo); 271*748dbe15SGreg Roach $this->setBlockSetting($block_id, 'stat_surname', (string) $stat_surname); 272*748dbe15SGreg Roach $this->setBlockSetting($block_id, 'stat_events', (string) $stat_events); 273*748dbe15SGreg Roach $this->setBlockSetting($block_id, 'stat_users', (string) $stat_users); 274*748dbe15SGreg Roach $this->setBlockSetting($block_id, 'stat_first_birth', (string) $stat_first_birth); 275*748dbe15SGreg Roach $this->setBlockSetting($block_id, 'stat_last_birth', (string) $stat_last_birth); 276*748dbe15SGreg Roach $this->setBlockSetting($block_id, 'stat_first_death', (string) $stat_first_death); 277*748dbe15SGreg Roach $this->setBlockSetting($block_id, 'stat_last_death', (string) $stat_last_death); 278*748dbe15SGreg Roach $this->setBlockSetting($block_id, 'stat_long_life', (string) $stat_long_life); 279*748dbe15SGreg Roach $this->setBlockSetting($block_id, 'stat_avg_life', (string) $stat_avg_life); 280*748dbe15SGreg Roach $this->setBlockSetting($block_id, 'stat_most_chil', (string) $stat_most_chil); 281*748dbe15SGreg Roach $this->setBlockSetting($block_id, 'stat_avg_chil', (string) $stat_avg_chil); 282a45f9889SGreg Roach } 283a45f9889SGreg Roach 284a45f9889SGreg Roach /** 28576692c8bSGreg Roach * An HTML form to edit block settings 28676692c8bSGreg Roach * 287e490cd80SGreg Roach * @param Tree $tree 28876692c8bSGreg Roach * @param int $block_id 289a9430be8SGreg Roach * 2903caaa4d2SGreg Roach * @return string 29176692c8bSGreg Roach */ 2923caaa4d2SGreg Roach public function editBlockConfiguration(Tree $tree, int $block_id): string 293c1010edaSGreg Roach { 294e2a378d3SGreg Roach $show_last_update = $this->getBlockSetting($block_id, 'show_last_update', '1'); 295e2a378d3SGreg Roach $show_common_surnames = $this->getBlockSetting($block_id, 'show_common_surnames', '1'); 296f36626dbSGreg Roach $number_of_surnames = $this->getBlockSetting($block_id, 'number_of_surnames', self::DEFAULT_NUMBER_OF_SURNAMES); 297e2a378d3SGreg Roach $stat_indi = $this->getBlockSetting($block_id, 'stat_indi', '1'); 298e2a378d3SGreg Roach $stat_fam = $this->getBlockSetting($block_id, 'stat_fam', '1'); 299e2a378d3SGreg Roach $stat_sour = $this->getBlockSetting($block_id, 'stat_sour', '1'); 300e2a378d3SGreg Roach $stat_media = $this->getBlockSetting($block_id, 'stat_media', '1'); 301e2a378d3SGreg Roach $stat_repo = $this->getBlockSetting($block_id, 'stat_repo', '1'); 302e2a378d3SGreg Roach $stat_surname = $this->getBlockSetting($block_id, 'stat_surname', '1'); 303e2a378d3SGreg Roach $stat_events = $this->getBlockSetting($block_id, 'stat_events', '1'); 304e2a378d3SGreg Roach $stat_users = $this->getBlockSetting($block_id, 'stat_users', '1'); 305e2a378d3SGreg Roach $stat_first_birth = $this->getBlockSetting($block_id, 'stat_first_birth', '1'); 306e2a378d3SGreg Roach $stat_last_birth = $this->getBlockSetting($block_id, 'stat_last_birth', '1'); 307e2a378d3SGreg Roach $stat_first_death = $this->getBlockSetting($block_id, 'stat_first_death', '1'); 308e2a378d3SGreg Roach $stat_last_death = $this->getBlockSetting($block_id, 'stat_last_death', '1'); 309e2a378d3SGreg Roach $stat_long_life = $this->getBlockSetting($block_id, 'stat_long_life', '1'); 310e2a378d3SGreg Roach $stat_avg_life = $this->getBlockSetting($block_id, 'stat_avg_life', '1'); 311e2a378d3SGreg Roach $stat_most_chil = $this->getBlockSetting($block_id, 'stat_most_chil', '1'); 312e2a378d3SGreg Roach $stat_avg_chil = $this->getBlockSetting($block_id, 'stat_avg_chil', '1'); 3138c2e8227SGreg Roach 3143caaa4d2SGreg Roach return view('modules/gedcom_stats/config', [ 315c385536dSGreg Roach 'show_last_update' => $show_last_update, 316c385536dSGreg Roach 'show_common_surnames' => $show_common_surnames, 317c385536dSGreg Roach 'number_of_surnames' => $number_of_surnames, 318c385536dSGreg Roach 'stat_indi' => $stat_indi, 319c385536dSGreg Roach 'stat_fam' => $stat_fam, 320c385536dSGreg Roach 'stat_sour' => $stat_sour, 321c385536dSGreg Roach 'stat_media' => $stat_media, 322c385536dSGreg Roach 'stat_repo' => $stat_repo, 323c385536dSGreg Roach 'stat_surname' => $stat_surname, 324c385536dSGreg Roach 'stat_events' => $stat_events, 325c385536dSGreg Roach 'stat_users' => $stat_users, 326c385536dSGreg Roach 'stat_first_birth' => $stat_first_birth, 327c385536dSGreg Roach 'stat_last_birth' => $stat_last_birth, 328c385536dSGreg Roach 'stat_first_death' => $stat_first_death, 329c385536dSGreg Roach 'stat_last_death' => $stat_last_death, 330c385536dSGreg Roach 'stat_long_life' => $stat_long_life, 331c385536dSGreg Roach 'stat_avg_life' => $stat_avg_life, 332c385536dSGreg Roach 'stat_most_chil' => $stat_most_chil, 333c385536dSGreg Roach 'stat_avg_chil' => $stat_avg_chil, 334c385536dSGreg Roach ]); 3358c2e8227SGreg Roach } 3368c2e8227SGreg Roach} 337