diff options
| author | Greg Roach <greg@subaqua.co.uk> | 2021-02-09 13:05:04 +0000 |
|---|---|---|
| committer | Greg Roach <greg@subaqua.co.uk> | 2021-02-10 13:40:07 +0000 |
| commit | 7c2c99fad7cacd17c98be88238ff735d82c6351b (patch) | |
| tree | 9a74e5aa59b34f9b0ab7d26d932c9c47f723d950 /app | |
| parent | ffa287a19fafea25bbc582320a3dfed9051b21ab (diff) | |
| download | webtrees-7c2c99fad7cacd17c98be88238ff735d82c6351b.tar.gz webtrees-7c2c99fad7cacd17c98be88238ff735d82c6351b.tar.bz2 webtrees-7c2c99fad7cacd17c98be88238ff735d82c6351b.zip | |
CodeStyle
Diffstat (limited to 'app')
| -rw-r--r-- | app/Module/ChartsBlockModule.php | 3 | ||||
| -rw-r--r-- | app/Module/FanChartModule.php | 10 | ||||
| -rw-r--r-- | app/Module/HtmlBlockModule.php | 10 | ||||
| -rw-r--r-- | app/Module/LifespansChartModule.php | 24 | ||||
| -rw-r--r-- | app/Module/OnThisDayModule.php | 12 | ||||
| -rw-r--r-- | app/Module/RelationshipsChartModule.php | 4 | ||||
| -rw-r--r-- | app/Module/TopGivenNamesModule.php | 6 | ||||
| -rw-r--r-- | app/Module/TopSurnamesModule.php | 6 | ||||
| -rw-r--r-- | app/Module/UpcomingAnniversariesModule.php | 14 | ||||
| -rw-r--r-- | app/Services/AdminService.php | 2 | ||||
| -rw-r--r-- | app/Services/HomePageService.php | 10 |
11 files changed, 55 insertions, 46 deletions
diff --git a/app/Module/ChartsBlockModule.php b/app/Module/ChartsBlockModule.php index 7097009810..e9ba06c74f 100644 --- a/app/Module/ChartsBlockModule.php +++ b/app/Module/ChartsBlockModule.php @@ -120,7 +120,6 @@ class ChartsBlockModule extends AbstractModule implements ModuleBlockInterface $content = view('modules/charts/chart', [ 'block_id' => $block_id, 'chart_url' => $chart_url, - 'class' => 'wt-chart-pedigree', ]); } else { $title = I18N::translate('Pedigree'); @@ -141,7 +140,6 @@ class ChartsBlockModule extends AbstractModule implements ModuleBlockInterface $content = view('modules/charts/chart', [ 'block_id' => $block_id, 'chart_url' => $chart_url, - 'class' => 'wt-chart-descendants', ]); } else { $title = I18N::translate('Descendants'); @@ -162,7 +160,6 @@ class ChartsBlockModule extends AbstractModule implements ModuleBlockInterface $content = view('modules/charts/chart', [ 'block_id' => $block_id, 'chart_url' => $chart_url, - 'class' => 'wt-chart-hourglass', ]); } else { $title = I18N::translate('Hourglass chart'); diff --git a/app/Module/FanChartModule.php b/app/Module/FanChartModule.php index 1f26dec2d9..0d95efd501 100644 --- a/app/Module/FanChartModule.php +++ b/app/Module/FanChartModule.php @@ -271,22 +271,22 @@ class FanChartModule extends AbstractModule implements ModuleChartInterface, Req $sosa = 2 ** $generations - 1; // fan size - $fanw = 640 * $width / 100; + $fanw = intdiv(640 * $width, 100); $cx = $fanw / 2 - 1; // center x $cy = $cx; // center y $rx = $fanw - 1; $rw = $fanw / ($gen + 1); $fanh = $fanw; // fan height if ($style === self::STYLE_HALF_CIRCLE) { - $fanh = $fanh * ($gen + 1) / ($gen * 2); + $fanh = intdiv($fanh * ($gen + 1), $gen * 2); } if ($style === self::STYLE_THREE_QUARTER_CIRCLE) { - $fanh *= 0.86; + $fanh = intdiv($fanw * 86, 100); } $scale = $fanw / 640; // Create the image - $image = imagecreate((int) $fanw, (int) $fanh); + $image = imagecreate($fanw, (int) $fanh); // Create colors $transparent = imagecolorallocate($image, 0, 0, 0); @@ -303,7 +303,7 @@ class FanChartModule extends AbstractModule implements ModuleChartInterface, Req 'U' => $this->imageColor($image, $theme->parameter('chart-background-u')), ]; - imagefilledrectangle($image, 0, 0, (int) $fanw, (int) $fanh, $transparent); + imagefilledrectangle($image, 0, 0, $fanw, $fanh, $transparent); $fandeg = 90 * $style; diff --git a/app/Module/HtmlBlockModule.php b/app/Module/HtmlBlockModule.php index 095feeab9c..1c7e648b05 100644 --- a/app/Module/HtmlBlockModule.php +++ b/app/Module/HtmlBlockModule.php @@ -22,7 +22,6 @@ namespace Fisharebest\Webtrees\Module; use Fisharebest\Webtrees\Carbon; use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Services\HtmlService; -use Fisharebest\Webtrees\Services\TreeService; use Fisharebest\Webtrees\Statistics; use Fisharebest\Webtrees\Tree; use Illuminate\Support\Str; @@ -38,19 +37,14 @@ class HtmlBlockModule extends AbstractModule implements ModuleBlockInterface /** @var HtmlService */ private $html_service; - /** @var TreeService */ - private $tree_service; - /** * HtmlBlockModule bootstrap. * * @param HtmlService $html_service - * @param TreeService $tree_service */ - public function __construct(HtmlService $html_service, TreeService $tree_service) + public function __construct(HtmlService $html_service) { $this->html_service = $html_service; - $this->tree_service = $tree_service; } /** @@ -192,7 +186,6 @@ class HtmlBlockModule extends AbstractModule implements ModuleBlockInterface $html = $this->getBlockSetting($block_id, 'html'); $show_timestamp = $this->getBlockSetting($block_id, 'show_timestamp', '0'); $languages = explode(',', $this->getBlockSetting($block_id, 'languages')); - $all_trees = $this->tree_service->titles(); $templates = [ $html => I18N::translate('Custom'), @@ -202,7 +195,6 @@ class HtmlBlockModule extends AbstractModule implements ModuleBlockInterface ]; return view('modules/html/config', [ - 'all_trees' => $all_trees, 'html' => $html, 'languages' => $languages, 'show_timestamp' => $show_timestamp, diff --git a/app/Module/LifespansChartModule.php b/app/Module/LifespansChartModule.php index 85550ef0fc..db75ed25f9 100644 --- a/app/Module/LifespansChartModule.php +++ b/app/Module/LifespansChartModule.php @@ -38,9 +38,29 @@ use Psr\Http\Server\RequestHandlerInterface; use stdClass; use function app; +use function array_filter; +use function array_intersect; +use function array_map; +use function array_merge; +use function array_reduce; +use function array_unique; use function assert; +use function count; +use function date; use function explode; use function implode; +use function intdiv; +use function is_array; +use function max; +use function md5; +use function min; +use function redirect; +use function response; +use function route; +use function usort; +use function view; + +use const PHP_INT_MAX; /** * Class LifespansChartModule @@ -243,8 +263,8 @@ class LifespansChartModule extends AbstractModule implements ModuleChartInterfac usort($individuals, Individual::birthDateComparator()); // Round to whole decades - $start_year = (int) floor($this->minYear($individuals) / 10) * 10; - $end_year = (int) ceil($this->maxYear($individuals) / 10) * 10; + $start_year = intdiv($this->minYear($individuals), 10) * 10; + $end_year = intdiv($this->maxYear($individuals), 10) * 10; $lifespans = $this->layoutIndividuals($individuals); diff --git a/app/Module/OnThisDayModule.php b/app/Module/OnThisDayModule.php index 4840c66ac1..7b7b1bf3cf 100644 --- a/app/Module/OnThisDayModule.php +++ b/app/Module/OnThisDayModule.php @@ -242,10 +242,10 @@ class OnThisDayModule extends AbstractModule implements ModuleBlockInterface { $default_events = implode(',', self::DEFAULT_EVENTS); - $filter = $this->getBlockSetting($block_id, 'filter', '1'); - $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_STYLE); - $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT); - $events = $this->getBlockSetting($block_id, 'events', $default_events); + $filter = $this->getBlockSetting($block_id, 'filter', '1'); + $info_style = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_STYLE); + $sort_style = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT); + $events = $this->getBlockSetting($block_id, 'events', $default_events); $event_array = explode(',', $events); @@ -274,9 +274,9 @@ class OnThisDayModule extends AbstractModule implements ModuleBlockInterface 'all_events' => $all_events, 'event_array' => $event_array, 'filter' => $filter, - 'infoStyle' => $infoStyle, + 'info_style' => $info_style, 'info_styles' => $info_styles, - 'sortStyle' => $sortStyle, + 'sort_style' => $sort_style, 'sort_styles' => $sort_styles, ]); } diff --git a/app/Module/RelationshipsChartModule.php b/app/Module/RelationshipsChartModule.php index 273656a86d..3bf1731ab4 100644 --- a/app/Module/RelationshipsChartModule.php +++ b/app/Module/RelationshipsChartModule.php @@ -433,7 +433,7 @@ class RelationshipsChartModule extends AbstractModule implements ModuleChartInte /** * Possible options for the ancestors option * - * @return array<string> + * @return array<int,string> */ private function ancestorsOptions(): array { @@ -446,7 +446,7 @@ class RelationshipsChartModule extends AbstractModule implements ModuleChartInte /** * Possible options for the recursion option * - * @return array<string> + * @return array<int,string> */ private function recursionConfigOptions(): array { diff --git a/app/Module/TopGivenNamesModule.php b/app/Module/TopGivenNamesModule.php index b9a80f6396..3ea31a09a2 100644 --- a/app/Module/TopGivenNamesModule.php +++ b/app/Module/TopGivenNamesModule.php @@ -174,8 +174,8 @@ class TopGivenNamesModule extends AbstractModule implements ModuleBlockInterface */ public function editBlockConfiguration(Tree $tree, int $block_id): string { - $num = $this->getBlockSetting($block_id, 'num', self::DEFAULT_NUMBER); - $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_STYLE); + $num = $this->getBlockSetting($block_id, 'num', self::DEFAULT_NUMBER); + $info_style = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_STYLE); $info_styles = [ /* I18N: An option in a list-box */ @@ -185,7 +185,7 @@ class TopGivenNamesModule extends AbstractModule implements ModuleBlockInterface ]; return view('modules/top10_givnnames/config', [ - 'infoStyle' => $infoStyle, + 'infoStyle' => $info_style, 'info_styles' => $info_styles, 'num' => $num, ]); diff --git a/app/Module/TopSurnamesModule.php b/app/Module/TopSurnamesModule.php index ef58b9245c..b6c2c39a17 100644 --- a/app/Module/TopSurnamesModule.php +++ b/app/Module/TopSurnamesModule.php @@ -235,8 +235,8 @@ class TopSurnamesModule extends AbstractModule implements ModuleBlockInterface */ public function editBlockConfiguration(Tree $tree, int $block_id): string { - $num = $this->getBlockSetting($block_id, 'num', self::DEFAULT_NUMBER); - $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_STYLE); + $num = $this->getBlockSetting($block_id, 'num', self::DEFAULT_NUMBER); + $info_style = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_STYLE); $info_styles = [ /* I18N: An option in a list-box */ @@ -251,7 +251,7 @@ class TopSurnamesModule extends AbstractModule implements ModuleBlockInterface return view('modules/top10_surnames/config', [ 'num' => $num, - 'infoStyle' => $infoStyle, + 'infoStyle' => $info_style, 'info_styles' => $info_styles, ]); } diff --git a/app/Module/UpcomingAnniversariesModule.php b/app/Module/UpcomingAnniversariesModule.php index 7e4bde1c08..dfda30e265 100644 --- a/app/Module/UpcomingAnniversariesModule.php +++ b/app/Module/UpcomingAnniversariesModule.php @@ -256,11 +256,11 @@ class UpcomingAnniversariesModule extends AbstractModule implements ModuleBlockI { $default_events = implode(',', self::DEFAULT_EVENTS); - $days = (int) $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS); - $filter = $this->getBlockSetting($block_id, 'filter', self::DEFAULT_FILTER); - $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_STYLE); - $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT); - $events = $this->getBlockSetting($block_id, 'events', $default_events); + $days = (int) $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS); + $filter = $this->getBlockSetting($block_id, 'filter', self::DEFAULT_FILTER); + $info_style = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_STYLE); + $sort_style = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT); + $events = $this->getBlockSetting($block_id, 'events', $default_events); $event_array = explode(',', $events); @@ -288,10 +288,10 @@ class UpcomingAnniversariesModule extends AbstractModule implements ModuleBlockI 'days' => $days, 'event_array' => $event_array, 'filter' => $filter, - 'infoStyle' => $infoStyle, + 'info_style' => $info_style, 'info_styles' => $info_styles, 'max_days' => self::MAX_DAYS, - 'sortStyle' => $sortStyle, + 'sort_style' => $sort_style, 'sort_styles' => $sort_styles, ]); } diff --git a/app/Services/AdminService.php b/app/Services/AdminService.php index 0e31189715..40c50819ed 100644 --- a/app/Services/AdminService.php +++ b/app/Services/AdminService.php @@ -106,7 +106,7 @@ class AdminService /** * @param Tree $tree * - * @return array<string,array<GedcomRecord>> + * @return array<string,array<int,array<int,GedcomRecord>>> */ public function duplicateRecords(Tree $tree): array { diff --git a/app/Services/HomePageService.php b/app/Services/HomePageService.php index 9b24702a8c..7fa7691a6f 100644 --- a/app/Services/HomePageService.php +++ b/app/Services/HomePageService.php @@ -199,7 +199,7 @@ class HomePageService * @param UserInterface $user * @param string $location "main" or "side" * - * @return Collection<string,ModuleBlockInterface> + * @return Collection<int,ModuleBlockInterface> */ public function treeBlocks(Tree $tree, UserInterface $user, string $location): Collection { @@ -249,7 +249,7 @@ class HomePageService * @param UserInterface $user * @param string $location "main" or "side" * - * @return Collection<string,ModuleBlockInterface> + * @return Collection<int,ModuleBlockInterface> */ public function userBlocks(Tree $tree, UserInterface $user, string $location): Collection { @@ -409,10 +409,10 @@ class HomePageService /** * Take a list of block names, and return block (module) objects. * - * @param Collection<string> $blocks - * @param Collection<string,ModuleBlockInterface> $active_blocks + * @param Collection<string> $blocks + * @param Collection<int,ModuleBlockInterface> $active_blocks * - * @return Collection<string,ModuleBlockInterface> + * @return Collection<int,ModuleBlockInterface> */ private function filterActiveBlocks(Collection $blocks, Collection $active_blocks): Collection { |
