From c29513945bc4b861ac8028c3720b41c725e1bf97 Mon Sep 17 00:00:00 2001 From: ro Date: Thu, 29 Feb 2024 10:37:40 -0600 Subject: [PATCH] Formating tweaks, minor controller edits There were some outstanding changes made a few months ago that haven't been checked in, so getting those as the final commit before the transition to Laravel --- brain/controller/.php-cs-fixer.cache | 1 + brain/controller/DashControl.php | 12 ++++++------ brain/controller/RouteControl.php | 3 ++- brain/data/.php-cs-fixer.cache | 1 + 4 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 brain/controller/.php-cs-fixer.cache create mode 100644 brain/data/.php-cs-fixer.cache diff --git a/brain/controller/.php-cs-fixer.cache b/brain/controller/.php-cs-fixer.cache new file mode 100644 index 0000000..e6783e3 --- /dev/null +++ b/brain/controller/.php-cs-fixer.cache @@ -0,0 +1 @@ +{"php":"8.1.12","version":"3.13.0","indent":" ","lineEnding":"\n","rules":{"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"braces":{"allow_single_line_closure":true},"class_definition":{"inline_constructor_arguments":false,"space_before_parenthesis":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"]},"ordered_imports":{"sort_algorithm":"none"},"return_type_declaration":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_import_per_statement":{"group_to_single_imports":false},"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":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_class_element_per_statement":{"elements":["property"]},"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"array_indentation":true,"array_syntax":{"syntax":"short"},"combine_consecutive_unsets":true,"method_chaining_indentation":true,"class_attributes_separation":{"elements":{"const":"none","method":"one","property":"none","trait_import":"none"}},"multiline_whitespace_before_semicolons":{"strategy":"no_multi_line"},"binary_operator_spaces":{"default":"single_space","operators":{"=":"align_single_space_minimal","=>":"align_single_space_minimal"}},"concat_space":{"spacing":"one"},"function_typehint_space":true,"single_line_comment_style":{"comment_types":["hash"]},"include":true,"no_extra_blank_lines":{"tokens":["curly_brace_block","extra","parenthesis_brace_block","throw"]},"no_multiline_whitespace_around_double_arrow":true,"no_spaces_around_offset":true,"no_unused_imports":true,"no_whitespace_before_comma_in_array":true,"object_operator_without_whitespace":true,"trim_array_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true},"hashes":{"tmpixxwnz.php":"f4358c77accfedac014932cd885cbf99","tmpqkj20z.php":"f4358c77accfedac014932cd885cbf99","tmpto8q2x.php":"ca7dc7ebe4bbcde2f41325162327aa81","tmpv1ofcp.php":"ca7dc7ebe4bbcde2f41325162327aa81","tmp3nqyas.php":"ca7dc7ebe4bbcde2f41325162327aa81","tmp12kssw.php":"ca7dc7ebe4bbcde2f41325162327aa81"}} \ No newline at end of file diff --git a/brain/controller/DashControl.php b/brain/controller/DashControl.php index fdeae9d..06a33fc 100644 --- a/brain/controller/DashControl.php +++ b/brain/controller/DashControl.php @@ -61,7 +61,7 @@ class DashControl ]; } else { header('Location: /dashboard'); - exit(); + exit; } break; @@ -77,7 +77,7 @@ class DashControl ]; } else { header('Location: /dashboard'); - exit(); + exit; } break; case 'pages': @@ -99,7 +99,7 @@ class DashControl ]; } else { header('Location: /dashboard'); - exit(); + exit; } break; case 'page': @@ -113,7 +113,7 @@ class DashControl $page = (new Book())->findPageById($uuid); $views = []; if (!isset($page['layout'])) { - $page['layout'] = "page"; + $page['layout'] = 'page'; } if (str_contains($page['layout'], 'index')) { $views = (new Themes())->getCustomIndex(); @@ -186,13 +186,13 @@ class DashControl } } else { header('Location: /dashboard'); - exit(); + exit; } break; case 'logout': Session::kill(); header('Location: /dashboard'); - exit(); + exit; break; case 'reset-password': $template = 'dash/reset-password.twig'; diff --git a/brain/controller/RouteControl.php b/brain/controller/RouteControl.php index f3eb19e..2fbea94 100644 --- a/brain/controller/RouteControl.php +++ b/brain/controller/RouteControl.php @@ -7,7 +7,7 @@ use Psr\Http\Message\ServerRequestInterface; class RouteControl { - //TODO: Add additional HTTP Methods to better organize API control paths + // TODO: Add additional HTTP Methods to better organize API control paths public function get( ServerRequestInterface $request, ResponseInterface $response, @@ -41,6 +41,7 @@ class RouteControl 'type' => 'TASK_NONE', ]; $response->getBody()->write(json_encode($result)); + return $response->withHeader('Content-Type', 'application/json'); } } diff --git a/brain/data/.php-cs-fixer.cache b/brain/data/.php-cs-fixer.cache new file mode 100644 index 0000000..108a797 --- /dev/null +++ b/brain/data/.php-cs-fixer.cache @@ -0,0 +1 @@ +{"php":"8.1.12","version":"3.13.0","indent":" ","lineEnding":"\n","rules":{"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"braces":{"allow_single_line_closure":true},"class_definition":{"inline_constructor_arguments":false,"space_before_parenthesis":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"]},"ordered_imports":{"sort_algorithm":"none"},"return_type_declaration":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_import_per_statement":{"group_to_single_imports":false},"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":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_class_element_per_statement":{"elements":["property"]},"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"array_indentation":true,"array_syntax":{"syntax":"short"},"combine_consecutive_unsets":true,"method_chaining_indentation":true,"class_attributes_separation":{"elements":{"const":"none","method":"one","property":"none","trait_import":"none"}},"multiline_whitespace_before_semicolons":{"strategy":"no_multi_line"},"binary_operator_spaces":{"default":"single_space","operators":{"=":"align_single_space_minimal","=>":"align_single_space_minimal"}},"concat_space":{"spacing":"one"},"function_typehint_space":true,"single_line_comment_style":{"comment_types":["hash"]},"include":true,"no_extra_blank_lines":{"tokens":["curly_brace_block","extra","parenthesis_brace_block","throw"]},"no_multiline_whitespace_around_double_arrow":true,"no_spaces_around_offset":true,"no_unused_imports":true,"no_whitespace_before_comma_in_array":true,"object_operator_without_whitespace":true,"trim_array_spaces":true,"unary_operator_spaces":true,"whitespace_after_comma_in_array":true},"hashes":{"tmptx_2lh.php":"fbbaef6c1d64a3237a34403b9e4c51c0","tmpy4bagr.php":"fbbaef6c1d64a3237a34403b9e4c51c0"}} \ No newline at end of file