diff --git a/.php-cs-fixer.cache b/.php-cs-fixer.cache index 15672e814..bfef08c1b 100644 --- a/.php-cs-fixer.cache +++ b/.php-cs-fixer.cache @@ -1 +1 @@ -{"php":"8.2.9","version":"3.22.0","indent":" ","lineEnding":"\n","rules":{"align_multiline_comment":true,"array_syntax":{"syntax":"short"},"backtick_to_shell_exec":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["return"]},"cast_spaces":true,"class_attributes_separation":{"elements":{"method":"one"}},"class_definition":true,"class_reference_name_casing":true,"clean_namespace":true,"concat_space":true,"curly_braces_position":{"allow_single_line_anonymous_functions":true,"allow_single_line_empty_anonymous_classes":true},"declare_parentheses":true,"echo_tag_syntax":true,"empty_loop_body":{"style":"braces"},"empty_loop_condition":true,"fully_qualified_strict_types":true,"general_phpdoc_tag_rename":{"replacements":{"inheritDocs":"inheritDoc"}},"global_namespace_import":{"import_classes":false,"import_constants":false,"import_functions":false},"include":true,"increment_style":true,"integer_literal_case":true,"lambda_not_used_import":true,"linebreak_after_opening_tag":true,"magic_constant_casing":true,"magic_method_casing":true,"method_argument_space":{"on_multiline":"ignore"},"native_function_casing":true,"native_function_type_declaration_casing":true,"no_alias_language_construct_call":true,"no_alternative_syntax":true,"no_binary_string":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_extra_blank_lines":{"tokens":["attribute","case","continue","curly_brace_block","default","extra","parenthesis_brace_block","square_brace_block","switch","throw","use"]},"no_leading_namespace_whitespace":true,"no_mixed_echo_print":true,"no_multiline_whitespace_around_double_arrow":true,"no_null_property_initialization":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_around_offset":true,"no_superfluous_phpdoc_tags":{"remove_inheritdoc":true},"no_trailing_comma_in_singleline":true,"no_unneeded_control_parentheses":{"statements":["break","clone","continue","echo_print","others","return","switch_case","yield","yield_from"]},"no_unneeded_curly_braces":{"namespaces":true},"no_unneeded_import_alias":true,"no_unset_cast":true,"no_unused_imports":true,"no_useless_concat_operator":true,"no_useless_nullsafe_operator":true,"no_whitespace_before_comma_in_array":true,"normalize_index_brace":true,"nullable_type_declaration_for_default_null_value":{"use_nullable_type_declaration":false},"object_operator_without_whitespace":true,"operator_linebreak":{"only_booleans":true},"ordered_imports":true,"php_unit_fqcn_annotation":true,"php_unit_method_casing":true,"phpdoc_align":true,"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_inline_tag_normalizer":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":true,"phpdoc_no_package":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_order":true,"phpdoc_return_self_reference":true,"phpdoc_scalar":true,"phpdoc_separation":true,"phpdoc_single_line_var_spacing":true,"phpdoc_summary":true,"phpdoc_tag_type":{"tags":{"inheritDoc":"inline"}},"phpdoc_to_comment":true,"phpdoc_trim":true,"phpdoc_trim_consecutive_blank_line_separation":true,"phpdoc_types":true,"phpdoc_types_order":{"null_adjustment":"always_last","sort_algorithm":"none"},"phpdoc_var_without_name":true,"semicolon_after_instruction":true,"simple_to_complex_string_variable":true,"single_class_element_per_statement":true,"single_import_per_statement":true,"single_line_comment_spacing":true,"single_line_comment_style":{"comment_types":["hash"]},"single_line_throw":true,"single_quote":true,"single_space_around_construct":true,"space_after_semicolon":{"remove_in_empty_for_expressions":true},"standardize_increment":true,"standardize_not_equals":true,"switch_continue_to_break":true,"trailing_comma_in_multiline":true,"trim_array_spaces":true,"type_declaration_spaces":true,"types_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true,"yoda_style":true,"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"compact_nullable_typehint":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"return_type_declaration":true,"short_scalar_cast":true,"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_line_after_imports":true,"statement_indentation":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"array_indentation":true,"function_typehint_space":true,"declare_strict_types":true,"combine_consecutive_unsets":true,"not_operator_with_successor_space":true,"braces":{"position_after_functions_and_oop_constructs":"same"}},"hashes":{"Models\/Chart.php":"e1a0bfb3276bda149e70a4b0fb2acd76","Models\/BaseModel.php":"a5e5fac12535033db8d5861703e99519","Models\/MixedChart.php":"7867dfb1b803e374d13cd3a97d9e59fb","Providers\/RouteServiceProvider.php":"c62b9048288ce5bf3cd9e487014582c6","Providers\/ChartServiceProvider.php":"382e54a95faa1de143c4c36967305e30","Actions\/Chart\/GetTypeOptions.php":"1977c9cce4a478e7026d6e79702a25d1","Actions\/Chart\/GetFontFamilyOptions.php":"3c7b5576bf288b7cc8b7cf77885ffe5b","Actions\/Chart\/GetFontStyleOptions.php":"0e3183628f3e8e7a81c90c8c72861750","Actions\/JpGraph\/ApplyGraphStyleAction.php":"4520c1aeaaf48eacc0b862eab5e9f09d","Actions\/JpGraph\/V1\/Bar2Action.php":"a5b3759333579e2a397486f4b1f00a7a","Actions\/JpGraph\/V1\/Horizbar1Action.php":"51c9acacfe45372e4d7fe8c64248df2b","Actions\/JpGraph\/V1\/PieAvgAction.php":"0ff2a347e36ae6511173bd6d005bc0b8","Actions\/JpGraph\/V1\/Bar3Action.php":"911d8b152a2d35fbbe32ff40e3bdd6aa","Actions\/JpGraph\/V1\/Pie1Action.php":"6c63693ba738cf06aa70dc5983db6e51","Actions\/JpGraph\/V1\/LineSubQuestionAction.php":"32a00d6aa31be891d327e15a0f891f5b","Actions\/JpGraph\/GetGraphAction.php":"a90c2fbcf920fe4c8c44642688b52cdf","Actions\/JpGraph\/ApplyPlotStyleAction.php":"b64d4ebd5ba250d0a2e4696edde6923b","Datas\/AnswerData.php":"d8966e9e66da960868a02d8543286de9","Datas\/AnswersChartData.php":"f0a875671bfa5c376ee7c412f01c1d8c","Datas\/ChartData.php":"1802002cd1008c0be28ccbbc0c99da31","Tables\/Columns\/ChartColumn.php":"3c227257f39138235d1a9f1ba0ae9aa0","docs\/config.php":"a797f4b644f37748cceff11c2ce84559","docs\/config.production.php":"0389bfdb2066feea5487831e25c2aa1b","docs\/navigation.php":"4b48df06bfed09cf256c9ffa7a2346c0","docs\/bootstrap.php":"08c7c136892cf6aadd94bcdb6f64ca34","docs\/listeners\/GenerateSitemap.php":"47198e7919271856d36b88e921c7d3eb","Database\/Seeders\/ChartDatabaseSeeder.php":"e9a0cbed13c138e24cd6a3d2722d2507","Database\/Factories\/ChartFactory.php":"a52492954bc2000b2a3f223ba92f5ae2","Database\/Factories\/MixedChartFactory.php":"94a428c20b3c40b93a285610d4338559","Routes\/web.php":"d8b57a2739d10acaa69603aca186a4f7","Routes\/api.php":"905e49cc806f2d11cc4698d1532d7b04","Config\/config.php":"24af6b51b9bb0cb3795f130d93ec5bd3","phpinsights.php":"a903fc759ac88dad061accf0899a2622"}} \ No newline at end of file +{"php":"8.2.10","version":"3.25.0","indent":" ","lineEnding":"\n","rules":{"align_multiline_comment":true,"array_syntax":{"syntax":"short"},"backtick_to_shell_exec":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["return"]},"cast_spaces":true,"class_attributes_separation":{"elements":{"method":"one"}},"class_definition":true,"class_reference_name_casing":true,"clean_namespace":true,"concat_space":true,"curly_braces_position":{"allow_single_line_anonymous_functions":true,"allow_single_line_empty_anonymous_classes":true},"declare_parentheses":true,"echo_tag_syntax":true,"empty_loop_body":{"style":"braces"},"empty_loop_condition":true,"fully_qualified_strict_types":true,"general_phpdoc_tag_rename":{"replacements":{"inheritDocs":"inheritDoc"}},"global_namespace_import":{"import_classes":false,"import_constants":false,"import_functions":false},"include":true,"increment_style":true,"integer_literal_case":true,"lambda_not_used_import":true,"linebreak_after_opening_tag":true,"magic_constant_casing":true,"magic_method_casing":true,"method_argument_space":{"on_multiline":"ignore"},"native_function_casing":true,"native_function_type_declaration_casing":true,"no_alias_language_construct_call":true,"no_alternative_syntax":true,"no_binary_string":true,"no_blank_lines_after_phpdoc":true,"no_empty_comment":true,"no_empty_phpdoc":true,"no_empty_statement":true,"no_extra_blank_lines":{"tokens":["attribute","case","continue","curly_brace_block","default","extra","parenthesis_brace_block","square_brace_block","switch","throw","use"]},"no_leading_namespace_whitespace":true,"no_mixed_echo_print":true,"no_multiline_whitespace_around_double_arrow":true,"no_null_property_initialization":true,"no_short_bool_cast":true,"no_singleline_whitespace_before_semicolons":true,"no_spaces_around_offset":true,"no_superfluous_phpdoc_tags":{"remove_inheritdoc":true},"no_trailing_comma_in_singleline":true,"no_unneeded_control_parentheses":{"statements":["break","clone","continue","echo_print","others","return","switch_case","yield","yield_from"]},"no_unneeded_curly_braces":{"namespaces":true},"no_unneeded_import_alias":true,"no_unset_cast":true,"no_unused_imports":true,"no_useless_concat_operator":true,"no_useless_nullsafe_operator":true,"no_whitespace_before_comma_in_array":true,"normalize_index_brace":true,"nullable_type_declaration_for_default_null_value":{"use_nullable_type_declaration":false},"object_operator_without_whitespace":true,"operator_linebreak":{"only_booleans":true},"ordered_imports":true,"php_unit_fqcn_annotation":true,"php_unit_method_casing":true,"phpdoc_align":true,"phpdoc_annotation_without_dot":true,"phpdoc_indent":true,"phpdoc_inline_tag_normalizer":true,"phpdoc_no_access":true,"phpdoc_no_alias_tag":true,"phpdoc_no_package":true,"phpdoc_no_useless_inheritdoc":true,"phpdoc_order":true,"phpdoc_return_self_reference":true,"phpdoc_scalar":true,"phpdoc_separation":true,"phpdoc_single_line_var_spacing":true,"phpdoc_summary":true,"phpdoc_tag_type":{"tags":{"inheritDoc":"inline"}},"phpdoc_to_comment":true,"phpdoc_trim":true,"phpdoc_trim_consecutive_blank_line_separation":true,"phpdoc_types":true,"phpdoc_types_order":{"null_adjustment":"always_last","sort_algorithm":"none"},"phpdoc_var_without_name":true,"semicolon_after_instruction":true,"simple_to_complex_string_variable":true,"single_class_element_per_statement":true,"single_import_per_statement":true,"single_line_comment_spacing":true,"single_line_comment_style":{"comment_types":["hash"]},"single_line_throw":true,"single_quote":true,"single_space_around_construct":true,"space_after_semicolon":{"remove_in_empty_for_expressions":true},"standardize_increment":true,"standardize_not_equals":true,"switch_continue_to_break":true,"trailing_comma_in_multiline":true,"trim_array_spaces":true,"type_declaration_spaces":true,"types_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true,"yoda_style":true,"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"compact_nullable_typehint":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"return_type_declaration":true,"short_scalar_cast":true,"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_line_after_imports":true,"spaces_inside_parentheses":true,"statement_indentation":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"array_indentation":true,"function_typehint_space":true,"declare_strict_types":true,"combine_consecutive_unsets":true,"not_operator_with_successor_space":true,"braces":{"position_after_functions_and_oop_constructs":"same"}},"hashes":{"Database\/Seeders\/ChartDatabaseSeeder.php":"e9a0cbed13c138e24cd6a3d2722d2507","Database\/Factories\/MixedChartFactory.php":"94a428c20b3c40b93a285610d4338559","Database\/Factories\/ChartFactory.php":"a52492954bc2000b2a3f223ba92f5ae2","phpinsights.php":"a903fc759ac88dad061accf0899a2622","Config\/config.php":"24af6b51b9bb0cb3795f130d93ec5bd3","docs\/config.production.php":"0389bfdb2066feea5487831e25c2aa1b","docs\/bootstrap.php":"08c7c136892cf6aadd94bcdb6f64ca34","docs\/listeners\/GenerateSitemap.php":"47198e7919271856d36b88e921c7d3eb","docs\/navigation.php":"4b48df06bfed09cf256c9ffa7a2346c0","docs\/config.php":"9e368edbeff720f8f929e3f83bf443b7","Datas\/ChartData.php":"1802002cd1008c0be28ccbbc0c99da31","Datas\/AnswersChartData.php":"f0a875671bfa5c376ee7c412f01c1d8c","Datas\/AnswerData.php":"d8966e9e66da960868a02d8543286de9","Providers\/RouteServiceProvider.php":"c62b9048288ce5bf3cd9e487014582c6","Providers\/ChartServiceProvider.php":"382e54a95faa1de143c4c36967305e30","Tables\/Columns\/ChartColumn.php":"bc89dac863afe46ac771a2947eeffa3f","Actions\/Chart\/GetFontStyleOptions.php":"0e3183628f3e8e7a81c90c8c72861750","Actions\/Chart\/GetFontFamilyOptions.php":"3c7b5576bf288b7cc8b7cf77885ffe5b","Actions\/Chart\/GetTypeOptions.php":"1977c9cce4a478e7026d6e79702a25d1","Actions\/JpGraph\/V1\/PieAvgAction.php":"0ff2a347e36ae6511173bd6d005bc0b8","Actions\/JpGraph\/V1\/Horizbar1Action.php":"51c9acacfe45372e4d7fe8c64248df2b","Actions\/JpGraph\/V1\/Bar2Action.php":"a5b3759333579e2a397486f4b1f00a7a","Actions\/JpGraph\/V1\/LineSubQuestionAction.php":"32a00d6aa31be891d327e15a0f891f5b","Actions\/JpGraph\/V1\/Pie1Action.php":"6c63693ba738cf06aa70dc5983db6e51","Actions\/JpGraph\/V1\/Bar3Action.php":"911d8b152a2d35fbbe32ff40e3bdd6aa","Actions\/JpGraph\/ApplyPlotStyleAction.php":"b64d4ebd5ba250d0a2e4696edde6923b","Actions\/JpGraph\/GetGraphAction.php":"a90c2fbcf920fe4c8c44642688b52cdf","Actions\/JpGraph\/ApplyGraphStyleAction.php":"4520c1aeaaf48eacc0b862eab5e9f09d","Models\/MixedChart.php":"7867dfb1b803e374d13cd3a97d9e59fb","Models\/BaseModel.php":"a5e5fac12535033db8d5861703e99519","Models\/Chart.php":"e1a0bfb3276bda149e70a4b0fb2acd76","Routes\/web.php":"d8b57a2739d10acaa69603aca186a4f7","Routes\/api.php":"905e49cc806f2d11cc4698d1532d7b04"}} \ No newline at end of file diff --git a/Actions/JpGraph/ApplyGraphStyleAction.php b/Actions/JpGraph/ApplyGraphStyleAction.php index fb002e812..e1ddea80b 100644 --- a/Actions/JpGraph/ApplyGraphStyleAction.php +++ b/Actions/JpGraph/ApplyGraphStyleAction.php @@ -22,10 +22,10 @@ public function execute(Graph &$graph, ChartData $chart): Graph $graph->footer->right->SetFont($chart->font_family, $chart->font_style); // $graph->footer->right->Set('Totale Risposte '.$this->vars['tot']); - if ($graph->xaxis !== null) { + if (null !== $graph->xaxis) { $this->applyGraphXStyle($graph->xaxis, $chart); } - if ($graph->yaxis !== null) { + if (null !== $graph->yaxis) { $this->applyGraphYStyle($graph->yaxis, $chart); } diff --git a/Actions/JpGraph/ApplyPlotStyleAction.php b/Actions/JpGraph/ApplyPlotStyleAction.php index 5e4a021c8..0b4308e94 100644 --- a/Actions/JpGraph/ApplyPlotStyleAction.php +++ b/Actions/JpGraph/ApplyPlotStyleAction.php @@ -42,7 +42,7 @@ public function execute(BarPlot $plot, ChartData $data): BarPlot $plot->value->SetAlign('left', 'center'); // colore del font che scrivi - if ($data->plot_value_color !== null) { + if (null !== $data->plot_value_color) { $plot->value->SetColor($data->plot_value_color); } else { $plot->value->SetColor('black', 'darkred'); @@ -67,7 +67,7 @@ public function execute(BarPlot $plot, ChartData $data): BarPlot // Center the values in the bar // if (null == $data->plot_value_pos || 0 == $data->plot_value_pos) { - if ($data->plot_value_pos === 0) { + if (0 === $data->plot_value_pos) { $plot->SetValuePos('center'); } diff --git a/Actions/JpGraph/GetGraphAction.php b/Actions/JpGraph/GetGraphAction.php index d5ebf5a23..b4a865e44 100644 --- a/Actions/JpGraph/GetGraphAction.php +++ b/Actions/JpGraph/GetGraphAction.php @@ -19,7 +19,7 @@ public function execute(ChartData $data): Graph $graph = new Graph($data->width, $data->height, 'auto'); $graph->SetScale('textlin'); $graph->SetShadow(); - $theme_class = new UniversalTheme(); + $theme_class = new UniversalTheme; $graph->SetTheme($theme_class); diff --git a/Actions/JpGraph/V1/Bar2Action.php b/Actions/JpGraph/V1/Bar2Action.php index e3c8d0024..fa760c295 100644 --- a/Actions/JpGraph/V1/Bar2Action.php +++ b/Actions/JpGraph/V1/Bar2Action.php @@ -8,12 +8,13 @@ use Amenadiel\JpGraph\Plot\BarPlot; use Amenadiel\JpGraph\Plot\GroupBarPlot; use Amenadiel\JpGraph\Text\Text; -use function count; use Modules\Chart\Actions\JpGraph\ApplyPlotStyleAction; use Modules\Chart\Actions\JpGraph\GetGraphAction; use Modules\Chart\Datas\AnswersChartData; use Spatie\QueueableAction\QueueableAction; +use function count; + class Bar2Action { use QueueableAction; @@ -62,7 +63,7 @@ public function execute(AnswersChartData $answerChartData): Graph $bplot = []; foreach ($legends as $i => $legend) { - if ($legend === 0) { + if (0 === $legend) { $tmp_data = $data; } else { $tmp_data = array_column($data, $legend); @@ -81,7 +82,7 @@ public function execute(AnswersChartData $answerChartData): Graph $tmp->SetLegend($str); } */ - if ($legend !== 0) { + if (0 !== $legend) { $tmp->SetLegend($legend); } diff --git a/Actions/JpGraph/V1/Bar3Action.php b/Actions/JpGraph/V1/Bar3Action.php index 7fbd5c6c8..e228c9d63 100644 --- a/Actions/JpGraph/V1/Bar3Action.php +++ b/Actions/JpGraph/V1/Bar3Action.php @@ -8,7 +8,6 @@ use Amenadiel\JpGraph\Plot\AccBarPlot; use Amenadiel\JpGraph\Plot\BarPlot; use Amenadiel\JpGraph\Text\Text; -use function count; use Modules\Chart\Actions\JpGraph\ApplyPlotStyleAction; use Modules\Chart\Actions\JpGraph\GetGraphAction; use Modules\Chart\Datas\AnswerData; @@ -16,6 +15,8 @@ use Spatie\QueueableAction\QueueableAction; use Webmozart\Assert\Assert; +use function count; + class Bar3Action { use QueueableAction; diff --git a/Actions/JpGraph/V1/Horizbar1Action.php b/Actions/JpGraph/V1/Horizbar1Action.php index fea8d1c02..bd2ba45f7 100644 --- a/Actions/JpGraph/V1/Horizbar1Action.php +++ b/Actions/JpGraph/V1/Horizbar1Action.php @@ -48,7 +48,7 @@ public function execute(AnswersChartData $answerChartData): Graph $colors = []; foreach ($labels as $k => $label) { - if ($label === 'NR') { + if ('NR' === $label) { $colors[$k] = $chart->getColors()[1] . '@' . $chart->transparency; } else { $colors[$k] = $chart->getColors()[0] . '@' . $chart->transparency; diff --git a/Actions/JpGraph/V1/Pie1Action.php b/Actions/JpGraph/V1/Pie1Action.php index 8a0a37a62..dfdada783 100644 --- a/Actions/JpGraph/V1/Pie1Action.php +++ b/Actions/JpGraph/V1/Pie1Action.php @@ -7,10 +7,11 @@ use Amenadiel\JpGraph\Graph\Graph; use Amenadiel\JpGraph\Graph\PieGraph; use Amenadiel\JpGraph\Plot\PiePlotC; -use function count; use Modules\Chart\Actions\JpGraph\ApplyGraphStyleAction; use Modules\Chart\Datas\AnswersChartData; use Spatie\QueueableAction\QueueableAction; + +use function count; use function strlen; class Pie1Action @@ -33,7 +34,7 @@ public function execute(AnswersChartData $answerChartData): Graph $data[] = $other; $labels[] = $chart->answer_value_no_txt; - if (count($labels) === 2 && strlen($labels[0]) < 3) { + if (2 === count($labels) && strlen($labels[0]) < 3) { $labels[0] = $chart->answer_value_txt; } } diff --git a/Actions/JpGraph/V1/PieAvgAction.php b/Actions/JpGraph/V1/PieAvgAction.php index 0a9efbf43..54c5baed2 100644 --- a/Actions/JpGraph/V1/PieAvgAction.php +++ b/Actions/JpGraph/V1/PieAvgAction.php @@ -7,12 +7,13 @@ use Amenadiel\JpGraph\Graph\Graph; use Amenadiel\JpGraph\Graph\PieGraph; use Amenadiel\JpGraph\Plot\PiePlotC; -use function count; -use function is_array; -use function is_numeric; use Modules\Chart\Actions\JpGraph\ApplyGraphStyleAction; use Modules\Chart\Datas\AnswersChartData; use Spatie\QueueableAction\QueueableAction; + +use function count; +use function is_array; +use function is_numeric; use function strlen; class PieAvgAction @@ -33,7 +34,7 @@ public function execute(AnswersChartData $answerChartData): Graph // $color_array[1] = 'white'; $data[] = $other; $labels[] = $chart->answer_value_no_txt ?? 'answer_value_no_txt'; - if (count($labels) === 2 && strlen((string) $labels[0]) < 3) { + if (2 === count($labels) && strlen((string) $labels[0]) < 3) { $labels[0] = $chart->answer_value_txt; } } diff --git a/Datas/AnswersChartData.php b/Datas/AnswersChartData.php index 704b758ff..f131797d4 100644 --- a/Datas/AnswersChartData.php +++ b/Datas/AnswersChartData.php @@ -4,9 +4,10 @@ namespace Modules\Chart\Datas; -use function count; use Spatie\LaravelData\Data; use Spatie\LaravelData\DataCollection; + +use function count; use function strlen; class AnswersChartData extends Data @@ -74,7 +75,7 @@ public function getChartJsData(): array if ($other > 0.01) { $data[] = $other; $labels[] = $this->chart->answer_value_no_txt ?? 'answer_value_no_txt'; - if (count($labels) === 2 && strlen((string) $labels[0]) < 3) { + if (2 === count($labels) && strlen((string) $labels[0]) < 3) { $labels[0] = $this->chart->answer_value_txt; } } @@ -101,7 +102,7 @@ public function getChartJsData(): array if ($other > 0.01) { $data[] = $other; $labels[] = $this->chart->answer_value_no_txt ?? 'answer_value_no_txt'; - if (count($labels) === 2 && strlen((string) $labels[0]) < 3) { + if (2 === count($labels) && strlen((string) $labels[0]) < 3) { $labels[0] = $this->chart->answer_value_txt; } } @@ -136,7 +137,7 @@ public function getChartJsOptions(): array $legend_display = true; $title = []; - if ($this->title !== 'no_set') { + if ('no_set' !== $this->title) { $title = [ 'display' => true, 'text' => $this->title, @@ -146,7 +147,7 @@ public function getChartJsOptions(): array ]; } - if ($this->footer !== 'no_set') { + if ('no_set' !== $this->footer) { $title = [ 'display' => true, 'text' => $this->footer, diff --git a/Models/Chart.php b/Models/Chart.php index f25f92989..067b89c99 100644 --- a/Models/Chart.php +++ b/Models/Chart.php @@ -4,11 +4,12 @@ namespace Modules\Chart\Models; -use function array_slice; use ErrorException; use Illuminate\Support\Str; use Webmozart\Assert\Assert; +use function array_slice; + /** * Modules\Chart\Models\Chart. * @@ -273,7 +274,7 @@ public function getPanelRow(string $parent_field, string $my_field): int|string| public function getTypeAttribute(?string $value): ?string { - if ($value !== null) { + if (null !== $value) { return $value; } if (isset($this->attributes['type'])) { @@ -285,7 +286,7 @@ public function getTypeAttribute(?string $value): ?string public function getWidthAttribute(?string $value): ?int { - if ($value !== null && $value !== 0) { + if (null !== $value && 0 !== $value) { return (int) $value; } @@ -294,7 +295,7 @@ public function getWidthAttribute(?string $value): ?int public function getHeightAttribute(?string $value): ?int { - if ($value !== null && $value !== 0) { + if (null !== $value && 0 !== $value) { return (int) $value; } diff --git a/Tables/Columns/ChartColumn.php b/Tables/Columns/ChartColumn.php index e06f7d22b..641937d68 100644 --- a/Tables/Columns/ChartColumn.php +++ b/Tables/Columns/ChartColumn.php @@ -7,6 +7,7 @@ use Filament\Tables\Columns\Column; use Illuminate\Contracts\View\View; use Modules\Chart\Datas\AnswersChartData; + use function Safe\json_encode; // use Illuminate\Session\SessionManager; @@ -50,6 +51,7 @@ public function setAnswersChartData(AnswersChartData $answersData): self $this->chartType = $answersData->getChartJsType(); $this->chartOptions = $answersData->getChartJsOptions(); $this->cachedData = null; + // dddx([$this->getCachedData(),$this->getData()]); // $this->emit('refreshChartColumn'); // filterChartData diff --git a/docs/config.php b/docs/config.php index 54850388d..5b7b1c70e 100644 --- a/docs/config.php +++ b/docs/config.php @@ -48,6 +48,7 @@ if (Str::startsWith($path, 'http')) { return $path; } + // return Str::startsWith($path, 'http') ? $path : '/' . trimPath($path); return url('/' . $page->lang . '/' . trimPath($path)); }, diff --git a/phpinsights.php b/phpinsights.php index f0393edec..231ee0797 100644 --- a/phpinsights.php +++ b/phpinsights.php @@ -17,7 +17,6 @@ use SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff; return [ - /* |-------------------------------------------------------------------------- | Default Preset @@ -105,11 +104,11 @@ */ 'requirements' => [ -// 'min-quality' => 0, -// 'min-complexity' => 0, -// 'min-architecture' => 0, -// 'min-style' => 0, -// 'disable-security-check' => false, + // 'min-quality' => 0, + // 'min-complexity' => 0, + // 'min-architecture' => 0, + // 'min-style' => 0, + // 'disable-security-check' => false, ], /* @@ -124,5 +123,4 @@ */ 'threads' => null, - ];