From 7883be8924beccd7ba880a029058ac648b17b4cb Mon Sep 17 00:00:00 2001 From: Jeppe Krogh Date: Fri, 20 Dec 2024 13:04:22 +0100 Subject: [PATCH] Coding standards --- .../toggle-parent-child_controller.js | 1 - src/Form/InvoicingRateReportType.php | 12 +--------- src/Model/Reports/InvoicingRateReportData.php | 2 +- .../Reports/InvoicingRateReportFormData.php | 1 - .../Reports/InvoicingRateReportWorker.php | 2 +- src/Service/InvoicingRateReportService.php | 22 ++++++++----------- .../reports/invoicing_rate_report.html.twig | 3 --- 7 files changed, 12 insertions(+), 31 deletions(-) diff --git a/assets/controllers/toggle-parent-child_controller.js b/assets/controllers/toggle-parent-child_controller.js index d4a58d53..bf21e53a 100644 --- a/assets/controllers/toggle-parent-child_controller.js +++ b/assets/controllers/toggle-parent-child_controller.js @@ -12,7 +12,6 @@ export default class extends Controller { displayChildrenForParentIds = []; - svgExpand = ``; svgCollapse = ``; diff --git a/src/Form/InvoicingRateReportType.php b/src/Form/InvoicingRateReportType.php index fe3e8bb9..0e8b0954 100644 --- a/src/Form/InvoicingRateReportType.php +++ b/src/Form/InvoicingRateReportType.php @@ -24,17 +24,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void $yearChoices[$year] = $year; } -$builder - /*->add('viewMode', EnumType::class, [ - 'required' => false, - 'label' => 'invoicing_rate_report.select_viewmode', - 'label_attr' => ['class' => 'label'], - 'placeholder' => false, - 'attr' => [ - 'class' => 'form-element', - ], - 'class' => InvoicingRateReportViewModeEnum::class, - ])*/ + $builder ->add('year', ChoiceType::class, [ 'label' => 'invoicing_rate_report.year', 'label_attr' => ['class' => 'label'], diff --git a/src/Model/Reports/InvoicingRateReportData.php b/src/Model/Reports/InvoicingRateReportData.php index e222a8ad..2fab660f 100644 --- a/src/Model/Reports/InvoicingRateReportData.php +++ b/src/Model/Reports/InvoicingRateReportData.php @@ -16,7 +16,7 @@ class InvoicingRateReportData public ArrayCollection $periodAverages; public float $totalAverage; /** - * @var false + * @var bool */ public bool $includeIssues; diff --git a/src/Model/Reports/InvoicingRateReportFormData.php b/src/Model/Reports/InvoicingRateReportFormData.php index b450ca07..e1933c78 100644 --- a/src/Model/Reports/InvoicingRateReportFormData.php +++ b/src/Model/Reports/InvoicingRateReportFormData.php @@ -5,7 +5,6 @@ class InvoicingRateReportFormData { public WorkloadReportPeriodTypeEnum $viewPeriodType; - public InvoicingRateReportViewModeEnum $viewMode; public int $year; public bool $includeIssues; } diff --git a/src/Model/Reports/InvoicingRateReportWorker.php b/src/Model/Reports/InvoicingRateReportWorker.php index 7b86efd1..9ca6733b 100644 --- a/src/Model/Reports/InvoicingRateReportWorker.php +++ b/src/Model/Reports/InvoicingRateReportWorker.php @@ -13,7 +13,7 @@ class InvoicingRateReportWorker extends Worker /** @var ArrayCollection */ public ArrayCollection $dataByPeriod; - /** @var ArrayCollection */ + /** @var ArrayCollection */ public ArrayCollection $projectData; public function __construct() diff --git a/src/Service/InvoicingRateReportService.php b/src/Service/InvoicingRateReportService.php index 53d6c753..02465dc9 100644 --- a/src/Service/InvoicingRateReportService.php +++ b/src/Service/InvoicingRateReportService.php @@ -21,22 +21,21 @@ public function __construct( /** * Generates an invoicing rate report for a specific year based on various parameters. * - * @param int $year The year for which the report is generated. - * @param PeriodTypeEnum $viewPeriodType The period type. - * @param InvoicingRateReportViewModeEnum $viewMode The view mode. - * @param bool $includeIssues Whether to include detailed issue-level data in the report. + * @param int $year the year for which the report is generated + * @param PeriodTypeEnum $viewPeriodType the period type + * @param InvoicingRateReportViewModeEnum $viewMode the view mode + * @param bool $includeIssues whether to include detailed issue-level data in the report * - * @return InvoicingRateReportData The calculated invoicing rate report data. + * @return InvoicingRateReportData the calculated invoicing rate report data * - * @throws \Exception If a required worker identifier is empty. + * @throws \Exception if a required worker identifier is empty */ public function getInvoicingRateReport( int $year, PeriodTypeEnum $viewPeriodType = PeriodTypeEnum::WEEK, InvoicingRateReportViewModeEnum $viewMode = InvoicingRateReportViewModeEnum::SUMMARY, - bool $includeIssues = false - ): InvoicingRateReportData - { + bool $includeIssues = false, + ): InvoicingRateReportData { $invoicingRateReportData = new InvoicingRateReportData($viewPeriodType->value); $invoicingRateReportData->includeIssues = $includeIssues; if (!$year) { @@ -142,13 +141,10 @@ public function getInvoicingRateReport( $invoicingRateReportData->workers->add($invoicingRateReportWorker); $invoicingRateReportWorker->projectData->set('projects', [ - $workerProjects ?? [] + $workerProjects, ]); - } - - // Calculate and set the total average $numberOfPeriods = count($invoicingRateReportData->periodAverages); diff --git a/templates/reports/invoicing_rate_report.html.twig b/templates/reports/invoicing_rate_report.html.twig index b931143c..7b6a5584 100644 --- a/templates/reports/invoicing_rate_report.html.twig +++ b/templates/reports/invoicing_rate_report.html.twig @@ -115,8 +115,6 @@ {% endfor %} - - {% for issueName, issueDetails in issues %} {% if not (issueName matches '/^\\d+$/') %} @@ -153,7 +151,6 @@ {% endfor %} {% endfor %} - {% endfor %}