From 0909a5e499f8b587e8feae6638e62b491a0a8f7e Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Fri, 21 Jul 2023 10:35:15 -0400 Subject: [PATCH] Reformat files --- .php-cs-fixer.dist.php | 994 +++++++++--------- config/bundles.php | 18 +- config/packages/cache.php | 2 +- config/packages/dev/easy_log_handler.php | 8 +- config/packages/dev/monolog.php | 8 +- config/packages/dev/routing.php | 2 +- config/packages/dev/web_profiler.php | 12 +- config/packages/doctrine.php | 8 +- config/packages/doctrine_migrations.php | 2 +- config/packages/framework.php | 9 +- config/packages/prod/doctrine.php | 38 +- config/packages/prod/monolog.php | 14 +- config/packages/prod/routing.php | 4 +- config/packages/routing.php | 8 +- config/packages/security.php | 24 +- config/packages/sensio_framework_extra.php | 4 +- config/packages/test/framework.php | 2 +- config/packages/test/monolog.php | 2 +- config/packages/test/twig.php | 2 +- config/packages/test/validator.php | 2 +- config/packages/test/web_profiler.php | 4 +- config/packages/translation.php | 6 +- config/packages/twig.php | 3 +- config/packages/validator.php | 2 +- config/preload.php | 5 +- config/routes/annotations.php | 2 +- config/routes/dev/framework.php | 4 +- config/routes/dev/web_profiler.php | 8 +- config/services.php | 2 +- public/index.php | 17 +- src/Controller/BrandCategoryController.php | 48 +- src/Controller/BrandController.php | 73 +- src/Controller/CameraController.php | 211 ++-- src/Controller/CameraTypeController.php | 109 +- src/Controller/ChipsetController.php | 3 +- src/Controller/CpuController.php | 7 +- src/Controller/DefaultController.php | 19 +- src/Controller/DeleteFormTrait.php | 17 +- src/Controller/FilmController.php | 151 ++- src/Controller/FlashController.php | 105 +- src/Controller/FormControllerBase.php | 292 ++--- src/Controller/FpuController.php | 48 +- src/Controller/GpuController.php | 75 +- src/Controller/GpuCoreController.php | 92 +- src/Controller/LensesController.php | 185 ++-- .../PreviouslyOwnedCameraController.php | 128 ++- .../PreviouslyOwnedFlashController.php | 84 +- .../PreviouslyOwnedLensesController.php | 80 +- src/Controller/SocketController.php | 48 +- src/Entity/Brand.php | 5 +- src/Entity/Camera.php | 23 +- src/Entity/CameraBase.php | 59 +- src/Entity/CameraType.php | 35 +- src/Entity/Chipset.php | 2 +- src/Entity/Cpu.php | 136 +-- src/Entity/Film.php | 64 +- src/Entity/FilmFormat.php | 19 +- src/Entity/Flash.php | 23 +- src/Entity/FlashBase.php | 49 +- src/Entity/Fpu.php | 2 +- src/Entity/Gpu.php | 41 +- src/Entity/LensTrait.php | 77 +- src/Entity/Lenses.php | 23 +- src/Entity/Motherboard.php | 4 +- src/Entity/PreviouslyOwnedCamera.php | 15 +- src/Entity/PreviouslyOwnedFlash.php | 21 +- src/Entity/PreviouslyOwnedLenses.php | 21 +- src/Entity/PurchasePrice.php | 32 +- src/Enum/CardBus.php | 12 +- src/Enum/SlotKey.php | 14 +- src/Form/BrandCategoryTrait.php | 14 +- src/Form/BrandCategoryType.php | 31 +- src/Form/BrandType.php | 30 +- src/Form/CameraType.php | 107 +- src/Form/CameraTypeType.php | 55 +- src/Form/ChipsetType.php | 38 +- src/Form/CpuType.php | 70 +- src/Form/FilmType.php | 123 ++- src/Form/FlashType.php | 79 +- src/Form/FpuType.php | 43 +- src/Form/GPUCoreType.php | 45 +- src/Form/GpuType.php | 8 +- src/Form/LensesType.php | 119 ++- src/Form/PreviouslyOwnedCameraType.php | 79 +- src/Form/PreviouslyOwnedFlashType.php | 81 +- src/Form/PreviouslyOwnedLensesType.php | 93 +- src/Form/SocketTypeForm.php | 39 +- src/Kernel.php | 28 +- src/Maker/MakeCollectionCrud.php | 99 +- src/Migrations/Version20221117193508.php | 79 +- src/Repository/AcquireRepository.php | 64 +- src/Repository/CameraRepository.php | 37 +- src/Repository/FlashRepository.php | 37 +- src/Repository/LensesRepository.php | 25 +- .../crud/controller/Controller.tpl.php | 21 +- src/Types/MoneyType.php | 35 +- src/ValueObject/Money.php | 29 +- tests/bootstrap.php | 11 +- tools/common.inc.php | 7 +- translations/messages.en.php | 194 ++-- translations/validators.en.php | 186 ++-- 101 files changed, 2738 insertions(+), 2836 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index c453691..a78be9b 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -11,535 +11,503 @@ $finder = Finder::create() return (new Config()) ->setRiskyAllowed(TRUE) ->setFinder($finder) + ->setIndent(' ') ->setRules([ - 'align_multiline_comment' => false, - 'array_indentation' => true, - 'array_push' => true, - 'array_syntax' => ['syntax' => 'short'], - 'assign_null_coalescing_to_coalesce_equal' => true, - 'backtick_to_shell_exec' => true, - 'binary_operator_spaces' => [ - 'default' => 'single_space', - 'operators' => [ - '=' => 'align_single_space_minimal', - '=>' => 'align_single_space_minimal', - '||' => 'align_single_space_minimal', - '.=' => 'align_single_space_minimal', + 'align_multiline_comment' => false, + 'array_indentation' => true, + 'array_push' => true, + 'array_syntax' => ['syntax' => 'short'], + 'assign_null_coalescing_to_coalesce_equal' => true, + 'backtick_to_shell_exec' => true, + 'binary_operator_spaces' => [ + 'default' => 'single_space', + 'operators' => [ + '=' => NULL, + '&' => NULL, + ] ], - ], - 'blank_line_after_namespace' => true, - 'blank_line_after_opening_tag' => false, - 'blank_line_before_statement' => [ - 'statements' => [ - 'case', - 'continue', - 'declare', - 'default', - 'do', - 'exit', - 'for', - 'foreach', - 'goto', - 'return', - 'switch', - 'throw', - 'try', - 'while', - 'yield', - 'yield_from', + 'blank_line_after_namespace' => true, + 'blank_line_after_opening_tag' => false, + 'blank_line_before_statement' => [ + 'statements' => [ + // 'case', + 'continue', + 'declare', + 'default', + 'do', + 'exit', + 'for', + 'foreach', + 'goto', + 'return', + 'switch', + 'throw', + 'try', + 'while', + 'yield', + 'yield_from', + ], ], - ], - 'braces' => [ - 'allow_single_line_anonymous_class_with_empty_body' => true, - 'allow_single_line_closure' => true, - 'position_after_anonymous_constructs' => 'same', - 'position_after_control_structures' => 'same', - 'position_after_functions_and_oop_constructs' => 'next', - ], - 'cast_spaces' => ['space' => 'single'], - 'class_attributes_separation' => [ - 'elements' => [ - 'const' => 'none', - 'property' => 'none', - 'method' => 'one', - 'trait_import' => 'none', + 'blank_lines_before_namespace' => [ + 'min_line_breaks' => 2, + 'max_line_breaks' => 2, ], - ], - 'class_definition' => [ - 'multi_line_extends_each_single_line' => true, - 'single_item_single_line' => true, - 'single_line' => true, - 'space_before_parenthesis' => true, - ], - 'class_reference_name_casing' => true, - 'clean_namespace' => true, - 'combine_consecutive_issets' => true, - 'combine_consecutive_unsets' => true, - 'combine_nested_dirname' => true, - 'comment_to_phpdoc' => [ - 'ignored_tags' => [ - 'todo', - 'codeCoverageIgnore', - 'codeCoverageIgnoreStart', - 'codeCoverageIgnoreEnd', - 'phpstan-ignore-line', - 'phpstan-ignore-next-line', + 'cast_spaces' => ['space' => 'single'], + 'class_attributes_separation' => [ + 'elements' => [ + 'const' => 'none', + 'property' => 'none', + 'method' => 'one', + 'trait_import' => 'none', + ], ], - ], - 'compact_nullable_typehint' => true, - 'concat_space' => ['spacing' => 'one'], - 'constant_case' => ['case' => 'upper'], - 'control_structure_continuation_position' => ['position' => 'same_line'], - 'date_time_immutable' => false, - 'declare_equal_normalize' => ['space' => 'none'], - 'declare_parentheses' => true, - 'declare_strict_types' => true, - 'dir_constant' => true, - 'doctrine_annotation_array_assignment' => false, - 'doctrine_annotation_braces' => false, - 'doctrine_annotation_indentation' => false, - 'doctrine_annotation_spaces' => false, - 'echo_tag_syntax' => [ - 'format' => 'short', - 'long_function' => 'echo', - 'shorten_simple_statements_only' => false, - ], - 'elseif' => false, - 'empty_loop_body' => ['style' => 'braces'], - 'empty_loop_condition' => ['style' => 'while'], - 'encoding' => true, - 'ereg_to_preg' => true, - 'error_suppression' => [ - 'mute_deprecation_error' => true, - 'noise_remaining_usages' => false, - 'noise_remaining_usages_exclude' => [], - ], - 'escape_implicit_backslashes' => [ - 'double_quoted' => true, - 'heredoc_syntax' => true, - 'single_quoted' => false, - ], - 'explicit_indirect_variable' => true, - 'explicit_string_variable' => true, - 'final_class' => false, - 'final_internal_class' => [ - 'annotation_exclude' => ['@no-final'], - 'annotation_include' => ['@internal'], - 'consider_absent_docblock_as_internal_class' => false, - ], - 'final_public_method_for_abstract_class' => false, - 'fopen_flag_order' => true, - 'fopen_flags' => ['b_mode' => true], - 'full_opening_tag' => true, - 'fully_qualified_strict_types' => true, - 'function_declaration' => ['closure_function_spacing' => 'one'], - 'function_to_constant' => [ - 'functions' => [ - 'get_called_class', - 'get_class', - 'get_class_this', - 'php_sapi_name', - 'phpversion', - 'pi', + 'class_definition' => [ + 'multi_line_extends_each_single_line' => true, + 'single_item_single_line' => true, + 'single_line' => true, + 'space_before_parenthesis' => true, ], - ], - 'function_typehint_space' => true, - 'general_phpdoc_annotation_remove' => [ - 'annotations' => [ - 'author', - 'package', - 'subpackage', + 'class_reference_name_casing' => true, + 'clean_namespace' => true, + 'combine_consecutive_issets' => true, + 'combine_consecutive_unsets' => true, + 'combine_nested_dirname' => true, + 'comment_to_phpdoc' => [ + 'ignored_tags' => [ + 'todo', + 'codeCoverageIgnore', + 'codeCoverageIgnoreStart', + 'codeCoverageIgnoreEnd', + 'phpstan-ignore-line', + 'phpstan-ignore-next-line', + ], ], - ], - 'general_phpdoc_tag_rename' => [ - 'case_sensitive' => false, - 'fix_annotation' => true, - 'fix_inline' => true, - 'replacements' => ['inheritDocs' => 'inheritDoc'], - ], - 'get_class_to_class_keyword' => false, - 'global_namespace_import' => [ - 'import_constants' => false, - 'import_functions' => false, - 'import_classes' => true, - ], - 'group_import' => true, - 'header_comment' => false, // false by default - 'heredoc_indentation' => ['indentation' => 'start_plus_one'], - 'heredoc_to_nowdoc' => true, - 'implode_call' => true, - 'include' => true, - 'increment_style' => ['style' => 'post'], - 'indentation_type' => true, - 'integer_literal_case' => true, - 'is_null' => true, - 'lambda_not_used_import' => true, - 'line_ending' => true, - 'linebreak_after_opening_tag' => false, - 'list_syntax' => ['syntax' => 'short'], - 'logical_operators' => true, - 'lowercase_cast' => true, - 'lowercase_keywords' => true, - 'lowercase_static_reference' => true, - 'magic_constant_casing' => true, - 'magic_method_casing' => true, - 'mb_str_functions' => false, - 'method_argument_space' => [ - 'after_heredoc' => false, - 'keep_multiple_spaces_after_comma' => false, - 'on_multiline' => 'ensure_fully_multiline', - ], - 'method_chaining_indentation' => true, - 'modernize_strpos' => false, // requires 8.0+ - 'modernize_types_casting' => true, - 'multiline_comment_opening_closing' => true, - 'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'], - 'native_constant_invocation' => false, - 'native_function_casing' => true, - 'native_function_invocation' => false, - 'native_function_type_declaration_casing' => true, - 'new_with_braces' => true, - 'no_alias_functions' => ['sets' => ['@all']], - 'no_alias_language_construct_call' => true, - 'no_alternative_syntax' => ['fix_non_monolithic_code' => false], - 'no_binary_string' => true, - 'no_blank_lines_after_class_opening' => true, - 'no_blank_lines_after_phpdoc' => true, - 'no_blank_lines_before_namespace' => false, // conflicts with `single_blank_line_before_namespace` - 'no_break_comment' => ['comment_text' => 'no break'], - 'no_closing_tag' => true, - 'no_empty_comment' => true, - 'no_empty_phpdoc' => true, - 'no_empty_statement' => true, - 'no_extra_blank_lines' => ['tokens' => ['extra']], - 'no_homoglyph_names' => true, - 'no_leading_import_slash' => true, - 'no_leading_namespace_whitespace' => true, - 'no_mixed_echo_print' => ['use' => 'echo'], - 'no_multiline_whitespace_around_double_arrow' => true, - 'no_null_property_initialization' => true, - 'no_php4_constructor' => true, - 'no_short_bool_cast' => true, - 'no_singleline_whitespace_before_semicolons' => true, - 'no_space_around_double_colon' => true, - 'no_spaces_after_function_name' => true, - 'no_spaces_around_offset' => ['positions' => ['inside', 'outside']], - 'no_spaces_inside_parenthesis' => true, - 'no_superfluous_elseif' => true, - 'no_superfluous_phpdoc_tags' => [ - 'allow_mixed' => true, - 'allow_unused_params' => true, - 'remove_inheritdoc' => false, - ], - 'no_trailing_comma_in_list_call' => true, - 'no_trailing_comma_in_singleline_array' => true, - 'no_trailing_whitespace' => true, - 'no_trailing_whitespace_in_comment' => true, - 'no_trailing_whitespace_in_string' => true, - 'no_unneeded_control_parentheses' => [ - 'statements' => [ - 'break', - 'clone', - 'continue', - 'echo_print', - 'return', - 'switch_case', - 'yield', + 'compact_nullable_typehint' => true, + 'concat_space' => ['spacing' => 'one'], + 'constant_case' => ['case' => 'upper'], + 'control_structure_braces' => true, + 'control_structure_continuation_position' => ['position' => 'next_line'], + 'curly_braces_position' => [ + 'allow_single_line_anonymous_functions' => true, + 'allow_single_line_empty_anonymous_classes' => true, + 'anonymous_functions_opening_brace' => 'same_line', + 'classes_opening_brace' => 'same_line', + 'control_structures_opening_brace' => 'next_line_unless_newline_at_signature_end', + 'functions_opening_brace' => 'next_line_unless_newline_at_signature_end', ], - ], - 'no_unneeded_curly_braces' => ['namespaces' => true], - 'no_unneeded_final_method' => ['private_methods' => true], - 'no_unneeded_import_alias' => true, - 'no_unreachable_default_argument_value' => true, - 'no_unset_cast' => true, - 'no_unset_on_property' => false, - 'no_unused_imports' => true, - 'no_useless_else' => true, - 'no_useless_return' => true, - 'no_useless_sprintf' => true, - 'no_whitespace_before_comma_in_array' => ['after_heredoc' => true], - 'no_whitespace_in_blank_line' => true, - 'non_printable_character' => ['use_escape_sequences_in_strings' => true], - 'normalize_index_brace' => true, - 'not_operator_with_space' => false, - 'not_operator_with_successor_space' => true, - 'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true], - 'object_operator_without_whitespace' => true, - 'octal_notation' => false, // requires 8.1+ - 'operator_linebreak' => ['only_booleans' => true, 'position' => 'beginning'], - 'ordered_class_elements' => [ - 'order' => [ - 'use_trait', - 'constant', - 'property', - 'method', + 'date_time_immutable' => false, + 'declare_equal_normalize' => ['space' => 'none'], + 'declare_parentheses' => true, + 'declare_strict_types' => true, + 'dir_constant' => true, + 'doctrine_annotation_array_assignment' => false, + 'doctrine_annotation_braces' => false, + 'doctrine_annotation_indentation' => false, + 'doctrine_annotation_spaces' => false, + 'echo_tag_syntax' => [ + 'format' => 'short', + 'long_function' => 'echo', + 'shorten_simple_statements_only' => false, ], - 'sort_algorithm' => 'none', - ], - 'ordered_imports' => [ - 'sort_algorithm' => 'alpha', - 'imports_order' => ['class', 'function', 'const'], - ], - 'ordered_interfaces' => false, - 'ordered_traits' => false, - 'php_unit_construct' => [ - 'assertions' => [ - 'assertSame', - 'assertEquals', - 'assertNotEquals', - 'assertNotSame', + 'elseif' => false, + 'empty_loop_body' => ['style' => 'braces'], + 'empty_loop_condition' => ['style' => 'while'], + 'encoding' => true, + 'error_suppression' => [ + 'mute_deprecation_error' => true, + 'noise_remaining_usages' => false, + 'noise_remaining_usages_exclude' => [], ], - ], - 'php_unit_dedicate_assert' => ['target' => 'newest'], - 'php_unit_dedicate_assert_internal_type' => ['target' => 'newest'], - 'php_unit_expectation' => ['target' => 'newest'], - 'php_unit_fqcn_annotation' => true, - 'php_unit_internal_class' => ['types' => ['normal', 'final']], - 'php_unit_method_casing' => ['case' => 'camel_case'], - 'php_unit_mock' => ['target' => 'newest'], - 'php_unit_mock_short_will_return' => true, - 'php_unit_namespaced' => ['target' => 'newest'], - 'php_unit_no_expectation_annotation' => [ - 'target' => 'newest', - 'use_class_const' => true, - ], - 'php_unit_set_up_tear_down_visibility' => true, - 'php_unit_size_class' => false, - 'php_unit_strict' => [ - 'assertions' => [ - 'assertAttributeEquals', - 'assertAttributeNotEquals', - 'assertEquals', - 'assertNotEquals', + 'escape_implicit_backslashes' => [ + 'double_quoted' => false, + 'heredoc_syntax' => false, + 'single_quoted' => false, ], - ], - 'php_unit_test_annotation' => ['style' => 'prefix'], - 'php_unit_test_case_static_method_calls' => [ - 'call_type' => 'this', - 'methods' => [], - ], - 'php_unit_test_class_requires_covers' => false, - 'phpdoc_add_missing_param_annotation' => ['only_untyped' => true], - 'phpdoc_align' => [ - 'align' => 'vertical', - 'tags' => [ - 'method', - 'param', - 'property', - 'return', - 'throws', - 'type', - 'var', + 'explicit_indirect_variable' => false, + 'explicit_string_variable' => false, + 'final_class' => false, + 'final_internal_class' => [ + 'consider_absent_docblock_as_internal_class' => false, ], - ], - 'phpdoc_annotation_without_dot' => false, - 'phpdoc_indent' => true, - 'phpdoc_inline_tag_normalizer' => [ - 'tags' => [ - 'example', - 'id', - 'internal', - 'inheritdoc', - 'inheritdocs', - 'link', - 'source', - 'toc', - 'tutorial', + 'final_public_method_for_abstract_class' => false, + 'fopen_flag_order' => true, + 'fopen_flags' => ['b_mode' => true], + 'full_opening_tag' => true, + 'fully_qualified_strict_types' => true, + 'function_declaration' => ['closure_function_spacing' => 'one'], + 'function_to_constant' => [ + 'functions' => [ + 'get_called_class', + 'get_class', + 'get_class_this', + 'php_sapi_name', + 'phpversion', + 'pi', + ], ], - ], - 'phpdoc_line_span' => [ - 'const' => 'multi', - 'method' => 'multi', - 'property' => 'multi', - ], - 'phpdoc_no_access' => true, - 'phpdoc_no_alias_tag' => [ - 'replacements' => [ - 'property-read' => 'property', - 'property-write' => 'property', - 'type' => 'var', - 'link' => 'see', + 'general_phpdoc_annotation_remove' => false, + 'general_phpdoc_tag_rename' => false, + 'get_class_to_class_keyword' => false, + 'global_namespace_import' => [ + 'import_constants' => true, + 'import_functions' => true, + 'import_classes' => true, ], - ], - 'phpdoc_no_empty_return' => false, - 'phpdoc_no_package' => true, - 'phpdoc_no_useless_inheritdoc' => true, - 'phpdoc_order' => true, - 'phpdoc_order_by_value' => [ - 'annotations' => [ - 'author', - 'covers', - 'coversNothing', - 'dataProvider', - 'depends', - 'group', - 'internal', - 'method', - 'property', - 'property-read', - 'property-write', - 'requires', - 'throws', - 'uses', + 'group_import' => true, + 'header_comment' => false, // false by default + 'heredoc_to_nowdoc' => true, + 'implode_call' => true, + 'include' => true, + 'increment_style' => ['style' => 'post'], + 'indentation_type' => true, + 'integer_literal_case' => true, + 'is_null' => true, + 'lambda_not_used_import' => true, + 'line_ending' => true, + 'linebreak_after_opening_tag' => false, + 'list_syntax' => ['syntax' => 'short'], + 'logical_operators' => true, + 'lowercase_cast' => true, + 'lowercase_keywords' => true, + 'lowercase_static_reference' => true, + 'magic_constant_casing' => true, + 'magic_method_casing' => true, + 'mb_str_functions' => false, + 'method_argument_space' => [ + 'after_heredoc' => false, + 'keep_multiple_spaces_after_comma' => false, + 'on_multiline' => 'ensure_fully_multiline', ], - ], - 'phpdoc_return_self_reference' => [ - 'replacements' => [ - 'this' => '$this', - '@this' => '$this', - '$self' => 'self', - '@self' => 'self', - '$static' => 'static', - '@static' => 'static', + 'method_chaining_indentation' => true, + 'modernize_strpos' => false, // requires 8.0+ + 'modernize_types_casting' => true, + 'multiline_comment_opening_closing' => true, + 'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'], + 'native_constant_invocation' => false, + 'native_function_casing' => true, + 'native_function_invocation' => false, + 'native_function_type_declaration_casing' => true, + 'new_with_braces' => true, + 'no_alias_functions' => ['sets' => ['@all']], + 'no_alias_language_construct_call' => true, + 'no_alternative_syntax' => ['fix_non_monolithic_code' => false], + 'no_binary_string' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_break_comment' => ['comment_text' => 'no break'], + 'no_closing_tag' => true, + 'no_empty_comment' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_blank_lines' => ['tokens' => ['extra']], + 'no_homoglyph_names' => true, + 'no_leading_import_slash' => true, + 'no_leading_namespace_whitespace' => true, + 'no_mixed_echo_print' => ['use' => 'echo'], + 'no_multiline_whitespace_around_double_arrow' => true, + 'no_null_property_initialization' => true, + 'no_short_bool_cast' => true, + 'no_singleline_whitespace_before_semicolons' => true, + 'no_space_around_double_colon' => true, + 'no_spaces_after_function_name' => true, + 'no_spaces_around_offset' => ['positions' => ['inside', 'outside']], + 'no_spaces_inside_parenthesis' => true, + 'no_superfluous_elseif' => true, + 'no_superfluous_phpdoc_tags' => [ + 'allow_mixed' => true, + 'allow_unused_params' => true, + 'remove_inheritdoc' => false, ], - ], - 'phpdoc_scalar' => [ - 'types' => [ - 'boolean', - 'callback', - 'double', - 'integer', - 'real', - 'str', + 'no_trailing_comma_in_singleline' => true, + 'no_trailing_whitespace' => true, + 'no_trailing_whitespace_in_comment' => true, + 'no_trailing_whitespace_in_string' => true, + 'no_unneeded_control_parentheses' => [ + 'statements' => [ + 'break', + 'clone', + 'continue', + 'echo_print', + 'return', + 'switch_case', + 'yield', + ], ], - ], - 'phpdoc_separation' => true, - 'phpdoc_single_line_var_spacing' => true, - 'phpdoc_summary' => false, - 'phpdoc_tag_casing' => ['tags' => ['inheritDoc']], - 'phpdoc_tag_type' => ['tags' => ['inheritDoc' => 'inline']], - 'phpdoc_to_comment' => false, - 'phpdoc_to_param_type' => false, - 'phpdoc_to_property_type' => false, - 'phpdoc_to_return_type' => false, - 'phpdoc_trim' => true, - 'phpdoc_trim_consecutive_blank_line_separation' => true, - 'phpdoc_types' => ['groups' => ['simple', 'alias', 'meta']], - 'phpdoc_types_order' => [ - 'null_adjustment' => 'always_last', - 'sort_algorithm' => 'alpha', - ], - 'phpdoc_var_annotation_correct_order' => true, - 'phpdoc_var_without_name' => true, - 'pow_to_exponentiation' => true, - 'protected_to_private' => true, - 'psr_autoloading' => ['dir' => null], - 'random_api_migration' => [ - 'replacements' => [ - 'getrandmax' => 'mt_getrandmax', - 'rand' => 'mt_rand', - 'srand' => 'mt_srand', + 'no_unneeded_curly_braces' => ['namespaces' => true], + 'no_unneeded_final_method' => ['private_methods' => true], + 'no_unneeded_import_alias' => true, + 'no_unreachable_default_argument_value' => true, + 'no_unset_cast' => true, + 'no_unset_on_property' => false, + 'no_unused_imports' => true, + 'no_useless_else' => true, + 'no_useless_return' => true, + 'no_useless_sprintf' => true, + 'no_whitespace_before_comma_in_array' => ['after_heredoc' => true], + 'no_whitespace_in_blank_line' => true, + 'non_printable_character' => ['use_escape_sequences_in_strings' => true], + 'normalize_index_brace' => true, + 'not_operator_with_space' => true, + 'not_operator_with_successor_space' => true, + 'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true], + 'object_operator_without_whitespace' => true, + 'operator_linebreak' => ['only_booleans' => true, 'position' => 'beginning'], + 'ordered_class_elements' => [ + 'order' => [ + 'use_trait', + 'case', + 'constant_public', + 'constant_protected', + 'constant_private', + 'property_public', + 'property_protected', + 'property_private', + 'construct', + 'destruct', + 'magic', + ], + 'sort_algorithm' => 'none', ], - ], - 'regular_callable_call' => true, - 'return_assignment' => true, - 'return_type_declaration' => ['space_before' => 'none'], - 'self_accessor' => false, - 'self_static_accessor' => true, - 'semicolon_after_instruction' => false, - 'set_type_to_cast' => true, - 'short_scalar_cast' => true, - 'simple_to_complex_string_variable' => true, - 'simplified_if_return' => true, - 'simplified_null_return' => false, - 'single_blank_line_at_eof' => true, - 'single_blank_line_before_namespace' => true, - 'single_class_element_per_statement' => ['elements' => ['const', 'property']], - 'single_import_per_statement' => false, - 'single_line_after_imports' => true, - 'single_line_comment_style' => ['comment_types' => ['asterisk', 'hash']], - 'single_line_throw' => false, - 'single_quote' => ['strings_containing_single_quote_chars' => false], - 'single_space_after_construct' => [ - 'constructs' => [ - 'abstract', - 'as', - 'attribute', - 'break', - 'case', - 'catch', - 'class', - 'clone', - 'comment', - 'const', - 'const_import', - 'continue', - 'do', - 'echo', - 'else', - 'elseif', - 'extends', - 'final', - 'finally', - 'for', - 'foreach', - 'function', - 'function_import', - 'global', - 'goto', - 'if', - 'implements', - 'include', - 'include_once', - 'instanceof', - 'insteadof', - 'interface', - 'match', - 'named_argument', - 'new', - 'open_tag_with_echo', - 'php_doc', - 'php_open', - 'print', - 'private', - 'protected', - 'public', - 'require', - 'require_once', - 'return', - 'static', - 'throw', - 'trait', - 'try', - 'use', - 'use_lambda', - 'use_trait', - 'var', - 'while', - 'yield', - 'yield_from', + 'ordered_imports' => [ + 'sort_algorithm' => 'alpha', + 'imports_order' => ['class', 'function', 'const'], ], - ], - 'single_trait_insert_per_statement' => true, - 'space_after_semicolon' => ['remove_in_empty_for_expressions' => true], - 'standardize_increment' => true, - 'standardize_not_equals' => true, - 'static_lambda' => true, - 'strict_comparison' => true, - 'strict_param' => true, - 'string_length_to_empty' => true, - 'string_line_ending' => true, - 'switch_case_semicolon_to_colon' => true, - 'switch_case_space' => true, - 'switch_continue_to_break' => true, - 'ternary_operator_spaces' => true, - 'ternary_to_elvis_operator' => true, - 'ternary_to_null_coalescing' => true, - 'trailing_comma_in_multiline' => [ - 'after_heredoc' => true, - 'elements' => ['arrays'], - ], - 'trim_array_spaces' => true, - 'types_spaces' => ['space' => 'none'], - 'unary_operator_spaces' => true, - 'use_arrow_functions' => true, - 'visibility_required' => ['elements' => ['const', 'method', 'property']], - 'void_return' => false, // changes method signature - 'whitespace_after_comma_in_array' => true, - 'yoda_style' => [ - 'equal' => false, - 'identical' => null, - 'less_and_greater' => false, - 'always_move_variable' => false, - ], -]); + 'ordered_interfaces' => false, + 'ordered_traits' => false, + 'php_unit_construct' => [ + 'assertions' => [ + 'assertSame', + 'assertEquals', + 'assertNotEquals', + 'assertNotSame', + ], + ], + 'php_unit_dedicate_assert' => ['target' => 'newest'], + 'php_unit_dedicate_assert_internal_type' => ['target' => 'newest'], + 'php_unit_expectation' => ['target' => 'newest'], + 'php_unit_fqcn_annotation' => true, + 'php_unit_internal_class' => ['types' => ['final']], + 'php_unit_method_casing' => ['case' => 'camel_case'], + 'php_unit_mock' => ['target' => 'newest'], + 'php_unit_mock_short_will_return' => true, + 'php_unit_namespaced' => ['target' => 'newest'], + 'php_unit_no_expectation_annotation' => [ + 'target' => 'newest', + 'use_class_const' => true, + ], + 'php_unit_set_up_tear_down_visibility' => true, + 'php_unit_size_class' => false, + 'php_unit_test_annotation' => ['style' => 'prefix'], + 'php_unit_test_case_static_method_calls' => [ + 'call_type' => 'this', + 'methods' => [], + ], + 'php_unit_test_class_requires_covers' => false, + 'phpdoc_add_missing_param_annotation' => ['only_untyped' => true], + 'phpdoc_align' => [ + 'align' => 'left' + ], + 'phpdoc_annotation_without_dot' => false, + 'phpdoc_indent' => true, + 'phpdoc_inline_tag_normalizer' => [ + 'tags' => [ + 'example', + 'id', + 'internal', + 'inheritdoc', + 'inheritdocs', + 'link', + 'source', + 'toc', + 'tutorial', + ], + ], + 'phpdoc_line_span' => [ + 'const' => 'multi', + 'method' => 'multi', + 'property' => 'multi', + ], + 'phpdoc_no_access' => true, + 'phpdoc_no_empty_return' => false, + 'phpdoc_no_package' => false, + 'phpdoc_no_useless_inheritdoc' => true, + 'phpdoc_order' => true, + 'phpdoc_order_by_value' => [ + 'annotations' => [ + 'author', + 'covers', + 'coversNothing', + 'dataProvider', + 'depends', + 'group', + 'internal', + 'method', + 'property', + 'property-read', + 'property-write', + 'requires', + 'throws', + 'uses', + ], + ], + 'phpdoc_return_self_reference' => [ + 'replacements' => [ + 'this' => '$this', + '@this' => '$this', + '$self' => 'self', + '@self' => 'self', + '$static' => 'static', + '@static' => 'static', + ], + ], + 'phpdoc_scalar' => [ + 'types' => [ + 'boolean', + 'callback', + 'double', + 'integer', + 'real', + 'str', + ], + ], + 'phpdoc_separation' => false, + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_summary' => false, + 'phpdoc_tag_casing' => ['tags' => ['inheritDoc']], + 'phpdoc_tag_type' => ['tags' => ['inheritDoc' => 'inline']], + 'phpdoc_to_comment' => false, + 'phpdoc_to_param_type' => false, + 'phpdoc_to_property_type' => false, + 'phpdoc_to_return_type' => false, + 'phpdoc_trim' => true, + 'phpdoc_trim_consecutive_blank_line_separation' => true, + 'phpdoc_types' => ['groups' => ['simple', 'alias', 'meta']], + 'phpdoc_types_order' => [ + 'null_adjustment' => 'always_last', + 'sort_algorithm' => 'alpha', + ], + 'phpdoc_var_annotation_correct_order' => true, + 'phpdoc_var_without_name' => true, + 'pow_to_exponentiation' => true, + 'protected_to_private' => true, + 'psr_autoloading' => ['dir' => null], + 'random_api_migration' => [ + 'replacements' => [ + 'getrandmax' => 'mt_getrandmax', + 'rand' => 'mt_rand', + 'srand' => 'mt_srand', + ], + ], + 'regular_callable_call' => true, + 'return_assignment' => true, + 'return_type_declaration' => ['space_before' => 'none'], + 'self_accessor' => false, + 'self_static_accessor' => true, + 'semicolon_after_instruction' => false, + 'set_type_to_cast' => true, + 'short_scalar_cast' => true, + 'simple_to_complex_string_variable' => true, + 'simplified_if_return' => true, + 'simplified_null_return' => false, + 'single_blank_line_at_eof' => true, + 'single_class_element_per_statement' => ['elements' => ['const', 'property']], + 'single_import_per_statement' => false, + 'single_line_after_imports' => true, + 'single_line_comment_style' => ['comment_types' => ['asterisk', 'hash']], + 'single_line_throw' => false, + 'single_quote' => ['strings_containing_single_quote_chars' => false], + 'single_space_around_construct' => [ + 'constructs_followed_by_a_single_space' => [ + 'abstract', + 'as', + 'attribute', + 'break', + 'case', + 'catch', + 'class', + 'clone', + 'comment', + 'const', + 'const_import', + 'continue', + 'do', + 'echo', + 'else', + 'elseif', + 'extends', + 'final', + 'finally', + 'for', + 'foreach', + 'function', + 'function_import', + 'global', + 'goto', + 'if', + 'implements', + 'include', + 'include_once', + 'instanceof', + 'insteadof', + 'interface', + 'match', + 'named_argument', + 'new', + 'open_tag_with_echo', + 'php_doc', + 'php_open', + 'print', + 'private', + 'protected', + 'public', + 'require', + 'require_once', + 'return', + 'static', + 'throw', + 'trait', + 'try', + 'use', + 'use_lambda', + 'use_trait', + 'var', + 'while', + 'yield', + 'yield_from', + ], + ], + 'single_trait_insert_per_statement' => true, + 'space_after_semicolon' => ['remove_in_empty_for_expressions' => true], + 'standardize_increment' => true, + 'standardize_not_equals' => true, + 'statement_indentation' => true, + 'static_lambda' => true, + 'strict_comparison' => true, + 'strict_param' => true, + 'string_length_to_empty' => true, + 'string_line_ending' => true, + 'switch_case_semicolon_to_colon' => true, + 'switch_case_space' => true, + 'switch_continue_to_break' => true, + 'ternary_operator_spaces' => true, + 'ternary_to_elvis_operator' => true, + 'ternary_to_null_coalescing' => true, + 'trailing_comma_in_multiline' => [ + 'after_heredoc' => true, + 'elements' => ['arrays'], + ], + 'trim_array_spaces' => true, + 'type_declaration_spaces' => ['elements' => ['function', 'property']], + 'types_spaces' => ['space' => 'none'], + 'unary_operator_spaces' => false, + 'use_arrow_functions' => true, + 'visibility_required' => ['elements' => ['const', 'method', 'property']], + 'void_return' => false, // changes method signature + 'whitespace_after_comma_in_array' => true, + 'yoda_style' => [ + 'equal' => false, + 'identical' => null, + 'less_and_greater' => false, + 'always_move_variable' => false, + ], + ]); diff --git a/config/bundles.php b/config/bundles.php index 04e5548..b94f692 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -1,13 +1,13 @@ ['all' => true], - Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], - Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true], - Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], - Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], - Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], - Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true], - Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true], - Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], + Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => TRUE], + Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => TRUE], + Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => TRUE], + Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => TRUE], + Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => TRUE, 'test' => TRUE], + Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => TRUE], + Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => TRUE], + Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => TRUE], + Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => TRUE], ]; diff --git a/config/packages/cache.php b/config/packages/cache.php index adc9f8a..0b80849 100644 --- a/config/packages/cache.php +++ b/config/packages/cache.php @@ -3,5 +3,5 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->extension('framework', ['cache' => null]); + $containerConfigurator->extension('framework', ['cache' => NULL]); }; diff --git a/config/packages/dev/easy_log_handler.php b/config/packages/dev/easy_log_handler.php index 3080b12..5c836fb 100644 --- a/config/packages/dev/easy_log_handler.php +++ b/config/packages/dev/easy_log_handler.php @@ -5,9 +5,9 @@ declare(strict_types=1); use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - $services = $containerConfigurator->services(); + $services = $containerConfigurator->services(); - $services->set('EasyCorp\EasyLog\EasyLogHandler') - ->private() - ->args(['%kernel.logs_dir%/%kernel.environment%.log']); + $services->set('EasyCorp\EasyLog\EasyLogHandler') + ->private() + ->args(['%kernel.logs_dir%/%kernel.environment%.log']); }; diff --git a/config/packages/dev/monolog.php b/config/packages/dev/monolog.php index 100379a..2f5e384 100644 --- a/config/packages/dev/monolog.php +++ b/config/packages/dev/monolog.php @@ -3,15 +3,15 @@ use Symfony\Config\MonologConfig; return static function (MonologConfig $config): void { - $config->handler('main', [ + $config->handler('main', [ 'type' => 'stream', 'path' => '%kernel.logs_dir%/%kernel.environment%.log', 'level' => 'debug', - 'channels' => ['elements' => ['!event']] + 'channels' => ['elements' => ['!event']], ]); $config->handler('console', [ 'type' => 'console', - 'process_psr_3_messages' => false, - 'channels' => ['elements' => ['!event', '!doctrine', '!console']] + 'process_psr_3_messages' => FALSE, + 'channels' => ['elements' => ['!event', '!doctrine', '!console']], ]); }; diff --git a/config/packages/dev/routing.php b/config/packages/dev/routing.php index 71e9b1f..f3c4e56 100644 --- a/config/packages/dev/routing.php +++ b/config/packages/dev/routing.php @@ -5,5 +5,5 @@ declare(strict_types=1); use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->extension('framework', ['router' => ['strict_requirements' => true]]); + $containerConfigurator->extension('framework', ['router' => ['strict_requirements' => TRUE]]); }; diff --git a/config/packages/dev/web_profiler.php b/config/packages/dev/web_profiler.php index fc813de..487359d 100644 --- a/config/packages/dev/web_profiler.php +++ b/config/packages/dev/web_profiler.php @@ -3,14 +3,14 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->extension('web_profiler', [ - 'toolbar' => true, - 'intercept_redirects' => false + $containerConfigurator->extension('web_profiler', [ + 'toolbar' => TRUE, + 'intercept_redirects' => FALSE, ]); - $containerConfigurator->extension('framework', [ + $containerConfigurator->extension('framework', [ 'profiler' => [ - 'only_exceptions' => false - ] + 'only_exceptions' => FALSE, + ], ]); }; diff --git a/config/packages/doctrine.php b/config/packages/doctrine.php index ea800d5..6fc98d7 100644 --- a/config/packages/doctrine.php +++ b/config/packages/doctrine.php @@ -15,7 +15,7 @@ return static function (ContainerConfigurator $containerConfigurator): void { 'types' => ['money' => MoneyType::class], 'logging' => '%kernel.debug%', 'mapping_types' => ['bit' => 'boolean', 'money' => 'money'], - 'url' => '%env(DATABASE_URL)%' + 'url' => '%env(DATABASE_URL)%', ], 'orm' => [ 'auto_generate_proxy_classes' => '%kernel.debug%', @@ -27,8 +27,8 @@ return static function (ContainerConfigurator $containerConfigurator): void { 'type' => 'attribute', 'dir' => '%kernel.project_dir%/src/Entity', 'prefix' => 'App\Entity', - 'alias' => 'App'] - ] - ] + 'alias' => 'App'], + ], + ], ]); }; diff --git a/config/packages/doctrine_migrations.php b/config/packages/doctrine_migrations.php index b171802..0a34cbf 100644 --- a/config/packages/doctrine_migrations.php +++ b/config/packages/doctrine_migrations.php @@ -4,5 +4,5 @@ use Symfony\Config\DoctrineMigrationsConfig; return static function (DoctrineMigrationsConfig $doctrineMigrations): void { $doctrineMigrations->migrationsPath('App\\Migrations', '%kernel.project_dir%/src/Migrations') - ->checkDatabasePlatform(true); + ->checkDatabasePlatform(TRUE); }; diff --git a/config/packages/framework.php b/config/packages/framework.php index dc719c4..16ec3d1 100644 --- a/config/packages/framework.php +++ b/config/packages/framework.php @@ -2,15 +2,14 @@ declare(strict_types=1); -use Symfony\Config\FrameworkConfig; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; +use Symfony\Config\FrameworkConfig; return static function (ContainerConfigurator $containerConfigurator, FrameworkConfig $config): void { - $config->session(['handler_id' => null]); + $config->session(['handler_id' => NULL]); $config->secret('%env(APP_SECRET)%') ->defaultLocale('en') - ->httpMethodOverride(true) - ->phpErrors(['log' => true]) - ; + ->httpMethodOverride(TRUE) + ->phpErrors(['log' => TRUE]); }; diff --git a/config/packages/prod/doctrine.php b/config/packages/prod/doctrine.php index 7f876a8..ad643d1 100644 --- a/config/packages/prod/doctrine.php +++ b/config/packages/prod/doctrine.php @@ -4,43 +4,43 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura use function Symfony\Component\DependencyInjection\Loader\Configurator\service; return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->extension('doctrine', [ + $containerConfigurator->extension('doctrine', [ 'orm' => [ 'metadata_cache_driver' => [ 'type' => 'service', - 'id' => 'doctrine.system_cache_provider' + 'id' => 'doctrine.system_cache_provider', ], 'query_cache_driver' => [ 'type' => 'service', - 'id' => 'doctrine.system_cache_provider' + 'id' => 'doctrine.system_cache_provider', ], 'result_cache_driver' => [ 'type' => 'service', - 'id' => 'doctrine.result_cache_provider' - ] - ] + 'id' => 'doctrine.result_cache_provider', + ], + ], ]); - $services = $containerConfigurator->services(); + $services = $containerConfigurator->services(); - $services->set('doctrine.result_cache_provider', 'Symfony\Component\Cache\DoctrineProvider') - ->private() - ->args([service('doctrine.result_cache_pool')]); + $services->set('doctrine.result_cache_provider', 'Symfony\Component\Cache\DoctrineProvider') + ->private() + ->args([service('doctrine.result_cache_pool')]); - $services->set('doctrine.system_cache_provider', 'Symfony\Component\Cache\DoctrineProvider') - ->private() - ->args([service('doctrine.system_cache_pool')]); + $services->set('doctrine.system_cache_provider', 'Symfony\Component\Cache\DoctrineProvider') + ->private() + ->args([service('doctrine.system_cache_pool')]); - $containerConfigurator->extension('framework', [ + $containerConfigurator->extension('framework', [ 'cache' => [ 'pools' => [ 'doctrine.result_cache_pool' => [ - 'adapter' => 'cache.app' + 'adapter' => 'cache.app', ], 'doctrine.system_cache_pool' => [ - 'adapter' => 'cache.system' - ] - ] - ] + 'adapter' => 'cache.system', + ], + ], + ], ]); }; diff --git a/config/packages/prod/monolog.php b/config/packages/prod/monolog.php index b4be096..0514497 100644 --- a/config/packages/prod/monolog.php +++ b/config/packages/prod/monolog.php @@ -3,24 +3,24 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->extension('monolog', [ + $containerConfigurator->extension('monolog', [ 'handlers' => [ 'main' => [ 'type' => 'fingers_crossed', 'action_level' => 'error', 'handler' => 'nested', - 'excluded_404s' => ['^/'] + 'excluded_404s' => ['^/'], ], 'nested' => [ 'type' => 'stream', 'path' => '%kernel.logs_dir%/%kernel.environment%.log', - 'level' => 'debug' + 'level' => 'debug', ], 'console' => [ 'type' => 'console', - 'process_psr_3_messages' => false, - 'channels' => ['!event', '!doctrine'] - ] - ] + 'process_psr_3_messages' => FALSE, + 'channels' => ['!event', '!doctrine'], + ], + ], ]); }; diff --git a/config/packages/prod/routing.php b/config/packages/prod/routing.php index a4dde3d..e54fbcd 100644 --- a/config/packages/prod/routing.php +++ b/config/packages/prod/routing.php @@ -3,7 +3,7 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->extension('framework', [ - 'router' => ['strict_requirements' => null] + $containerConfigurator->extension('framework', [ + 'router' => ['strict_requirements' => NULL], ]); }; diff --git a/config/packages/routing.php b/config/packages/routing.php index 49a559f..cd664c6 100644 --- a/config/packages/routing.php +++ b/config/packages/routing.php @@ -3,10 +3,10 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->extension('framework', [ + $containerConfigurator->extension('framework', [ 'router' => [ - 'strict_requirements' => null, - 'utf8' => true - ] + 'strict_requirements' => NULL, + 'utf8' => TRUE, + ], ]); }; diff --git a/config/packages/security.php b/config/packages/security.php index 0793f91..4380b8c 100644 --- a/config/packages/security.php +++ b/config/packages/security.php @@ -1,36 +1,36 @@ passwordHasher(PasswordAuthenticatedUserInterface::class, 'auto') - ; + $security->passwordHasher(PasswordAuthenticatedUserInterface::class, 'auto'); $containerConfigurator->extension('security', [ 'providers' => [ 'users_in_memory' => [ - 'memory' => null] + 'memory' => NULL], ], 'firewalls' => [ 'dev' => [ 'pattern' => '^/(_(profiler|wdt)|css|images|js)/', - 'security' => false + 'security' => FALSE, ], 'main' => [ - 'lazy' => true, - 'provider' => 'users_in_memory' - ] + 'lazy' => TRUE, + 'provider' => 'users_in_memory', + ], ], - 'access_control' => null + 'access_control' => NULL, ]); - if ($containerConfigurator->env() === 'test') { + if ($containerConfigurator->env() === 'test') + { $security->passwordHasher(PasswordAuthenticatedUserInterface::class, [ 'algorithm' => 'auto', 'cost' => 4, 'time_cost' => 3, - 'memory_cost' => 10 + 'memory_cost' => 10, ]); - } + } }; diff --git a/config/packages/sensio_framework_extra.php b/config/packages/sensio_framework_extra.php index d93263e..f6588fe 100644 --- a/config/packages/sensio_framework_extra.php +++ b/config/packages/sensio_framework_extra.php @@ -3,7 +3,7 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->extension('sensio_framework_extra', [ - 'router' => ['annotations' => false] + $containerConfigurator->extension('sensio_framework_extra', [ + 'router' => ['annotations' => FALSE], ]); }; diff --git a/config/packages/test/framework.php b/config/packages/test/framework.php index ade2b9d..639e803 100644 --- a/config/packages/test/framework.php +++ b/config/packages/test/framework.php @@ -5,5 +5,5 @@ declare(strict_types=1); use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->extension('framework', ['test' => null]); + $containerConfigurator->extension('framework', ['test' => NULL]); }; diff --git a/config/packages/test/monolog.php b/config/packages/test/monolog.php index 2d21b6b..f75bcbe 100644 --- a/config/packages/test/monolog.php +++ b/config/packages/test/monolog.php @@ -5,5 +5,5 @@ declare(strict_types=1); use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->extension('monolog', ['handlers' => ['main' => ['type' => 'stream', 'path' => '%kernel.logs_dir%/%kernel.environment%.log', 'level' => 'debug', 'channels' => ['!event']]]]); + $containerConfigurator->extension('monolog', ['handlers' => ['main' => ['type' => 'stream', 'path' => '%kernel.logs_dir%/%kernel.environment%.log', 'level' => 'debug', 'channels' => ['!event']]]]); }; diff --git a/config/packages/test/twig.php b/config/packages/test/twig.php index 26121df..b4a514f 100644 --- a/config/packages/test/twig.php +++ b/config/packages/test/twig.php @@ -5,5 +5,5 @@ declare(strict_types=1); use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->extension('twig', ['strict_variables' => true]); + $containerConfigurator->extension('twig', ['strict_variables' => TRUE]); }; diff --git a/config/packages/test/validator.php b/config/packages/test/validator.php index 5b71dde..d753894 100644 --- a/config/packages/test/validator.php +++ b/config/packages/test/validator.php @@ -5,5 +5,5 @@ declare(strict_types=1); use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->extension('framework', ['validation' => ['not_compromised_password' => false]]); + $containerConfigurator->extension('framework', ['validation' => ['not_compromised_password' => FALSE]]); }; diff --git a/config/packages/test/web_profiler.php b/config/packages/test/web_profiler.php index ed8f9a3..58eaeae 100644 --- a/config/packages/test/web_profiler.php +++ b/config/packages/test/web_profiler.php @@ -5,7 +5,7 @@ declare(strict_types=1); use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->extension('web_profiler', ['toolbar' => false, 'intercept_redirects' => false]); + $containerConfigurator->extension('web_profiler', ['toolbar' => FALSE, 'intercept_redirects' => FALSE]); - $containerConfigurator->extension('framework', ['profiler' => ['collect' => false]]); + $containerConfigurator->extension('framework', ['profiler' => ['collect' => FALSE]]); }; diff --git a/config/packages/translation.php b/config/packages/translation.php index adcb0b5..ec8306b 100644 --- a/config/packages/translation.php +++ b/config/packages/translation.php @@ -3,11 +3,11 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->extension('framework', [ + $containerConfigurator->extension('framework', [ 'default_locale' => 'en', 'translator' => [ 'default_path' => '%kernel.project_dir%/translations', - 'fallbacks' => ['%locale%'] - ] + 'fallbacks' => ['%locale%'], + ], ]); }; diff --git a/config/packages/twig.php b/config/packages/twig.php index acebcd1..fdfead1 100644 --- a/config/packages/twig.php +++ b/config/packages/twig.php @@ -6,6 +6,5 @@ return static function (TwigConfig $config): void { $config->formThemes(['form_custom_layout.html.twig']) ->defaultPath('%kernel.project_dir%/templates') ->debug('%kernel.debug%') - ->strictVariables('%kernel.debug%') - ; + ->strictVariables('%kernel.debug%'); }; diff --git a/config/packages/validator.php b/config/packages/validator.php index 1b51cb2..89efa02 100644 --- a/config/packages/validator.php +++ b/config/packages/validator.php @@ -3,5 +3,5 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { - $containerConfigurator->extension('framework', ['validation' => ['email_validation_mode' => 'html5']]); + $containerConfigurator->extension('framework', ['validation' => ['email_validation_mode' => 'html5']]); }; diff --git a/config/preload.php b/config/preload.php index b38b648..9a48710 100644 --- a/config/preload.php +++ b/config/preload.php @@ -1,5 +1,6 @@ import('../../src/Controller/', 'annotation'); + $routingConfigurator->import('../../src/Controller/', 'annotation'); }; diff --git a/config/routes/dev/framework.php b/config/routes/dev/framework.php index b9ea828..545bc79 100644 --- a/config/routes/dev/framework.php +++ b/config/routes/dev/framework.php @@ -3,6 +3,6 @@ use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; return static function (RoutingConfigurator $routingConfigurator): void { - $routingConfigurator->import('@FrameworkBundle/Resources/config/routing/errors.xml') - ->prefix('/_error'); + $routingConfigurator->import('@FrameworkBundle/Resources/config/routing/errors.xml') + ->prefix('/_error'); }; diff --git a/config/routes/dev/web_profiler.php b/config/routes/dev/web_profiler.php index 1a4c167..62ad5c1 100644 --- a/config/routes/dev/web_profiler.php +++ b/config/routes/dev/web_profiler.php @@ -3,9 +3,9 @@ use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; return static function (RoutingConfigurator $routingConfigurator): void { - $routingConfigurator->import('@WebProfilerBundle/Resources/config/routing/wdt.xml') - ->prefix('/_wdt'); + $routingConfigurator->import('@WebProfilerBundle/Resources/config/routing/wdt.xml') + ->prefix('/_wdt'); - $routingConfigurator->import('@WebProfilerBundle/Resources/config/routing/profiler.xml') - ->prefix('/_profiler'); + $routingConfigurator->import('@WebProfilerBundle/Resources/config/routing/profiler.xml') + ->prefix('/_profiler'); }; diff --git a/config/services.php b/config/services.php index 86aa9e2..882f018 100644 --- a/config/services.php +++ b/config/services.php @@ -4,7 +4,7 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator; use App\Maker\MakeCollectionCrud; -return function (ContainerConfigurator $configurator): void { +return static function (ContainerConfigurator $configurator): void { $parameters = $configurator->parameters(); $parameters->set('locale', 'en'); diff --git a/public/index.php b/public/index.php index d00a432..848e3fa 100644 --- a/public/index.php +++ b/public/index.php @@ -11,18 +11,21 @@ require dirname(__DIR__) . '/vendor/autoload.php'; (new Dotenv())->bootEnv(dirname(__DIR__) . '/.env'); -if ($_SERVER['APP_DEBUG']) { - umask(0000); +if ($_SERVER['APP_DEBUG']) +{ + umask(0000); - Debug::enable(); + Debug::enable(); } -if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? FALSE) { - Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); +if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? FALSE) +{ + Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); } -if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? FALSE) { - Request::setTrustedHosts([$trustedHosts]); +if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? FALSE) +{ + Request::setTrustedHosts([$trustedHosts]); } $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); diff --git a/src/Controller/BrandCategoryController.php b/src/Controller/BrandCategoryController.php index 1ee21af..940241f 100644 --- a/src/Controller/BrandCategoryController.php +++ b/src/Controller/BrandCategoryController.php @@ -1,4 +1,4 @@ -indexView('brand_categories'); - } + } - #[Route('/new', name: 'brand-category_new', methods: ['GET', 'POST'])] - public function new(Request $request, EntityManagerInterface $entityManager): Response - { + #[Route('/new', name: 'brand-category_new', methods: ['GET', 'POST'])] + public function new(Request $request, EntityManagerInterface $entityManager): Response + { return $this->itemCreate($request, 'brand_category'); - } + } - #[Route('/{name}', name: 'brand-category_show', methods: ['GET'])] - public function show(BrandCategory $brandCategory): Response - { + #[Route('/{name}', name: 'brand-category_show', methods: ['GET'])] + public function show(BrandCategory $brandCategory): Response + { return $this->itemView($brandCategory, 'brand_category'); - } + } - #[Route('/{name}/edit', name: 'brand-category_edit', methods: ['GET', 'POST'])] - public function edit(Request $request, BrandCategory $brandCategory): Response - { + #[Route('/{name}/edit', name: 'brand-category_edit', methods: ['GET', 'POST'])] + public function edit(Request $request, BrandCategory $brandCategory): Response + { return $this->itemUpdate($request, $brandCategory, 'brand_category'); - } + } - #[Route('/{name}', name: 'brand-category_delete', methods: ['POST'])] - public function delete(Request $request, BrandCategory $brandCategory): Response - { + #[Route('/{name}', name: 'brand-category_delete', methods: ['POST'])] + public function delete(Request $request, BrandCategory $brandCategory): Response + { return $this->deleteCSRF($request, $brandCategory); - } + } } diff --git a/src/Controller/BrandController.php b/src/Controller/BrandController.php index ee72f76..592efd7 100644 --- a/src/Controller/BrandController.php +++ b/src/Controller/BrandController.php @@ -10,48 +10,47 @@ use Symfony\Component\HttpFoundation\{Request, Response}; use Symfony\Component\Routing\Annotation\Route; #[Route('/brand')] -class BrandController extends AbstractController -{ - use FormControllerBase; +class BrandController extends AbstractController { + use FormControllerBase; - protected const ENTITY = Brand::class; - protected const TEMPLATE_PATH = 'brand/'; - protected const ROUTE_PREFIX = 'brand_'; - protected const FORM = BrandType::class; + protected const ENTITY = Brand::class; + protected const TEMPLATE_PATH = 'brand/'; + protected const ROUTE_PREFIX = 'brand_'; + protected const FORM = BrandType::class; - public function __construct(private readonly EntityManagerInterface $entityManager) - { - } + public function __construct(private readonly EntityManagerInterface $entityManager) + { + } - #[Route('/', name: 'brand_index', methods: ['GET'])] - public function index(): Response - { - return $this->itemListView('brands', [ - 'name' => 'asc', - ]); - } + #[Route('/', name: 'brand_index', methods: ['GET'])] + public function index(): Response + { + return $this->itemListView('brands', [ + 'name' => 'asc', + ]); + } - #[Route('/new', name: 'brand_new', methods: ['GET', 'POST'])] - public function new(Request $request): Response - { - return $this->itemCreate($request, 'brand'); - } + #[Route('/new', name: 'brand_new', methods: ['GET', 'POST'])] + public function new(Request $request): Response + { + return $this->itemCreate($request, 'brand'); + } - #[Route('/{id}', name: 'brand_show', methods: ['GET'])] - public function show(Brand $brand): Response - { - return $this->itemView($brand, 'brand'); - } + #[Route('/{id}', name: 'brand_show', methods: ['GET'])] + public function show(Brand $brand): Response + { + return $this->itemView($brand, 'brand'); + } - #[Route('/{id}/edit', name: 'brand_edit', methods: ['GET', 'POST'])] - public function edit(Request $request, Brand $brand): Response - { - return $this->itemUpdate($request, $brand, 'brand'); - } + #[Route('/{id}/edit', name: 'brand_edit', methods: ['GET', 'POST'])] + public function edit(Request $request, Brand $brand): Response + { + return $this->itemUpdate($request, $brand, 'brand'); + } - #[Route('/{id}', name: 'brand_delete', methods: ['POST'])] - public function delete(Request $request, Brand $brand): Response - { - return $this->deleteCSRF($request, $brand); - } + #[Route('/{id}', name: 'brand_delete', methods: ['POST'])] + public function delete(Request $request, Brand $brand): Response + { + return $this->deleteCSRF($request, $brand); + } } diff --git a/src/Controller/CameraController.php b/src/Controller/CameraController.php index 064fa3c..15819ad 100644 --- a/src/Controller/CameraController.php +++ b/src/Controller/CameraController.php @@ -2,10 +2,10 @@ namespace App\Controller; -use App\Entity\Camera; -use App\Form\CameraType; use App\Controller\ {DeleteFormTrait}; +use App\Entity\Camera; +use App\Form\CameraType; use Doctrine\ORM\{EntityManagerInterface, ORMInvalidArgumentException}; use LogicException; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -17,120 +17,119 @@ use Symfony\Component\Routing\Annotation\Route; * Camera controller. */ #[Route(path: 'camera')] -class CameraController extends AbstractController -{ - use FormControllerBase; - use DeleteFormTrait; +class CameraController extends AbstractController { + use FormControllerBase; + use DeleteFormTrait; - protected const ENTITY = Camera::class; - protected const TEMPLATE_PATH = 'camera/'; - protected const ROUTE_PREFIX = 'camera_'; - protected const FORM = CameraType::class; + protected const ENTITY = Camera::class; + protected const TEMPLATE_PATH = 'camera/'; + protected const ROUTE_PREFIX = 'camera_'; + protected const FORM = CameraType::class; - public function __construct(private readonly EntityManagerInterface $entityManager) - { - } + public function __construct(private readonly EntityManagerInterface $entityManager) + { + } - /** - * Lists all camera entities. - */ - #[Route(path: '/', name: 'camera_index', methods: ['GET'])] - public function indexAction(): Response - { - $receivedItems = $this->entityManager->getRepository(self::ENTITY)->findBy([ - 'received' => TRUE, - ], [ - 'isWorking' => 'ASC', - 'brand' => 'ASC', - 'mount' => 'ASC', - 'model' => 'ASC', - ]); - $newItems = $this->entityManager->getRepository(self::ENTITY)->findBy([ - 'received' => FALSE, - ], [ - 'brand' => 'ASC', - 'mount' => 'ASC', - 'model' => 'ASC', - ]); - $working = array_filter($receivedItems, [$this, 'isWorking']); - $notWorking = array_filter($receivedItems, [$this, 'isNotWorking']); + /** + * Lists all camera entities. + */ + #[Route(path: '/', name: 'camera_index', methods: ['GET'])] + public function indexAction(): Response + { + $receivedItems = $this->entityManager->getRepository(self::ENTITY)->findBy([ + 'received' => TRUE, + ], [ + 'isWorking' => 'ASC', + 'brand' => 'ASC', + 'mount' => 'ASC', + 'model' => 'ASC', + ]); + $newItems = $this->entityManager->getRepository(self::ENTITY)->findBy([ + 'received' => FALSE, + ], [ + 'brand' => 'ASC', + 'mount' => 'ASC', + 'model' => 'ASC', + ]); + $working = array_filter($receivedItems, [$this, 'isWorking']); + $notWorking = array_filter($receivedItems, [$this, 'isNotWorking']); - return $this->render('camera/index.html.twig', [ - 'not_received' => $newItems, - 'not_working' => $notWorking, - 'working' => $working, - ]); - } + return $this->render('camera/index.html.twig', [ + 'not_received' => $newItems, + 'not_working' => $notWorking, + 'working' => $working, + ]); + } - /** - * Creates a new camera entity. - */ - #[Route(path: '/new', name: 'camera_new', methods: ['GET', 'POST'])] - public function newAction(Request $request): RedirectResponse|Response - { - return $this->itemCreate($request, 'camera'); - } + /** + * Creates a new camera entity. + */ + #[Route(path: '/new', name: 'camera_new', methods: ['GET', 'POST'])] + public function newAction(Request $request): RedirectResponse|Response + { + return $this->itemCreate($request, 'camera'); + } - /** - * Finds and displays a camera entity. - */ - #[Route(path: '/{id}', name: 'camera_show', methods: ['GET'])] - public function showAction(Camera $camera): Response - { - return $this->itemView($camera, 'camera'); - } + /** + * Finds and displays a camera entity. + */ + #[Route(path: '/{id}', name: 'camera_show', methods: ['GET'])] + public function showAction(Camera $camera): Response + { + return $this->itemView($camera, 'camera'); + } - /** - * Displays a form to edit an existing camera entity. - * - * @throws LogicException - */ - #[Route(path: '/{id}/edit', name: 'camera_edit', methods: ['GET', 'POST'])] - public function editAction(Request $request, Camera $camera): RedirectResponse|Response - { - return $this->itemUpdate($request, $camera, 'camera'); - } + /** + * Displays a form to edit an existing camera entity. + * + * @throws LogicException + */ + #[Route(path: '/{id}/edit', name: 'camera_edit', methods: ['GET', 'POST'])] + public function editAction(Request $request, Camera $camera): RedirectResponse|Response + { + return $this->itemUpdate($request, $camera, 'camera'); + } - /** - * Deletes a camera entity. - * - * @throws LogicException - */ - #[Route(path: '/{id}', name: 'camera_delete', methods: ['POST', 'DELETE'])] - public function deleteAction(Request $request, Camera $camera): RedirectResponse - { - return $this->itemDelete($request, $camera); - } + /** + * Deletes a camera entity. + * + * @throws LogicException + */ + #[Route(path: '/{id}', name: 'camera_delete', methods: ['POST', 'DELETE'])] + public function deleteAction(Request $request, Camera $camera): RedirectResponse + { + return $this->itemDelete($request, $camera); + } - /** - * Moves a camera to the previouslyOwned table - * - * @throws LogicException - * @throws ORMInvalidArgumentException - */ - #[Route(path: '/{id}/deacquire', name: 'camera_deacquire', methods: ['POST'])] - public function deacquireAction(Request $request, Camera $camera): RedirectResponse - { - return $this->itemDeacquire($request, $camera, 'previously-owned-camera_index'); - } + /** + * Moves a camera to the previouslyOwned table + * + * @throws LogicException + * @throws ORMInvalidArgumentException + */ + #[Route(path: '/{id}/deacquire', name: 'camera_deacquire', methods: ['POST'])] + public function deacquireAction(Request $request, Camera $camera): RedirectResponse + { + return $this->itemDeacquire($request, $camera, 'previously-owned-camera_index'); + } - /** - * Creates a form to move - * - * @param Camera $camera The camera entity - */ - private function createDeacquireForm(Camera $camera): FormInterface - { - return $this->buildForm($camera, 'camera_deacquire'); - } + /** + * Creates a form to move + * + * @param Camera $camera The camera entity + */ + private function createDeacquireForm(Camera $camera): FormInterface + { + return $this->buildForm($camera, 'camera_deacquire'); + } - private function isWorking(Camera $camera): bool - { - return $camera->getIsWorking(); - } + private function isWorking(Camera $camera): bool + { + return $camera->getIsWorking(); + } - private function isNotWorking(Camera $camera): bool - { - return ! $this->isWorking($camera); - } + private function isNotWorking(Camera $camera): bool + { + return ! $this->isWorking($camera); + } } diff --git a/src/Controller/CameraTypeController.php b/src/Controller/CameraTypeController.php index f1bb38a..7ee8205 100644 --- a/src/Controller/CameraTypeController.php +++ b/src/Controller/CameraTypeController.php @@ -2,74 +2,73 @@ namespace App\Controller; -use App\Entity\CameraType; -use App\Form\CameraTypeType; use App\Controller\ {DeleteFormTrait}; +use App\Entity\CameraType; +use App\Form\CameraTypeType; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response}; use Symfony\Component\Routing\Annotation\Route; #[Route(path: 'camera-type')] -class CameraTypeController extends AbstractController -{ - use FormControllerBase; - use DeleteFormTrait; +class CameraTypeController extends AbstractController { + use FormControllerBase; + use DeleteFormTrait; - protected const ENTITY = CameraType::class; - protected const TEMPLATE_PATH = 'cameratype/'; - protected const ROUTE_PREFIX = 'camera-type_'; - protected const FORM = CameraTypeType::class; + protected const ENTITY = CameraType::class; + protected const TEMPLATE_PATH = 'cameratype/'; + protected const ROUTE_PREFIX = 'camera-type_'; + protected const FORM = CameraTypeType::class; - public function __construct(private readonly EntityManagerInterface $entityManager) - { - } + public function __construct(private readonly EntityManagerInterface $entityManager) + { + } - /** - * Lists all cameraType entities. - */ - #[Route(path: '/', name: 'camera-type_index', methods: ['GET'])] - public function indexAction(): Response - { - return $this->itemListView('cameraTypes', [ - 'type' => 'ASC', - ]); - } + /** + * Lists all cameraType entities. + */ + #[Route(path: '/', name: 'camera-type_index', methods: ['GET'])] + public function indexAction(): Response + { + return $this->itemListView('cameraTypes', [ + 'type' => 'ASC', + ]); + } - /** - * Creates a new cameraType entity. - */ - #[Route(path: '/new', name: 'camera-type_new', methods: ['GET', 'POST'])] - public function newAction(Request $request): Response - { - return $this->itemCreate($request, 'cameraType'); - } + /** + * Creates a new cameraType entity. + */ + #[Route(path: '/new', name: 'camera-type_new', methods: ['GET', 'POST'])] + public function newAction(Request $request): Response + { + return $this->itemCreate($request, 'cameraType'); + } - /** - * Finds and displays a cameraType entity. - */ - #[Route(path: '/{id}', name: 'camera-type_show', methods: ['GET'])] - public function showAction(CameraType $cameraType): Response - { - return $this->itemView($cameraType, 'cameraType'); - } + /** + * Finds and displays a cameraType entity. + */ + #[Route(path: '/{id}', name: 'camera-type_show', methods: ['GET'])] + public function showAction(CameraType $cameraType): Response + { + return $this->itemView($cameraType, 'cameraType'); + } - /** - * Displays a form to edit an existing cameraType entity. - */ - #[Route(path: '/{id}/edit', name: 'camera-type_edit', methods: ['GET', 'POST'])] - public function editAction(Request $request, CameraType $cameraType): RedirectResponse|Response - { - return $this->itemUpdate($request, $cameraType, 'cameraType'); - } + /** + * Displays a form to edit an existing cameraType entity. + */ + #[Route(path: '/{id}/edit', name: 'camera-type_edit', methods: ['GET', 'POST'])] + public function editAction(Request $request, CameraType $cameraType): RedirectResponse|Response + { + return $this->itemUpdate($request, $cameraType, 'cameraType'); + } - /** - * Deletes a cameraType entity. - */ - #[Route(path: '/{id}', name: 'camera-type_delete', methods: ['POST', 'DELETE'])] - public function deleteAction(Request $request, CameraType $cameraType): RedirectResponse - { - return $this->itemDelete($request, $cameraType); - } + /** + * Deletes a cameraType entity. + */ + #[Route(path: '/{id}', name: 'camera-type_delete', methods: ['POST', 'DELETE'])] + public function deleteAction(Request $request, CameraType $cameraType): RedirectResponse + { + return $this->itemDelete($request, $cameraType); + } } diff --git a/src/Controller/ChipsetController.php b/src/Controller/ChipsetController.php index 919ff04..f240e20 100644 --- a/src/Controller/ChipsetController.php +++ b/src/Controller/ChipsetController.php @@ -6,8 +6,7 @@ use App\Entity\Chipset; use App\Form\ChipsetType; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\{Request, Response}; use Symfony\Component\Routing\Annotation\Route; #[Route('/chipset')] diff --git a/src/Controller/CpuController.php b/src/Controller/CpuController.php index e3af1ea..d7e35b5 100644 --- a/src/Controller/CpuController.php +++ b/src/Controller/CpuController.php @@ -6,8 +6,7 @@ use App\Entity\Cpu; use App\Form\CpuType; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\{Request, Response}; use Symfony\Component\Routing\Annotation\Route; #[Route('/cpu')] @@ -35,8 +34,8 @@ class CpuController extends AbstractController { $amd = array_filter($items, static fn (Cpu $cpu) => $cpu->getBrand()->getName() === 'AMD' && $cpu->isReceived()); $intel = array_filter($items, static fn (Cpu $cpu) => $cpu->getBrand()->getName() === 'Intel' && $cpu->isReceived()); - $others = array_filter($items, static fn (Cpu $cpu) => ( ! in_array($cpu->getBrand()->getName(), ['AMD','Intel'])) && $cpu->isReceived()); - $notReceived = array_filter($items, static fn(CPU $cpu) => $cpu->isReceived() === FALSE); + $others = array_filter($items, static fn (Cpu $cpu) => ( ! in_array($cpu->getBrand()->getName(), ['AMD', 'Intel'], TRUE)) && $cpu->isReceived()); + $notReceived = array_filter($items, static fn (CPU $cpu) => $cpu->isReceived() === FALSE); return $this->render($template, [ 'all' => [ diff --git a/src/Controller/DefaultController.php b/src/Controller/DefaultController.php index 8f38507..7e01369 100644 --- a/src/Controller/DefaultController.php +++ b/src/Controller/DefaultController.php @@ -6,14 +6,13 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\{Request, Response}; use Symfony\Component\Routing\Annotation\Route; -class DefaultController extends AbstractController -{ - #[Route(path: '/', name: 'homepage')] - public function indexAction(Request $request): Response - { - // replace this example code with whatever you need - return $this->render('default/index.html.twig', [ - 'base_dir' => realpath($this->getParameter('kernel.project_dir')) . DIRECTORY_SEPARATOR, - ]); - } +class DefaultController extends AbstractController { + #[Route(path: '/', name: 'homepage')] + public function indexAction(Request $request): Response + { + // replace this example code with whatever you need + return $this->render('default/index.html.twig', [ + 'base_dir' => realpath($this->getParameter('kernel.project_dir')) . DIRECTORY_SEPARATOR, + ]); + } } diff --git a/src/Controller/DeleteFormTrait.php b/src/Controller/DeleteFormTrait.php index 2b9a453..526a303 100644 --- a/src/Controller/DeleteFormTrait.php +++ b/src/Controller/DeleteFormTrait.php @@ -4,13 +4,12 @@ namespace App\Controller; use Symfony\Component\Form\FormInterface; -trait DeleteFormTrait -{ - /** - * Creates a form to delete an entity. - */ - private function createDeleteForm(mixed $item): FormInterface - { - return $this->buildForm($item, self::ROUTE_PREFIX . 'delete', 'DELETE'); - } +trait DeleteFormTrait { + /** + * Creates a form to delete an entity. + */ + private function createDeleteForm(mixed $item): FormInterface + { + return $this->buildForm($item, self::ROUTE_PREFIX . 'delete', 'DELETE'); + } } diff --git a/src/Controller/FilmController.php b/src/Controller/FilmController.php index 02d9bc3..15fe2fa 100644 --- a/src/Controller/FilmController.php +++ b/src/Controller/FilmController.php @@ -4,8 +4,6 @@ namespace App\Controller; use App\Entity\Film; use App\Form\FilmType; -use App\Controller\ -{DeleteFormTrait}; use Doctrine\Common\Collections\Criteria; use Doctrine\ORM\EntityManagerInterface; use LogicException; @@ -17,87 +15,86 @@ use Symfony\Component\Routing\Annotation\Route; * Film controller. */ #[Route(path: 'film')] -class FilmController extends AbstractController -{ - use FormControllerBase; - use DeleteFormTrait; +class FilmController extends AbstractController { + use FormControllerBase; + use DeleteFormTrait; - protected const ENTITY = Film::class; - protected const TEMPLATE_PATH = 'film/'; - protected const ROUTE_PREFIX = 'film_'; - protected const FORM = FilmType::class; + protected const ENTITY = Film::class; + protected const TEMPLATE_PATH = 'film/'; + protected const ROUTE_PREFIX = 'film_'; + protected const FORM = FilmType::class; - public function __construct(private readonly EntityManagerInterface $entityManager) - { - } + public function __construct(private readonly EntityManagerInterface $entityManager) + { + } - /** - * Lists all film entities. - */ - #[Route(path: '/', name: 'film_index', methods: ['GET'])] - public function indexAction(): Response - { - $repo = $this->entityManager->getRepository(self::ENTITY); - $criteria = Criteria::create() - ->where(Criteria::expr()->gt('rollsInCamera', 0)) - ->orderBy([ - 'filmFormat' => Criteria::ASC, - 'brand' => Criteria::ASC, - 'rollsInCamera' => Criteria::DESC, - 'productLine' => Criteria::ASC, - ]); - $inCamera = $repo->matching($criteria); - $notInCamera = $repo->findBy([ - 'rollsInCamera' => 0, - ], [ - 'brand' => 'ASC', - 'productLine' => 'ASC', - 'filmFormat' => 'ASC', - ]); + /** + * Lists all film entities. + */ + #[Route(path: '/', name: 'film_index', methods: ['GET'])] + public function indexAction(): Response + { + $repo = $this->entityManager->getRepository(self::ENTITY); + $criteria = Criteria::create() + ->where(Criteria::expr()->gt('rollsInCamera', 0)) + ->orderBy([ + 'filmFormat' => Criteria::ASC, + 'brand' => Criteria::ASC, + 'rollsInCamera' => Criteria::DESC, + 'productLine' => Criteria::ASC, + ]); + $inCamera = $repo->matching($criteria); + $notInCamera = $repo->findBy([ + 'rollsInCamera' => 0, + ], [ + 'brand' => 'ASC', + 'productLine' => 'ASC', + 'filmFormat' => 'ASC', + ]); - return $this->render('film/index.html.twig', [ - 'in_camera' => $inCamera, - 'films' => $notInCamera, - ]); - } + return $this->render('film/index.html.twig', [ + 'in_camera' => $inCamera, + 'films' => $notInCamera, + ]); + } - /** - * Creates a new film entity. - */ - #[Route(path: '/new', name: 'film_new', methods: ['GET', 'POST'])] - public function newAction(Request $request): RedirectResponse|Response - { - return $this->itemCreate($request, 'film'); - } + /** + * Creates a new film entity. + */ + #[Route(path: '/new', name: 'film_new', methods: ['GET', 'POST'])] + public function newAction(Request $request): RedirectResponse|Response + { + return $this->itemCreate($request, 'film'); + } - /** - * Finds and displays a film entity. - */ - #[Route(path: '/{id}', name: 'film_show', methods: ['GET'])] - public function showAction(Film $film): Response - { - return $this->itemView($film, 'film'); - } + /** + * Finds and displays a film entity. + */ + #[Route(path: '/{id}', name: 'film_show', methods: ['GET'])] + public function showAction(Film $film): Response + { + return $this->itemView($film, 'film'); + } - /** - * Displays a form to edit an existing film entity. - * - * @throws LogicException - */ - #[Route(path: '/{id}/edit', name: 'film_edit', methods: ['GET', 'POST'])] - public function editAction(Request $request, Film $film): RedirectResponse|Response - { - return $this->itemUpdate($request, $film, 'film'); - } + /** + * Displays a form to edit an existing film entity. + * + * @throws LogicException + */ + #[Route(path: '/{id}/edit', name: 'film_edit', methods: ['GET', 'POST'])] + public function editAction(Request $request, Film $film): RedirectResponse|Response + { + return $this->itemUpdate($request, $film, 'film'); + } - /** - * Deletes a film entity. - * - * @throws LogicException - */ - #[Route(path: '/{id}', name: 'film_delete', methods: ['POST', 'DELETE'])] - public function deleteAction(Request $request, Film $film): RedirectResponse - { - return $this->itemDelete($request, $film); - } + /** + * Deletes a film entity. + * + * @throws LogicException + */ + #[Route(path: '/{id}', name: 'film_delete', methods: ['POST', 'DELETE'])] + public function deleteAction(Request $request, Film $film): RedirectResponse + { + return $this->itemDelete($request, $film); + } } diff --git a/src/Controller/FlashController.php b/src/Controller/FlashController.php index 7af4655..81d225b 100644 --- a/src/Controller/FlashController.php +++ b/src/Controller/FlashController.php @@ -2,10 +2,10 @@ namespace App\Controller; -use App\Entity\Flash; -use App\Form\FlashType; use App\Controller\ {DeleteFormTrait}; +use App\Entity\Flash; +use App\Form\FlashType; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response}; @@ -15,62 +15,61 @@ use Symfony\Component\Routing\Annotation\Route; * Flash controller. */ #[Route(path: 'flash')] -class FlashController extends AbstractController -{ - use FormControllerBase; - use DeleteFormTrait; +class FlashController extends AbstractController { + use FormControllerBase; + use DeleteFormTrait; - protected const ENTITY = Flash::class; - protected const TEMPLATE_PATH = 'flash/'; - protected const ROUTE_PREFIX = 'flash_'; - protected const FORM = FlashType::class; + protected const ENTITY = Flash::class; + protected const TEMPLATE_PATH = 'flash/'; + protected const ROUTE_PREFIX = 'flash_'; + protected const FORM = FlashType::class; - public function __construct(private readonly EntityManagerInterface $entityManager) - { - } + public function __construct(private readonly EntityManagerInterface $entityManager) + { + } - /** - * Lists all flash entities. - */ - #[Route(path: '/', name: 'flash_index', methods: ['GET'])] - public function indexAction(): Response - { - return $this->itemListView('flashes'); - } + /** + * Lists all flash entities. + */ + #[Route(path: '/', name: 'flash_index', methods: ['GET'])] + public function indexAction(): Response + { + return $this->itemListView('flashes'); + } - /** - * Creates a new flash entity. - */ - #[Route(path: '/new', name: 'flash_new', methods: ['GET', 'POST'])] - public function newAction(Request $request): RedirectResponse|Response - { - return $this->itemCreate($request, 'flash'); - } + /** + * Creates a new flash entity. + */ + #[Route(path: '/new', name: 'flash_new', methods: ['GET', 'POST'])] + public function newAction(Request $request): RedirectResponse|Response + { + return $this->itemCreate($request, 'flash'); + } - /** - * Finds and displays a flash entity. - */ - #[Route(path: '/{id}', name: 'flash_show', methods: ['GET'])] - public function showAction(Flash $flash): Response - { - return $this->itemView($flash, 'flash'); - } + /** + * Finds and displays a flash entity. + */ + #[Route(path: '/{id}', name: 'flash_show', methods: ['GET'])] + public function showAction(Flash $flash): Response + { + return $this->itemView($flash, 'flash'); + } - /** - * Displays a form to edit an existing flash entity. - */ - #[Route(path: '/{id}/edit', name: 'flash_edit', methods: ['GET', 'POST'])] - public function editAction(Request $request, Flash $flash): RedirectResponse|Response - { - return $this->itemUpdate($request, $flash, 'flash'); - } + /** + * Displays a form to edit an existing flash entity. + */ + #[Route(path: '/{id}/edit', name: 'flash_edit', methods: ['GET', 'POST'])] + public function editAction(Request $request, Flash $flash): RedirectResponse|Response + { + return $this->itemUpdate($request, $flash, 'flash'); + } - /** - * Deletes a flash entity. - */ - #[Route(path: '/{id}', name: 'flash_delete', methods: ['POST', 'DELETE'])] - public function deleteAction(Request $request, Flash $flash): RedirectResponse - { - return $this->itemDelete($request, $flash); - } + /** + * Deletes a flash entity. + */ + #[Route(path: '/{id}', name: 'flash_delete', methods: ['POST', 'DELETE'])] + public function deleteAction(Request $request, Flash $flash): RedirectResponse + { + return $this->itemDelete($request, $flash); + } } diff --git a/src/Controller/FormControllerBase.php b/src/Controller/FormControllerBase.php index 9981a6a..fbe9782 100644 --- a/src/Controller/FormControllerBase.php +++ b/src/Controller/FormControllerBase.php @@ -6,185 +6,191 @@ use Doctrine\ORM\EntityManagerInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response}; -trait FormControllerBase -{ +trait FormControllerBase { public function __construct(private readonly EntityManagerInterface $entityManager) { } - /** - * Create a form generator - */ - protected function buildForm(mixed $item, string $actionRoute, string $method = 'POST'): FormInterface - { - return $this->createFormBuilder() - ->setAction($this->generateUrl($actionRoute, ['id' => $item->getId()])) - ->setMethod($method) - ->getForm(); - } + /** + * Create a form generator + */ + protected function buildForm(mixed $item, string $actionRoute, string $method = 'POST'): FormInterface + { + return $this->createFormBuilder() + ->setAction($this->generateUrl($actionRoute, ['id' => $item->getId()])) + ->setMethod($method) + ->getForm(); + } - /** - * Show create form / create an item - */ - protected function itemCreate(Request $request, string $templateKey): RedirectResponse|Response - { - $template = self::TEMPLATE_PATH . 'new.html.twig'; - $redirectRoute = self::ROUTE_PREFIX . 'show'; + /** + * Show create form / create an item + */ + protected function itemCreate(Request $request, string $templateKey): RedirectResponse|Response + { + $template = self::TEMPLATE_PATH . 'new.html.twig'; + $redirectRoute = self::ROUTE_PREFIX . 'show'; - $Entity = self::ENTITY; - $item = new $Entity(); - $form = $this->createForm(self::FORM, $item); - $form->handleRequest($request); + $Entity = self::ENTITY; + $item = new $Entity(); + $form = $this->createForm(self::FORM, $item); + $form->handleRequest($request); - // If creating the item - if ($form->isSubmitted() && $form->isValid()) { - $this->entityManager->persist($item); - $this->entityManager->flush(); + // If creating the item + if ($form->isSubmitted() && $form->isValid()) + { + $this->entityManager->persist($item); + $this->entityManager->flush(); - return $this->redirectToRoute($redirectRoute, ['id' => $item->getId()]); - } + return $this->redirectToRoute($redirectRoute, ['id' => $item->getId()]); + } - // If showing the form - return $this->render($template, [ - $templateKey => $item, - 'form' => $form->createView(), - ]); - } + // If showing the form + return $this->render($template, [ + $templateKey => $item, + 'form' => $form->createView(), + ]); + } - protected function indexView(string $templateKey, array $sort = []): Response - { - return $this->itemListView($templateKey, $sort); - } + protected function indexView(string $templateKey, array $sort = []): Response + { + return $this->itemListView($templateKey, $sort); + } - /** - * List view for the data type - */ - protected function itemListView(string $templateKey, array $sort = []): Response - { - $template = self::TEMPLATE_PATH . 'index.html.twig'; + /** + * List view for the data type + */ + protected function itemListView(string $templateKey, array $sort = []): Response + { + $template = self::TEMPLATE_PATH . 'index.html.twig'; - $items = $this->entityManager->getRepository(self::ENTITY)->findBy([], $sort); + $items = $this->entityManager->getRepository(self::ENTITY)->findBy([], $sort); - return $this->render($template, [ - $templateKey => $items, - ]); - } + return $this->render($template, [ + $templateKey => $items, + ]); + } - /** - * View details for a specific item - */ - protected function itemView(mixed $item, string $templateKey): Response - { - $template = self::TEMPLATE_PATH . 'show.html.twig'; + /** + * View details for a specific item + */ + protected function itemView(mixed $item, string $templateKey): Response + { + $template = self::TEMPLATE_PATH . 'show.html.twig'; - $templateData = [ - $templateKey => $item, - ]; + $templateData = [ + $templateKey => $item, + ]; - if (method_exists($this, 'createDeleteForm')) { - $deleteForm = $this->createDeleteForm($item); - $templateData['delete_form'] = $deleteForm->createView(); - } + if (method_exists($this, 'createDeleteForm')) + { + $deleteForm = $this->createDeleteForm($item); + $templateData['delete_form'] = $deleteForm->createView(); + } - return $this->render($template, $templateData); - } + return $this->render($template, $templateData); + } - /** - * Show edit form / update an item - */ - protected function itemUpdate(Request $request, mixed $item, string $templateKey): RedirectResponse|Response - { - $template = self::TEMPLATE_PATH . 'edit.html.twig'; - $redirectRoute = self::ROUTE_PREFIX . 'show'; + /** + * Show edit form / update an item + */ + protected function itemUpdate(Request $request, mixed $item, string $templateKey): RedirectResponse|Response + { + $template = self::TEMPLATE_PATH . 'edit.html.twig'; + $redirectRoute = self::ROUTE_PREFIX . 'show'; - $editForm = $this->createForm(self::FORM, $item); - $editForm->handleRequest($request); + $editForm = $this->createForm(self::FORM, $item); + $editForm->handleRequest($request); - // If updating the item - if ($editForm->isSubmitted() && $editForm->isValid()) { - $this->entityManager->persist($item); - $this->entityManager->flush(); + // If updating the item + if ($editForm->isSubmitted() && $editForm->isValid()) + { + $this->entityManager->persist($item); + $this->entityManager->flush(); - return $this->redirectToRoute($redirectRoute, ['id' => $item->getId()]); - } + return $this->redirectToRoute($redirectRoute, ['id' => $item->getId()]); + } - // If showing the edit form - $templateData = [ - $templateKey => $item, - 'form' => $editForm->createView(), - ]; + // If showing the edit form + $templateData = [ + $templateKey => $item, + 'form' => $editForm->createView(), + ]; - if (method_exists($this, 'createDeleteForm')) { - $deleteForm = $this->createDeleteForm($item); - $templateData['delete_form'] = $deleteForm->createView(); - } + if (method_exists($this, 'createDeleteForm')) + { + $deleteForm = $this->createDeleteForm($item); + $templateData['delete_form'] = $deleteForm->createView(); + } - if (method_exists($this, 'createDeacquireForm')) { - $deacquireForm = $this->createDeacquireForm($item); - $templateData['deacquire_form'] = $deacquireForm->createView(); - } + if (method_exists($this, 'createDeacquireForm')) + { + $deacquireForm = $this->createDeacquireForm($item); + $templateData['deacquire_form'] = $deacquireForm->createView(); + } - if (method_exists($this, 'createReacquireForm')) { - $reacquireForm = $this->createReacquireForm($item); - $templateData['reacquire_form'] = $reacquireForm->createView(); - } + if (method_exists($this, 'createReacquireForm')) + { + $reacquireForm = $this->createReacquireForm($item); + $templateData['reacquire_form'] = $reacquireForm->createView(); + } - return $this->render($template, $templateData); - } + return $this->render($template, $templateData); + } - /** - * Move an item to a previously_owned table - */ - protected function itemDeacquire(Request $request, mixed $item, string $redirectRoute): RedirectResponse - { - $form = $this->createDeacquireForm($item); - $form->handleRequest($request); + /** + * Move an item to a previously_owned table + */ + protected function itemDeacquire(Request $request, mixed $item, string $redirectRoute): RedirectResponse + { + $form = $this->createDeacquireForm($item); + $form->handleRequest($request); - $repository = $this->entityManager->getRepository(self::ENTITY); - $repository->deacquire($item); + $repository = $this->entityManager->getRepository(self::ENTITY); + $repository->deacquire($item); - return $this->redirectToRoute($redirectRoute); - } + return $this->redirectToRoute($redirectRoute); + } - /** - * Move an item from a previously_owned table back to the original table - */ - protected function itemReacquire(Request $request, mixed $item, string $redirectRoute): RedirectResponse - { - $form = $this->createReacquireForm($item); - $form->handleRequest($request); + /** + * Move an item from a previously_owned table back to the original table + */ + protected function itemReacquire(Request $request, mixed $item, string $redirectRoute): RedirectResponse + { + $form = $this->createReacquireForm($item); + $form->handleRequest($request); - $repository = $this->entityManager->getRepository(self::ENTITY); - $repository->reacquire($item); + $repository = $this->entityManager->getRepository(self::ENTITY); + $repository->reacquire($item); - return $this->redirectToRoute($redirectRoute); - } + return $this->redirectToRoute($redirectRoute); + } - /** - * Actually delete an item - */ - protected function itemDelete(Request $request, mixed $item): RedirectResponse - { - $redirectRoute = self::ROUTE_PREFIX . 'index'; + /** + * Actually delete an item + */ + protected function itemDelete(Request $request, mixed $item): RedirectResponse + { + $redirectRoute = self::ROUTE_PREFIX . 'index'; - $form = $this->createDeleteForm($item); - $form->handleRequest($request); + $form = $this->createDeleteForm($item); + $form->handleRequest($request); - // if ($this->isCsrfTokenValid((string)$item->getId(), $request->request->get('_token'))) { - $this->entityManager->remove($item); - $this->entityManager->flush(); - //} + // if ($this->isCsrfTokenValid((string)$item->getId(), $request->request->get('_token'))) { + $this->entityManager->remove($item); + $this->entityManager->flush(); + //} - return $this->redirectToRoute($redirectRoute, [], Response::HTTP_SEE_OTHER); - } + return $this->redirectToRoute($redirectRoute, [], Response::HTTP_SEE_OTHER); + } - protected function deleteCSRF(Request $request, mixed $item): RedirectResponse - { - if ($this->isCsrfTokenValid('delete' . $item->getId(), $request->request->get('_token'))) { - $this->entityManager->remove($item); - $this->entityManager->flush(); - } + protected function deleteCSRF(Request $request, mixed $item): RedirectResponse + { + if ($this->isCsrfTokenValid('delete' . $item->getId(), $request->request->get('_token'))) + { + $this->entityManager->remove($item); + $this->entityManager->flush(); + } - return $this->redirectToRoute(self::ROUTE_PREFIX . 'index', [], Response::HTTP_SEE_OTHER); - } + return $this->redirectToRoute(self::ROUTE_PREFIX . 'index', [], Response::HTTP_SEE_OTHER); + } } diff --git a/src/Controller/FpuController.php b/src/Controller/FpuController.php index a8a2e2d..76e5bf6 100644 --- a/src/Controller/FpuController.php +++ b/src/Controller/FpuController.php @@ -1,4 +1,4 @@ -indexView('fpus', []); - } + } - #[Route('/new', name: 'fpu_new', methods: ['GET', 'POST'])] - public function new(Request $request): Response - { + #[Route('/new', name: 'fpu_new', methods: ['GET', 'POST'])] + public function new(Request $request): Response + { return $this->itemCreate($request, 'fpu'); - } + } - #[Route('/{id}', name: 'fpu_show', methods: ['GET'])] - public function show(Fpu $fpu): Response - { + #[Route('/{id}', name: 'fpu_show', methods: ['GET'])] + public function show(Fpu $fpu): Response + { return $this->itemView($fpu, 'fpu'); - } + } - #[Route('/{id}/edit', name: 'fpu_edit', methods: ['GET', 'POST'])] - public function edit(Request $request, Fpu $fpu): Response - { + #[Route('/{id}/edit', name: 'fpu_edit', methods: ['GET', 'POST'])] + public function edit(Request $request, Fpu $fpu): Response + { return $this->itemUpdate($request, $fpu, 'fpu'); - } + } - #[Route('/{id}', name: 'fpu_delete', methods: ['POST'])] - public function delete(Request $request, Fpu $fpu): Response - { + #[Route('/{id}', name: 'fpu_delete', methods: ['POST'])] + public function delete(Request $request, Fpu $fpu): Response + { return $this->deleteCSRF($request, $fpu); - } + } } diff --git a/src/Controller/GpuController.php b/src/Controller/GpuController.php index 66f441a..1ff6cf7 100644 --- a/src/Controller/GpuController.php +++ b/src/Controller/GpuController.php @@ -11,27 +11,26 @@ use Symfony\Component\HttpFoundation\{Request, Response}; use Symfony\Component\Routing\Annotation\Route; #[Route('/gpu')] -class GpuController extends AbstractController -{ - use FormControllerBase; +class GpuController extends AbstractController { + use FormControllerBase; - protected const ENTITY = Gpu::class; - protected const TEMPLATE_PATH = 'gpu/'; - protected const ROUTE_PREFIX = 'gpu_'; - protected const FORM = GpuType::class; + protected const ENTITY = Gpu::class; + protected const TEMPLATE_PATH = 'gpu/'; + protected const ROUTE_PREFIX = 'gpu_'; + protected const FORM = GpuType::class; - public function __construct(private readonly EntityManagerInterface $entityManager) - { - } + public function __construct(private readonly EntityManagerInterface $entityManager) + { + } - #[Route('/', name: 'gpu_index', methods: ['GET'])] - public function index(): Response - { + #[Route('/', name: 'gpu_index', methods: ['GET'])] + public function index(): Response + { $items = $this->entityManager->getRepository(self::ENTITY)->findAll(); - $acquiredItems = array_filter($items, fn (Gpu $item) => $item->isAcquired()); - $newItems = array_filter($items, fn ($item) => !$item->isAcquired()); + $acquiredItems = array_filter($items, static fn (Gpu $item) => $item->isAcquired()); + $newItems = array_filter($items, static fn ($item) => ! $item->isAcquired()); - $filter = fn (array $itemTypes) => array_filter($acquiredItems, fn (Gpu $item) => in_array($item->getCardKey(), $itemTypes)); + $filter = static fn (array $itemTypes) => array_filter($acquiredItems, static fn (Gpu $item) => in_array($item->getCardKey(), $itemTypes, TRUE)); $cardTypes = SlotKey::getGroups(); $pcieCardTypes = $cardTypes['PCI Express']; @@ -47,31 +46,31 @@ class GpuController extends AbstractController 'agp' => $filter($agpCardTypes), 'pci' => $filter($pciCardTypes), 'isa' => $filter($isaCardTypes), - ] + ], ]); - } + } - #[Route('/new', name: 'gpu_new', methods: ['GET', 'POST'])] - public function new(Request $request): Response - { - return $this->itemCreate($request, 'gpu'); - } + #[Route('/new', name: 'gpu_new', methods: ['GET', 'POST'])] + public function new(Request $request): Response + { + return $this->itemCreate($request, 'gpu'); + } - #[Route('/{id}', name: 'gpu_show', methods: ['GET'])] - public function show(Gpu $gpu): Response - { - return $this->itemView($gpu, 'gpu'); - } + #[Route('/{id}', name: 'gpu_show', methods: ['GET'])] + public function show(Gpu $gpu): Response + { + return $this->itemView($gpu, 'gpu'); + } - #[Route('/{id}/edit', name: 'gpu_edit', methods: ['GET', 'POST'])] - public function edit(Request $request, Gpu $gpu): Response - { - return $this->itemUpdate($request, $gpu, 'gpu'); - } + #[Route('/{id}/edit', name: 'gpu_edit', methods: ['GET', 'POST'])] + public function edit(Request $request, Gpu $gpu): Response + { + return $this->itemUpdate($request, $gpu, 'gpu'); + } - #[Route('/{id}', name: 'gpu_delete', methods: ['POST'])] - public function delete(Request $request, Gpu $gpu): Response - { - return $this->deleteCSRF($request, $gpu); - } + #[Route('/{id}', name: 'gpu_delete', methods: ['POST'])] + public function delete(Request $request, Gpu $gpu): Response + { + return $this->deleteCSRF($request, $gpu); + } } diff --git a/src/Controller/GpuCoreController.php b/src/Controller/GpuCoreController.php index a395dd2..a31c71d 100644 --- a/src/Controller/GpuCoreController.php +++ b/src/Controller/GpuCoreController.php @@ -10,58 +10,58 @@ use Symfony\Component\HttpFoundation\{Request, Response}; use Symfony\Component\Routing\Annotation\Route; #[Route('/gpu-core')] -class GpuCoreController extends AbstractController -{ - use FormControllerBase; +class GpuCoreController extends AbstractController { + use FormControllerBase; - protected const ENTITY = GpuCore::class; - protected const TEMPLATE_PATH = 'gpu_core/'; - protected const ROUTE_PREFIX = 'gpu-core_'; - protected const FORM = GPUCoreType::class; + protected const ENTITY = GpuCore::class; + protected const TEMPLATE_PATH = 'gpu_core/'; + protected const ROUTE_PREFIX = 'gpu-core_'; + protected const FORM = GPUCoreType::class; - public function __construct(private readonly EntityManagerInterface $entityManager) - { - } + public function __construct(private readonly EntityManagerInterface $entityManager) + { + } - #[Route('/', name: 'gpu-core_index', methods: ['GET'])] - public function index(): Response - { - return $this->indexView('gpu_cores', [ - 'brand' => 'asc', - 'processNode' => 'desc', - 'generationName' => 'asc', - 'architecture' => 'asc', - 'name' => 'asc', - 'variant' => 'asc', - ]); - } + #[Route('/', name: 'gpu-core_index', methods: ['GET'])] + public function index(): Response + { + return $this->indexView('gpu_cores', [ + 'brand' => 'asc', + 'processNode' => 'desc', + 'generationName' => 'asc', + 'architecture' => 'asc', + 'name' => 'asc', + 'variant' => 'asc', + ]); + } - #[Route('/new', name: 'gpu-core_new', methods: ['GET', 'POST'])] - public function new(Request $request): Response - { - return $this->itemCreate($request, 'gpu_core'); - } + #[Route('/new', name: 'gpu-core_new', methods: ['GET', 'POST'])] + public function new(Request $request): Response + { + return $this->itemCreate($request, 'gpu_core'); + } - #[Route('/{id}', name: 'gpu-core_show', methods: ['GET'])] - public function show(GpuCore $gPUCore): Response - { - return $this->itemView($gPUCore, 'gpu_core'); - } + #[Route('/{id}', name: 'gpu-core_show', methods: ['GET'])] + public function show(GpuCore $gPUCore): Response + { + return $this->itemView($gPUCore, 'gpu_core'); + } - #[Route('/{id}/edit', name: 'gpu-core_edit', methods: ['GET', 'POST'])] - public function edit(Request $request, GpuCore $gPUCore): Response - { - return $this->itemUpdate($request, $gPUCore, 'gpu_core'); - } + #[Route('/{id}/edit', name: 'gpu-core_edit', methods: ['GET', 'POST'])] + public function edit(Request $request, GpuCore $gPUCore): Response + { + return $this->itemUpdate($request, $gPUCore, 'gpu_core'); + } - #[Route('/{id}', name: 'gpu-core_delete', methods: ['POST'])] - public function delete(Request $request, GpuCore $gPUCore, EntityManagerInterface $entityManager): Response - { - if ($this->isCsrfTokenValid('delete' . $gPUCore->getId(), $request->request->get('_token'))) { - $entityManager->remove($gPUCore); - $entityManager->flush(); - } + #[Route('/{id}', name: 'gpu-core_delete', methods: ['POST'])] + public function delete(Request $request, GpuCore $gPUCore, EntityManagerInterface $entityManager): Response + { + if ($this->isCsrfTokenValid('delete' . $gPUCore->getId(), $request->request->get('_token'))) + { + $entityManager->remove($gPUCore); + $entityManager->flush(); + } - return $this->redirectToRoute('gpu-core_index', [], Response::HTTP_SEE_OTHER); - } + return $this->redirectToRoute('gpu-core_index', [], Response::HTTP_SEE_OTHER); + } } diff --git a/src/Controller/LensesController.php b/src/Controller/LensesController.php index f949796..9412e8a 100644 --- a/src/Controller/LensesController.php +++ b/src/Controller/LensesController.php @@ -2,10 +2,10 @@ namespace App\Controller; -use App\Entity\Lenses; -use App\Form\LensesType; use App\Controller\ {DeleteFormTrait}; +use App\Entity\Lenses; +use App\Form\LensesType; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Form\FormInterface; @@ -16,107 +16,102 @@ use Symfony\Component\Routing\Annotation\Route; * Lens controller. */ #[Route(path: 'lens')] -class LensesController extends AbstractController -{ - use FormControllerBase; - use DeleteFormTrait; +class LensesController extends AbstractController { + use FormControllerBase; + use DeleteFormTrait; - protected const ENTITY = Lenses::class; - protected const TEMPLATE_PATH = 'lenses/'; - protected const ROUTE_PREFIX = 'lens_'; - protected const FORM = LensesType::class; + protected const ENTITY = Lenses::class; + protected const TEMPLATE_PATH = 'lenses/'; + protected const ROUTE_PREFIX = 'lens_'; + protected const FORM = LensesType::class; - public function __construct(private readonly EntityManagerInterface $entityManager) - { - } + public function __construct(private readonly EntityManagerInterface $entityManager) + { + } - /** - * Lists all lens entities. - */ - #[Route(path: '/', name: 'lens_index', methods: ['GET'])] - public function indexAction(): Response - { - $receivedItems = $this->entityManager->getRepository(self::ENTITY)->findBy([ - 'received' => TRUE, - ], [ - 'brand' => 'ASC', - 'productLine' => 'ASC', - 'mount' => 'ASC', - 'minFocalLength' => 'ASC', - 'maxFStop' => 'ASC', - ]); - $newItems = $this->entityManager->getRepository(self::ENTITY)->findBy([ - 'received' => FALSE, - ], [ - 'brand' => 'ASC', - 'productLine' => 'ASC', - 'mount' => 'ASC', - 'minFocalLength' => 'ASC', - 'maxFStop' => 'ASC', - ]); + /** + * Lists all lens entities. + */ + #[Route(path: '/', name: 'lens_index', methods: ['GET'])] + public function indexAction(): Response + { + $receivedItems = $this->entityManager->getRepository(self::ENTITY)->findBy([ + 'received' => TRUE, + ], [ + 'brand' => 'ASC', + 'productLine' => 'ASC', + 'mount' => 'ASC', + 'minFocalLength' => 'ASC', + 'maxFStop' => 'ASC', + ]); + $newItems = $this->entityManager->getRepository(self::ENTITY)->findBy([ + 'received' => FALSE, + ], [ + 'brand' => 'ASC', + 'productLine' => 'ASC', + 'mount' => 'ASC', + 'minFocalLength' => 'ASC', + 'maxFStop' => 'ASC', + ]); - return $this->render('lenses/index.html.twig', [ - 'not_received' => $newItems, - 'lenses' => $receivedItems, - ]); - } + return $this->render('lenses/index.html.twig', [ + 'not_received' => $newItems, + 'lenses' => $receivedItems, + ]); + } - /** - * Creates a new lens entity. - */ - #[Route(path: '/new', name: 'lens_new', methods: ['GET', 'POST'])] - public function newAction(Request $request): RedirectResponse|Response - { - return $this->itemCreate($request, 'lense'); - } + /** + * Creates a new lens entity. + */ + #[Route(path: '/new', name: 'lens_new', methods: ['GET', 'POST'])] + public function newAction(Request $request): RedirectResponse|Response + { + return $this->itemCreate($request, 'lense'); + } - /** - * Finds and displays a lens entity. - */ - #[Route(path: '/{id}', name: 'lens_show', methods: ['GET'])] - public function showAction(Lenses $lens): Response - { - return $this->itemView($lens, 'lense'); - } + /** + * Finds and displays a lens entity. + */ + #[Route(path: '/{id}', name: 'lens_show', methods: ['GET'])] + public function showAction(Lenses $lens): Response + { + return $this->itemView($lens, 'lense'); + } - /** - * Displays a form to edit an existing lens entity. - */ - #[Route(path: '/{id}/edit', name: 'lens_edit', methods: ['GET', 'POST'])] - public function editAction(Request $request, Lenses $lens): RedirectResponse|Response - { - return $this->itemUpdate($request, $lens, 'lense'); - } + /** + * Displays a form to edit an existing lens entity. + */ + #[Route(path: '/{id}/edit', name: 'lens_edit', methods: ['GET', 'POST'])] + public function editAction(Request $request, Lenses $lens): RedirectResponse|Response + { + return $this->itemUpdate($request, $lens, 'lense'); + } - /** - * Moves a camera to the previouslyOwned table - * - * @param Request $request - * - * @return RedirectResponse - */ - #[Route(path: '/{id}/deacquire', name: 'lens_deacquire', methods: ['POST'])] - public function deacquireAction(Request $request, Lenses $lens): RedirectResponse - { - return $this->itemDeacquire($request, $lens, 'previously-owned-lens_index'); - } + /** + * Moves a camera to the previouslyOwned table + */ + #[Route(path: '/{id}/deacquire', name: 'lens_deacquire', methods: ['POST'])] + public function deacquireAction(Request $request, Lenses $lens): RedirectResponse + { + return $this->itemDeacquire($request, $lens, 'previously-owned-lens_index'); + } - /** - * Deletes a lens entity. - */ - #[Route(path: '/{id}', name: 'lens_delete', methods: ['POST', 'DELETE'])] - public function deleteAction(Request $request, Lenses $lens): RedirectResponse - { - return $this->itemDelete($request, $lens); - } + /** + * Deletes a lens entity. + */ + #[Route(path: '/{id}', name: 'lens_delete', methods: ['POST', 'DELETE'])] + public function deleteAction(Request $request, Lenses $lens): RedirectResponse + { + return $this->itemDelete($request, $lens); + } - /** - * Creates a form to move - * - * @param Lenses $lens The lens entity - */ - private function createDeacquireForm(Lenses $lens): FormInterface - { - return $this->buildForm($lens, 'lens_deacquire'); - } + /** + * Creates a form to move + * + * @param Lenses $lens The lens entity + */ + private function createDeacquireForm(Lenses $lens): FormInterface + { + return $this->buildForm($lens, 'lens_deacquire'); + } } diff --git a/src/Controller/PreviouslyOwnedCameraController.php b/src/Controller/PreviouslyOwnedCameraController.php index b678b85..4b2d71e 100644 --- a/src/Controller/PreviouslyOwnedCameraController.php +++ b/src/Controller/PreviouslyOwnedCameraController.php @@ -4,7 +4,6 @@ namespace App\Controller; use App\Entity\PreviouslyOwnedCamera; use App\Form\PreviouslyOwnedCameraType; -use App\Controller\FormControllerBase; use Doctrine\ORM\{EntityManagerInterface, ORMInvalidArgumentException}; use LogicException; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -17,77 +16,72 @@ use UnexpectedValueException; * Previouslyownedcamera controller. */ #[Route(path: 'previously-owned-camera')] -class PreviouslyOwnedCameraController extends AbstractController -{ - use FormControllerBase; +class PreviouslyOwnedCameraController extends AbstractController { + use FormControllerBase; - protected const ENTITY = PreviouslyOwnedCamera::class; - protected const TEMPLATE_PATH = 'previouslyownedcamera/'; - protected const ROUTE_PREFIX = 'previously-owned-camera_'; - protected const FORM = PreviouslyOwnedCameraType::class; + protected const ENTITY = PreviouslyOwnedCamera::class; + protected const TEMPLATE_PATH = 'previouslyownedcamera/'; + protected const ROUTE_PREFIX = 'previously-owned-camera_'; + protected const FORM = PreviouslyOwnedCameraType::class; - public function __construct(private readonly EntityManagerInterface $entityManager) - { - } + public function __construct(private readonly EntityManagerInterface $entityManager) + { + } - /** - * Lists all previouslyOwnedCamera entities. - * - * @throws UnexpectedValueException - */ - #[Route(path: '/', name: 'previously-owned-camera_index', methods: ['GET'])] - public function indexAction(): Response - { - return $this->itemListView('previouslyOwnedCameras', [ - 'brand' => 'ASC', - 'mount' => 'ASC', - 'model' => 'ASC', - ]); - } + /** + * Lists all previouslyOwnedCamera entities. + * + * @throws UnexpectedValueException + */ + #[Route(path: '/', name: 'previously-owned-camera_index', methods: ['GET'])] + public function indexAction(): Response + { + return $this->itemListView('previouslyOwnedCameras', [ + 'brand' => 'ASC', + 'mount' => 'ASC', + 'model' => 'ASC', + ]); + } - /** - * Finds and displays a previouslyOwnedCamera entity. - */ - #[Route(path: '/{id}', name: 'previously-owned-camera_show', methods: ['GET'])] - public function showAction(PreviouslyOwnedCamera $previouslyOwnedCamera): Response - { - return $this->itemView($previouslyOwnedCamera, 'previouslyOwnedCamera'); - } + /** + * Finds and displays a previouslyOwnedCamera entity. + */ + #[Route(path: '/{id}', name: 'previously-owned-camera_show', methods: ['GET'])] + public function showAction(PreviouslyOwnedCamera $previouslyOwnedCamera): Response + { + return $this->itemView($previouslyOwnedCamera, 'previouslyOwnedCamera'); + } - /** - * Displays a form to edit an existing previouslyOwnedCamera entity. - * - * @throws LogicException - */ - #[Route(path: '/{id}/edit', name: 'previously-owned-camera_edit', methods: ['GET', 'POST'])] - public function editAction(Request $request, PreviouslyOwnedCamera $previouslyOwnedCamera): RedirectResponse|Response - { - return $this->itemUpdate($request, $previouslyOwnedCamera, 'previouslyOwnedCamera'); - } + /** + * Displays a form to edit an existing previouslyOwnedCamera entity. + * + * @throws LogicException + */ + #[Route(path: '/{id}/edit', name: 'previously-owned-camera_edit', methods: ['GET', 'POST'])] + public function editAction(Request $request, PreviouslyOwnedCamera $previouslyOwnedCamera): RedirectResponse|Response + { + return $this->itemUpdate($request, $previouslyOwnedCamera, 'previouslyOwnedCamera'); + } - /** - * Moves a camera to the previouslyOwned table - * - * @param Request $request - * - * @throws LogicException - * @throws ORMInvalidArgumentException - * - * @return RedirectResponse - */ - #[Route(path: '/{id}/reacquire', name: 'previously-owned-camera_reacquire', methods: ['POST'])] - public function reacquireAction(Request $request, PreviouslyOwnedCamera $camera): RedirectResponse - { - return $this->itemReacquire($request, $camera, 'camera_index'); - } + /** + * Moves a camera to the previouslyOwned table + * + * @throws LogicException + * @throws ORMInvalidArgumentException + */ + #[Route(path: '/{id}/reacquire', name: 'previously-owned-camera_reacquire', methods: ['POST'])] + public function reacquireAction(Request $request, PreviouslyOwnedCamera $camera): RedirectResponse + { + return $this->itemReacquire($request, $camera, 'camera_index'); + } - /** - * Creates a form to move - * - * @param PreviouslyOwnedCamera $camera The camera entity - */ - private function createReacquireForm(PreviouslyOwnedCamera $camera): FormInterface - { - return $this->buildForm($camera, 'previously-owned-camera_reacquire', 'POST'); - } + /** + * Creates a form to move + * + * @param PreviouslyOwnedCamera $camera The camera entity + */ + private function createReacquireForm(PreviouslyOwnedCamera $camera): FormInterface + { + return $this->buildForm($camera, 'previously-owned-camera_reacquire', 'POST'); + } } diff --git a/src/Controller/PreviouslyOwnedFlashController.php b/src/Controller/PreviouslyOwnedFlashController.php index ab5e2b8..322f30f 100644 --- a/src/Controller/PreviouslyOwnedFlashController.php +++ b/src/Controller/PreviouslyOwnedFlashController.php @@ -4,7 +4,6 @@ namespace App\Controller; use App\Entity\PreviouslyOwnedFlash; use App\Form\PreviouslyOwnedFlashType; -use App\Controller\FormControllerBase; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response}; @@ -14,52 +13,51 @@ use Symfony\Component\Routing\Annotation\Route; * Previouslyownedflash controller. */ #[Route(path: 'previously-owned-flash')] -class PreviouslyOwnedFlashController extends AbstractController -{ - use FormControllerBase; +class PreviouslyOwnedFlashController extends AbstractController { + use FormControllerBase; - protected const ENTITY = PreviouslyOwnedFlash::class; - protected const ROUTE_PREFIX = 'previously-owned-flash_'; - protected const TEMPLATE_PATH = 'previouslyownedflash/'; - protected const FORM = PreviouslyOwnedFlashType::class; + protected const ENTITY = PreviouslyOwnedFlash::class; + protected const ROUTE_PREFIX = 'previously-owned-flash_'; + protected const TEMPLATE_PATH = 'previouslyownedflash/'; + protected const FORM = PreviouslyOwnedFlashType::class; - public function __construct(private readonly EntityManagerInterface $entityManager) - { - } + public function __construct(private readonly EntityManagerInterface $entityManager) + { + } - /** - * Lists all previouslyOwnedFlash entities. - */ - #[Route(path: '/', name: 'previously-owned-flash_index', methods: ['GET'])] - public function indexAction(): Response - { - return $this->itemListView('previouslyOwnedFlashes'); - } + /** + * Lists all previouslyOwnedFlash entities. + */ + #[Route(path: '/', name: 'previously-owned-flash_index', methods: ['GET'])] + public function indexAction(): Response + { + return $this->itemListView('previouslyOwnedFlashes'); + } - /** - * Creates a new previouslyOwnedFlash entity. - */ - #[Route(path: '/new', name: 'previously-owned-flash_new', methods: ['GET', 'POST'])] - public function newAction(Request $request): RedirectResponse|Response - { - return $this->itemCreate($request, 'previouslyOwnedFlash'); - } + /** + * Creates a new previouslyOwnedFlash entity. + */ + #[Route(path: '/new', name: 'previously-owned-flash_new', methods: ['GET', 'POST'])] + public function newAction(Request $request): RedirectResponse|Response + { + return $this->itemCreate($request, 'previouslyOwnedFlash'); + } - /** - * Finds and displays a previouslyOwnedFlash entity. - */ - #[Route(path: '/{id}', name: 'previously-owned-flash_show', methods: ['GET'])] - public function showAction(PreviouslyOwnedFlash $previouslyOwnedFlash): Response - { - return $this->itemView($previouslyOwnedFlash, 'previouslyOwnedFlash'); - } + /** + * Finds and displays a previouslyOwnedFlash entity. + */ + #[Route(path: '/{id}', name: 'previously-owned-flash_show', methods: ['GET'])] + public function showAction(PreviouslyOwnedFlash $previouslyOwnedFlash): Response + { + return $this->itemView($previouslyOwnedFlash, 'previouslyOwnedFlash'); + } - /** - * Displays a form to edit an existing previouslyOwnedFlash entity. - */ - #[Route(path: '/{id}/edit', name: 'previously-owned-flash_edit', methods: ['GET', 'POST'])] - public function editAction(Request $request, PreviouslyOwnedFlash $previouslyOwnedFlash): RedirectResponse|Response - { - return $this->itemUpdate($request, $previouslyOwnedFlash, 'previouslyOwnedFlash'); - } + /** + * Displays a form to edit an existing previouslyOwnedFlash entity. + */ + #[Route(path: '/{id}/edit', name: 'previously-owned-flash_edit', methods: ['GET', 'POST'])] + public function editAction(Request $request, PreviouslyOwnedFlash $previouslyOwnedFlash): RedirectResponse|Response + { + return $this->itemUpdate($request, $previouslyOwnedFlash, 'previouslyOwnedFlash'); + } } diff --git a/src/Controller/PreviouslyOwnedLensesController.php b/src/Controller/PreviouslyOwnedLensesController.php index 1ad2140..36aebf1 100644 --- a/src/Controller/PreviouslyOwnedLensesController.php +++ b/src/Controller/PreviouslyOwnedLensesController.php @@ -4,56 +4,54 @@ namespace App\Controller; use App\Entity\PreviouslyOwnedLenses; use App\Form\PreviouslyOwnedLensesType; -use App\Controller\FormControllerBase; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\{RedirectResponse, Request, Response}; use Symfony\Component\Routing\Annotation\Route; #[Route(path: 'previously-owned-lens')] -class PreviouslyOwnedLensesController extends AbstractController -{ - use FormControllerBase; +class PreviouslyOwnedLensesController extends AbstractController { + use FormControllerBase; - protected const ENTITY = PreviouslyOwnedLenses::class; - protected const TEMPLATE_PATH = 'previouslyownedlenses/'; - protected const ROUTE_PREFIX = 'previously-owned-lens_'; - protected const FORM = PreviouslyOwnedLensesType::class; + protected const ENTITY = PreviouslyOwnedLenses::class; + protected const TEMPLATE_PATH = 'previouslyownedlenses/'; + protected const ROUTE_PREFIX = 'previously-owned-lens_'; + protected const FORM = PreviouslyOwnedLensesType::class; - public function __construct(private readonly EntityManagerInterface $entityManager) - { - } + public function __construct(private readonly EntityManagerInterface $entityManager) + { + } - /** - * Lists all previouslyOwnedLense entities. - */ - #[Route(path: '/', name: 'previously-owned-lens_index', methods: ['GET'])] - public function indexAction(): Response - { - return $this->itemListView('previouslyOwnedLenses', [ - 'brand' => 'ASC', - 'productLine' => 'ASC', - 'mount' => 'ASC', - 'minFocalLength' => 'ASC', - 'maxFStop' => 'ASC', - ]); - } + /** + * Lists all previouslyOwnedLense entities. + */ + #[Route(path: '/', name: 'previously-owned-lens_index', methods: ['GET'])] + public function indexAction(): Response + { + return $this->itemListView('previouslyOwnedLenses', [ + 'brand' => 'ASC', + 'productLine' => 'ASC', + 'mount' => 'ASC', + 'minFocalLength' => 'ASC', + 'maxFStop' => 'ASC', + ]); + } - /** - * Finds and displays a previouslyOwnedLense entity. - */ - #[Route(path: '/{id}', name: 'previously-owned-lens_show', methods: ['GET'])] - public function showAction(PreviouslyOwnedLenses $previouslyOwnedLens): Response - { - return $this->itemView($previouslyOwnedLens, 'previouslyOwnedLense'); - } + /** + * Finds and displays a previouslyOwnedLense entity. + */ + #[Route(path: '/{id}', name: 'previously-owned-lens_show', methods: ['GET'])] + public function showAction(PreviouslyOwnedLenses $previouslyOwnedLens): Response + { + return $this->itemView($previouslyOwnedLens, 'previouslyOwnedLense'); + } - /** - * Displays a form to edit an existing previouslyOwnedLense entity. - */ - #[Route(path: '/{id}/edit', name: 'previously-owned-lens_edit', methods: ['GET', 'POST'])] - public function editAction(Request $request, PreviouslyOwnedLenses $previouslyOwnedLens): RedirectResponse|Response - { - return $this->itemUpdate($request, $previouslyOwnedLens, 'previouslyOwnedLense'); - } + /** + * Displays a form to edit an existing previouslyOwnedLense entity. + */ + #[Route(path: '/{id}/edit', name: 'previously-owned-lens_edit', methods: ['GET', 'POST'])] + public function editAction(Request $request, PreviouslyOwnedLenses $previouslyOwnedLens): RedirectResponse|Response + { + return $this->itemUpdate($request, $previouslyOwnedLens, 'previouslyOwnedLense'); + } } diff --git a/src/Controller/SocketController.php b/src/Controller/SocketController.php index 408a25c..ac36e0b 100644 --- a/src/Controller/SocketController.php +++ b/src/Controller/SocketController.php @@ -1,17 +1,15 @@ -itemListView('sockets'); - } + } - #[Route('/new', name: 'socket_new', methods: ['GET', 'POST'])] - public function new(Request $request): Response - { + #[Route('/new', name: 'socket_new', methods: ['GET', 'POST'])] + public function new(Request $request): Response + { return $this->itemCreate($request, 'sockets'); - } + } - #[Route('/{id}', name: 'socket_show', methods: ['GET'])] - public function show(Socket $socket): Response - { + #[Route('/{id}', name: 'socket_show', methods: ['GET'])] + public function show(Socket $socket): Response + { return $this->itemView($socket, 'socket'); - } + } - #[Route('/{id}/edit', name: 'socket_edit', methods: ['GET', 'POST'])] - public function edit(Request $request, Socket $socket): Response - { + #[Route('/{id}/edit', name: 'socket_edit', methods: ['GET', 'POST'])] + public function edit(Request $request, Socket $socket): Response + { return $this->itemUpdate($request, $socket, 'socket'); - } + } - #[Route('/{id}', name: 'socket_delete', methods: ['POST'])] - public function delete(Request $request, Socket $socket): Response - { + #[Route('/{id}', name: 'socket_delete', methods: ['POST'])] + public function delete(Request $request, Socket $socket): Response + { return $this->deleteCSRF($request, $socket); - } + } } diff --git a/src/Entity/Brand.php b/src/Entity/Brand.php index 81db87c..642d7f0 100644 --- a/src/Entity/Brand.php +++ b/src/Entity/Brand.php @@ -2,13 +2,12 @@ namespace App\Entity; -use Doctrine\Common\Collections\ArrayCollection; -use Doctrine\Common\Collections\Collection; +use Doctrine\Common\Collections\{ArrayCollection, Collection}; use Doctrine\ORM\Mapping as ORM; #[ORM\Table(name: 'brand', schema: 'collection')] #[ORM\Entity] -#[ORM\UniqueConstraint(name: 'brand_unq', columns: ["name"])] +#[ORM\UniqueConstraint(name: 'brand_unq', columns: ['name'])] class Brand { use GetSet; diff --git a/src/Entity/Camera.php b/src/Entity/Camera.php index 77afcf4..2fa3f1d 100644 --- a/src/Entity/Camera.php +++ b/src/Entity/Camera.php @@ -10,19 +10,18 @@ use Doctrine\ORM\Mapping as ORM; */ #[ORM\Table(name: 'camera', schema: 'collection')] #[ORM\Entity(repositoryClass: CameraRepository::class)] -class Camera -{ +class Camera { use GetSet; - use CameraBase; + use CameraBase; - #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)] - #[ORM\Id] - #[ORM\GeneratedValue(strategy: 'IDENTITY')] - #[ORM\SequenceGenerator(sequenceName: 'camera__id_seq', allocationSize: 1, initialValue: 1)] - private int $id; + #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] + #[ORM\SequenceGenerator(sequenceName: 'camera__id_seq', allocationSize: 1, initialValue: 1)] + private int $id; - public function getId(): ?int - { - return $this->id; - } + public function getId(): ?int + { + return $this->id; + } } diff --git a/src/Entity/CameraBase.php b/src/Entity/CameraBase.php index e3b299d..00af318 100644 --- a/src/Entity/CameraBase.php +++ b/src/Entity/CameraBase.php @@ -9,47 +9,46 @@ use Doctrine\ORM\Mapping as ORM; * * Shared columns for camera, and previously_owned_camera tables */ -trait CameraBase -{ - use PurchasePrice; +trait CameraBase { + use PurchasePrice; - #[ORM\ManyToOne(targetEntity: 'CameraType')] - #[ORM\JoinColumn(name: 'type_id', referencedColumnName: 'id', nullable: FALSE)] - private CameraType $type; + #[ORM\ManyToOne(targetEntity: 'CameraType')] + #[ORM\JoinColumn(name: 'type_id', referencedColumnName: 'id', nullable: FALSE)] + private CameraType $type; - #[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: FALSE)] - private string $brand; + #[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: FALSE)] + private string $brand; - #[ORM\Column(name: 'mount', type: 'string', length: 32, nullable: FALSE)] - private string $mount; + #[ORM\Column(name: 'mount', type: 'string', length: 32, nullable: FALSE)] + private string $mount; - #[ORM\Column(name: 'model', type: 'string', length: 255, nullable: FALSE)] - private string $model; + #[ORM\Column(name: 'model', type: 'string', length: 255, nullable: FALSE)] + private string $model; - #[ORM\Column(name: 'is_digital', type: 'boolean', nullable: FALSE)] - private bool $isDigital; + #[ORM\Column(name: 'is_digital', type: 'boolean', nullable: FALSE)] + private bool $isDigital; - #[ORM\Column(name: 'crop_factor', type: 'decimal', precision: 10, scale: 0, nullable: FALSE)] - private string $cropFactor = '1.0'; + #[ORM\Column(name: 'crop_factor', type: 'decimal', precision: 10, scale: 0, nullable: FALSE)] + private string $cropFactor = '1.0'; - #[ORM\Column(name: 'is_working', type: 'boolean', nullable: FALSE)] - private bool $isWorking; + #[ORM\Column(name: 'is_working', type: 'boolean', nullable: FALSE)] + private bool $isWorking; - #[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)] - private ?string $notes = null; + #[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)] + private ?string $notes = NULL; - #[ORM\Column(name: 'serial', type: 'string', length: 20, nullable: FALSE)] - private string $serial; + #[ORM\Column(name: 'serial', type: 'string', length: 20, nullable: FALSE)] + private string $serial; - #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE)] - private bool $formerlyOwned = FALSE; + #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE)] + private bool $formerlyOwned = FALSE; - #[ORM\Column(name: 'battery_type', type: 'string', nullable: TRUE)] - private ?string $batteryType; + #[ORM\Column(name: 'battery_type', type: 'string', nullable: TRUE)] + private ?string $batteryType; - #[ORM\Column(name: 'film_format', type: 'string', nullable: TRUE)] - private ?string $filmFormat = '135'; + #[ORM\Column(name: 'film_format', type: 'string', nullable: TRUE)] + private ?string $filmFormat = '135'; - #[ORM\Column(name: 'received', type: 'boolean', nullable: TRUE)] - private ?bool $received = FALSE; + #[ORM\Column(name: 'received', type: 'boolean', nullable: TRUE)] + private ?bool $received = FALSE; } diff --git a/src/Entity/CameraType.php b/src/Entity/CameraType.php index 81703a4..5245f96 100644 --- a/src/Entity/CameraType.php +++ b/src/Entity/CameraType.php @@ -10,29 +10,28 @@ use Stringable; */ #[ORM\Table(name: 'camera_type', schema: 'collection')] #[ORM\Entity] -class CameraType implements Stringable -{ +class CameraType implements Stringable { use GetSet; - #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)] - #[ORM\Id] - #[ORM\GeneratedValue(strategy: 'IDENTITY')] - #[ORM\SequenceGenerator(sequenceName: 'camera.camera_type_id_seq', allocationSize: 1, initialValue: 1)] - private int $id; + #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] + #[ORM\SequenceGenerator(sequenceName: 'camera.camera_type_id_seq', allocationSize: 1, initialValue: 1)] + private int $id; - #[ORM\Column(name: 'type', type: 'string', length: 255, nullable: FALSE)] - private string $type; + #[ORM\Column(name: 'type', type: 'string', length: 255, nullable: FALSE)] + private string $type; - #[ORM\Column(name: 'description', type: 'text', nullable: TRUE)] - private ?string $description = NULL; + #[ORM\Column(name: 'description', type: 'text', nullable: TRUE)] + private ?string $description = NULL; // ------------------------------------------------------------------------ - /** - * Value for serialization - */ - public function __toString(): string - { - return $this->type; - } + /** + * Value for serialization + */ + public function __toString(): string + { + return $this->type; + } } diff --git a/src/Entity/Chipset.php b/src/Entity/Chipset.php index dfc4c6b..0577f0f 100644 --- a/src/Entity/Chipset.php +++ b/src/Entity/Chipset.php @@ -2,8 +2,8 @@ namespace App\Entity; +use Doctrine\Common\Collections\{ArrayCollection, Collection}; use Doctrine\ORM\Mapping as ORM; -use Doctrine\Common\Collections\{Collection, ArrayCollection}; #[ORM\Table(name: 'chipset', schema: 'collection')] #[ORM\Entity] diff --git a/src/Entity/Cpu.php b/src/Entity/Cpu.php index 976552b..da09950 100644 --- a/src/Entity/Cpu.php +++ b/src/Entity/Cpu.php @@ -3,7 +3,7 @@ namespace App\Entity; use App\Enum\CpuArchitecture; -use Doctrine\Common\Collections\{Collection, ArrayCollection}; +use Doctrine\Common\Collections\{ArrayCollection, Collection}; use Doctrine\ORM\Mapping as ORM; #[ORM\Table('cpu', schema: 'collection')] @@ -43,9 +43,9 @@ class Cpu { #[ORM\Column('part_number', type: 'string')] private string $partNumber; - #[ORM\Column('lot_number', type: 'string', nullable: TRUE, options: array( - 'comment' => 'The CPU lot number, such as s-spec for Intel CPUs' - ))] + #[ORM\Column('lot_number', type: 'string', nullable: TRUE, options: [ + 'comment' => 'The CPU lot number, such as s-spec for Intel CPUs', + ])] private ?string $lotNumber; #[ORM\Column('micro_architecture', type: 'string', nullable: TRUE)] @@ -54,14 +54,14 @@ class Cpu { #[ORM\Column('codename', type: 'string', nullable: TRUE)] private ?string $codeName = ''; - #[ORM\Column('base_speed', type: 'integer', options: array( - 'comment' => 'The stock speed of the cpu in MHz' - ))] + #[ORM\Column('base_speed', type: 'integer', options: [ + 'comment' => 'The stock speed of the cpu in MHz', + ])] private int $baseSpeed; - #[ORM\Column('boost_speed', type: 'integer', nullable: true, options: array( - 'comment' => 'The max boost speed of the cpu in MHz, if applicable' - ))] + #[ORM\Column('boost_speed', type: 'integer', nullable: TRUE, options: [ + 'comment' => 'The max boost speed of the cpu in MHz, if applicable', + ])] private ?int $boostSpeed; #[ORM\Column('cores', type: 'integer')] @@ -70,15 +70,15 @@ class Cpu { #[ORM\Column('threads', type: 'integer')] private int $threads = 1; - #[ORM\Column('igp', type: 'string', nullable: true, options: array( - 'comment' => 'The name of the integrated graphics processor' - ))] + #[ORM\Column('igp', type: 'string', nullable: TRUE, options: [ + 'comment' => 'The name of the integrated graphics processor', + ])] private ?string $igp; - #[ORM\Column('voltage', type: 'float', nullable: true)] + #[ORM\Column('voltage', type: 'float', nullable: TRUE)] private ?float $voltage; - #[ORM\Column('tdp', type: 'integer', nullable: true)] + #[ORM\Column('tdp', type: 'integer', nullable: TRUE)] private ?int $tdp; #[ORM\Column('process_node', type: 'integer', nullable: TRUE)] @@ -87,89 +87,89 @@ class Cpu { #[ORM\Column('count', type: 'integer')] private int $count = 1; - #[ORM\Column('usable', type: 'boolean', options: array( - 'comment' => 'Whether the chip is working, and can be used with other hardware I have' - ))] - private bool $usable = true; + #[ORM\Column('usable', type: 'boolean', options: [ + 'comment' => 'Whether the chip is working, and can be used with other hardware I have', + ])] + private bool $usable = TRUE; - #[ORM\Column('received', type: 'boolean', options: array( - 'comment' => "Whether I have the chip in my possession (instead of in shipping)" - ))] - private bool $received = true; + #[ORM\Column('received', type: 'boolean', options: [ + 'comment' => 'Whether I have the chip in my possession (instead of in shipping)', + ])] + private bool $received = TRUE; #[ORM\Column('link', type: 'string')] private string $link; - #[ORM\Column('notes', type: 'text', nullable: true)] + #[ORM\Column('notes', type: 'text', nullable: TRUE)] private ?string $notes = ''; // ------------------------------------------------------------------------ // CPU Cache // ------------------------------------------------------------------------ - #[ORM\Column('l1_data_count', type:'integer', nullable: true, options: array( - 'comment' => 'The number of L1 data caches on the package, usually the same as the number of cores' - ))] - private ?int $L1dCount = null; + #[ORM\Column('l1_data_count', type: 'integer', nullable: TRUE, options: [ + 'comment' => 'The number of L1 data caches on the package, usually the same as the number of cores', + ])] + private ?int $L1dCount = NULL; - #[ORM\Column('l1_data_size', type: 'integer', nullable: true, options: array( - 'comment' => 'The size of each Level 1 data cache in KB' - ))] - private ?int $L1dSize = null; + #[ORM\Column('l1_data_size', type: 'integer', nullable: TRUE, options: [ + 'comment' => 'The size of each Level 1 data cache in KB', + ])] + private ?int $L1dSize = NULL; - #[ORM\Column('l1_data_way', type: 'integer', nullable: true)] - private ?int $L1dWay = null; + #[ORM\Column('l1_data_way', type: 'integer', nullable: TRUE)] + private ?int $L1dWay = NULL; - #[ORM\Column('l1_code_count', type:'integer', nullable: true, options: array( - 'comment' => 'The number of L1 instruction caches on the package, usually the same as the number of cores' - ))] - private ?int $L1cCount = null; + #[ORM\Column('l1_code_count', type: 'integer', nullable: TRUE, options: [ + 'comment' => 'The number of L1 instruction caches on the package, usually the same as the number of cores', + ])] + private ?int $L1cCount = NULL; - #[ORM\Column('l1_code_size', type: 'integer', nullable: true, options: array( - 'comment' => 'The size of each Level 1 instruction cache in KB' - ))] - private ?int $L1cSize = null; + #[ORM\Column('l1_code_size', type: 'integer', nullable: TRUE, options: [ + 'comment' => 'The size of each Level 1 instruction cache in KB', + ])] + private ?int $L1cSize = NULL; - #[ORM\Column('l1_code_way', type: 'integer', nullable: true)] - private ?int $L1cWay = null; + #[ORM\Column('l1_code_way', type: 'integer', nullable: TRUE)] + private ?int $L1cWay = NULL; - #[ORM\Column('l1_unified_count', type:'integer', nullable: true, options: array( - 'comment' => 'The number of L1 caches on the package, usually the same as the number of cores' - ))] - private ?int $L1uCount = null; + #[ORM\Column('l1_unified_count', type: 'integer', nullable: TRUE, options: [ + 'comment' => 'The number of L1 caches on the package, usually the same as the number of cores', + ])] + private ?int $L1uCount = NULL; - #[ORM\Column('l1_unified_size', type: 'integer', nullable: true, options: array( - 'comment' => 'The size of each Level 1 unified cache in KB' - ))] - private ?int $L1uSize = null; + #[ORM\Column('l1_unified_size', type: 'integer', nullable: TRUE, options: [ + 'comment' => 'The size of each Level 1 unified cache in KB', + ])] + private ?int $L1uSize = NULL; - #[ORM\Column('l1_unified_way', type: 'integer', nullable: true)] - private ?int $L1uWay = null; + #[ORM\Column('l1_unified_way', type: 'integer', nullable: TRUE)] + private ?int $L1uWay = NULL; - #[ORM\Column('l2_count', type: 'integer', options: array( - 'comment' => 'The number of L2 caches on the package, usually the same as the number of cores' - ))] + #[ORM\Column('l2_count', type: 'integer', options: [ + 'comment' => 'The number of L2 caches on the package, usually the same as the number of cores', + ])] private int $L2Count = 1; - #[ORM\Column('l2_size', type: 'integer', nullable: true, options: array( - 'comment' => 'The size of each Level 2 cache in KB' - ))] + #[ORM\Column('l2_size', type: 'integer', nullable: TRUE, options: [ + 'comment' => 'The size of each Level 2 cache in KB', + ])] private ?int $L2Size; - #[ORM\Column('l2_way', type: 'integer', nullable: true)] + #[ORM\Column('l2_way', type: 'integer', nullable: TRUE)] private ?int $L2Way; - #[ORM\Column('l3_count', type: 'integer', options: array( - 'comment' => 'The number of L3 caches on the package' - ))] + #[ORM\Column('l3_count', type: 'integer', options: [ + 'comment' => 'The number of L3 caches on the package', + ])] private int $L3Count = 0; - #[ORM\Column('l3_size', type: 'integer', nullable: true, options: array( - 'comment' => 'The size of each Level 3 cache in KB' - ))] + #[ORM\Column('l3_size', type: 'integer', nullable: TRUE, options: [ + 'comment' => 'The size of each Level 3 cache in KB', + ])] private ?int $L3Size; - #[ORM\Column('l3_way', type: 'integer', nullable: true)] + #[ORM\Column('l3_way', type: 'integer', nullable: TRUE)] private ?int $L3Way; // ------------------------------------------------------------------------ diff --git a/src/Entity/Film.php b/src/Entity/Film.php index 67b7d19..f7e3ba3 100644 --- a/src/Entity/Film.php +++ b/src/Entity/Film.php @@ -2,7 +2,6 @@ namespace App\Entity; -use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; /** @@ -10,51 +9,50 @@ use Doctrine\ORM\Mapping as ORM; */ #[ORM\Table(name: 'film', schema: 'collection')] #[ORM\Entity] -class Film -{ +class Film { use GetSet; - #[ORM\Id] - #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)] - #[ORM\GeneratedValue(strategy: 'IDENTITY')] - private int $id; + #[ORM\Id] + #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] + private int $id; - #[ORM\Column(name: 'brand', type: 'string', nullable: FALSE)] - private string $brand; + #[ORM\Column(name: 'brand', type: 'string', nullable: FALSE)] + private string $brand; - #[ORM\Column(name: 'product_line', type: 'string', nullable: TRUE)] - private ?string $productLine = NULL; + #[ORM\Column(name: 'product_line', type: 'string', nullable: TRUE)] + private ?string $productLine = NULL; - #[ORM\Column(name: 'film_name', type: 'string', nullable: FALSE)] - private string $filmName; + #[ORM\Column(name: 'film_name', type: 'string', nullable: FALSE)] + private string $filmName; - #[ORM\Column(name: 'film_alias', type: 'string', nullable: TRUE)] - private ?string $filmAlias = NULL; + #[ORM\Column(name: 'film_alias', type: 'string', nullable: TRUE)] + private ?string $filmAlias = NULL; - #[ORM\Column(name: 'film_speed_asa', type: 'integer', nullable: FALSE)] - private int $filmSpeedAsa; + #[ORM\Column(name: 'film_speed_asa', type: 'integer', nullable: FALSE)] + private int $filmSpeedAsa; - #[ORM\Column(name: 'film_speed_din', type: 'integer', nullable: FALSE)] - private int $filmSpeedDin; + #[ORM\Column(name: 'film_speed_din', type: 'integer', nullable: FALSE)] + private int $filmSpeedDin; - #[ORM\Column(name: 'film_format', type: 'string', nullable: FALSE)] - private string $filmFormat; + #[ORM\Column(name: 'film_format', type: 'string', nullable: FALSE)] + private string $filmFormat; - #[ORM\Column(name: 'film_base', type: 'string', nullable: FALSE, options: ['default' => 'Cellulose Triacetate'])] - private string $filmBase = 'Cellulose Triacetate'; + #[ORM\Column(name: 'film_base', type: 'string', nullable: FALSE, options: ['default' => 'Cellulose Triacetate'])] + private string $filmBase = 'Cellulose Triacetate'; - #[ORM\Column(name: 'unused_rolls', type: 'integer', nullable: FALSE, options: ['default' => 0])] - private int $unusedRolls = 0; + #[ORM\Column(name: 'unused_rolls', type: 'integer', nullable: FALSE, options: ['default' => 0])] + private int $unusedRolls = 0; - #[ORM\Column(name: 'rolls_in_camera', type: 'integer', nullable: FALSE, options: ['default' => 0])] - private int $rollsInCamera = 0; + #[ORM\Column(name: 'rolls_in_camera', type: 'integer', nullable: FALSE, options: ['default' => 0])] + private int $rollsInCamera = 0; - #[ORM\Column(name: 'developed_rolls', type: 'integer', nullable: FALSE, options: ['default' => 0])] - private int $developedRolls = 0; + #[ORM\Column(name: 'developed_rolls', type: 'integer', nullable: FALSE, options: ['default' => 0])] + private int $developedRolls = 0; - #[ORM\Column(name: 'chemistry', type: 'string', nullable: FALSE, options: ['default' => 'C-41'])] - private string $chemistry = 'C-41'; + #[ORM\Column(name: 'chemistry', type: 'string', nullable: FALSE, options: ['default' => 'C-41'])] + private string $chemistry = 'C-41'; - #[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)] - private ?string $notes = NULL; + #[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)] + private ?string $notes = NULL; } diff --git a/src/Entity/FilmFormat.php b/src/Entity/FilmFormat.php index e9ddf2b..8962f89 100644 --- a/src/Entity/FilmFormat.php +++ b/src/Entity/FilmFormat.php @@ -6,18 +6,17 @@ use Doctrine\ORM\Mapping as ORM; #[ORM\Table(name: 'film_format', schema: 'collection')] #[ORM\Entity] -class FilmFormat -{ +class FilmFormat { use GetSet; - #[ORM\Id] - #[ORM\GeneratedValue] - #[ORM\Column(type: 'integer')] - private int $id; + #[ORM\Id] + #[ORM\GeneratedValue] + #[ORM\Column(type: 'integer')] + private int $id; - #[ORM\Column(name: 'number_id', type: 'integer')] - private int $numberId; + #[ORM\Column(name: 'number_id', type: 'integer')] + private int $numberId; - #[ORM\Column(name: 'name', type: 'string')] - private string $name; + #[ORM\Column(name: 'name', type: 'string')] + private string $name; } diff --git a/src/Entity/Flash.php b/src/Entity/Flash.php index 1fa4c58..a54cd85 100644 --- a/src/Entity/Flash.php +++ b/src/Entity/Flash.php @@ -9,20 +9,19 @@ use Doctrine\ORM\Mapping as ORM; */ #[ORM\Table(name: 'flash', schema: 'collection')] #[ORM\Entity] -class Flash -{ +class Flash { use GetSet; - use FlashBase; + use FlashBase; - #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)] - #[ORM\Id] - #[ORM\GeneratedValue(strategy: 'IDENTITY')] - #[ORM\SequenceGenerator(sequenceName: 'camera.flash_id_seq', allocationSize: 1, initialValue: 1)] - private int $id; + #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] + #[ORM\SequenceGenerator(sequenceName: 'camera.flash_id_seq', allocationSize: 1, initialValue: 1)] + private int $id; - #[ORM\Column(name: 'received', type: 'boolean', nullable: FALSE, options: ['default' => FALSE])] - private bool $received = FALSE; + #[ORM\Column(name: 'received', type: 'boolean', nullable: FALSE, options: ['default' => FALSE])] + private bool $received = FALSE; - #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE, options: ['default' => FALSE])] - private bool $formerlyOwned = FALSE; + #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE, options: ['default' => FALSE])] + private bool $formerlyOwned = FALSE; } diff --git a/src/Entity/FlashBase.php b/src/Entity/FlashBase.php index 6bcf449..267c43a 100644 --- a/src/Entity/FlashBase.php +++ b/src/Entity/FlashBase.php @@ -4,40 +4,39 @@ namespace App\Entity; use Doctrine\ORM\Mapping as ORM; -trait FlashBase -{ - use PurchasePrice; +trait FlashBase { + use PurchasePrice; - #[ORM\Column(name: 'brand', type: 'string', nullable: FALSE)] - private readonly string $brand; + #[ORM\Column(name: 'brand', type: 'string', nullable: FALSE)] + private readonly string $brand; - #[ORM\Column(name: 'model', type: 'string', nullable: FALSE)] - private readonly string $model; + #[ORM\Column(name: 'model', type: 'string', nullable: FALSE)] + private readonly string $model; - #[ORM\Column(name: 'is_auto_flash', type: 'boolean', nullable: FALSE)] - private bool $isAutoFlash = FALSE; + #[ORM\Column(name: 'is_auto_flash', type: 'boolean', nullable: FALSE)] + private bool $isAutoFlash = FALSE; - #[ORM\Column(name: 'is_ttl', type: 'boolean', nullable: FALSE)] - private bool $isTtl = FALSE; + #[ORM\Column(name: 'is_ttl', type: 'boolean', nullable: FALSE)] + private bool $isTtl = FALSE; - #[ORM\Column(name: 'ttl_type', type: 'string', nullable: FALSE)] - private string $ttlType = 'N / A'; + #[ORM\Column(name: 'ttl_type', type: 'string', nullable: FALSE)] + private string $ttlType = 'N / A'; - #[ORM\Column(name: 'is_p_ttl', type: 'boolean', nullable: FALSE)] - private bool $isPTtl = FALSE; + #[ORM\Column(name: 'is_p_ttl', type: 'boolean', nullable: FALSE)] + private bool $isPTtl = FALSE; - #[ORM\Column(name: 'p_ttl_type', type: 'string', nullable: FALSE)] - private string $pTtlType = 'N / A'; + #[ORM\Column(name: 'p_ttl_type', type: 'string', nullable: FALSE)] + private string $pTtlType = 'N / A'; - #[ORM\Column(name: 'guide_number', type: 'string', nullable: TRUE)] - private ?string $guideNumber = ''; + #[ORM\Column(name: 'guide_number', type: 'string', nullable: TRUE)] + private ?string $guideNumber = ''; - #[ORM\Column(name: 'batteries', type: 'string', nullable: FALSE)] - private string $batteries = '4x AA'; + #[ORM\Column(name: 'batteries', type: 'string', nullable: FALSE)] + private string $batteries = '4x AA'; - #[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)] - private readonly ?string $notes; + #[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)] + private readonly ?string $notes; - #[ORM\Column(name: 'serial', type: 'string', nullable: TRUE)] - private readonly ?string $serial; + #[ORM\Column(name: 'serial', type: 'string', nullable: TRUE)] + private readonly ?string $serial; } diff --git a/src/Entity/Fpu.php b/src/Entity/Fpu.php index 787bcd7..4801bde 100644 --- a/src/Entity/Fpu.php +++ b/src/Entity/Fpu.php @@ -33,7 +33,7 @@ class Fpu { #[ORM\Column(name: 'clock_speed', type: 'integer')] private int $clockSpeed = 33; - #[ORM\Column(name: 'count', nullable: FALSE, options: array('default' => 1))] + #[ORM\Column(name: 'count', nullable: FALSE, options: ['default' => 1])] private int $count = 1; #[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)] diff --git a/src/Entity/Gpu.php b/src/Entity/Gpu.php index 831563d..2675f1e 100644 --- a/src/Entity/Gpu.php +++ b/src/Entity/Gpu.php @@ -2,8 +2,7 @@ namespace App\Entity; -use App\Enum\CardBus; -use App\Enum\SlotKey; +use App\Enum\{CardBus, SlotKey}; use Doctrine\ORM\Mapping as ORM; #[ORM\Table(name: 'gpu', schema: 'collection')] @@ -41,10 +40,10 @@ class Gpu { name: 'card_key', type: 'string', enumType: SlotKey::class, - options: array( - 'comment' => "The shape of the card connector", - 'default' => "PCIe x16" - ) + options: [ + 'comment' => 'The shape of the card connector', + 'default' => 'PCIe x16', + ] )] private SlotKey $cardKey = SlotKey::PCIE_X16; @@ -53,67 +52,67 @@ class Gpu { type: 'string', nullable: TRUE, enumType: CardBus::class, - options: array('comment' => "The type of electrical bus this card uses") + options: ['comment' => 'The type of electrical bus this card uses'] )] private ?CardBus $busInterface; #[ORM\Column( name: 'slot_span', - options: array( - 'comment' => "How many expansion slots the card occupies", + options: [ + 'comment' => 'How many expansion slots the card occupies', 'default' => 1, - ), + ], )] private int $slotSpan = 1; - #[ORM\Column(name: 'molex_power', options: array('default' => 0))] + #[ORM\Column(name: 'molex_power', options: ['default' => 0])] private int $molexPower = 0; - #[ORM\Column(name: 'pcie_6_pin', options: array('default' => 0))] + #[ORM\Column(name: 'pcie_6_pin', options: ['default' => 0])] private int $pcie6power = 0; - #[ORM\Column(name: 'pcie_8_pin', options: array('default' => 0))] + #[ORM\Column(name: 'pcie_8_pin', options: ['default' => 0])] private int $pcie8power = 0; #[ORM\Column( name: 'tdp', nullable: TRUE, - options: array('comment' => "Thermal Design Power (in Watts)") + options: ['comment' => 'Thermal Design Power (in Watts)'] )] private ?int $tdp = 0; #[ORM\Column( name: 'base_clock', nullable: TRUE, - options: array('comment' => "Base speed of the gpu core, in MHz") + options: ['comment' => 'Base speed of the gpu core, in MHz'] )] private ?int $baseClock; #[ORM\Column( name: 'boost_clock', nullable: TRUE, - options: array('comment' => "GPU core boost clock, in MHz") + options: ['comment' => 'GPU core boost clock, in MHz'] )] private ?int $boostClock; #[ORM\Column( name: 'memory_clock', nullable: TRUE, - options: array('comment' => "Clock speed of the VRAM, in MHz") + options: ['comment' => 'Clock speed of the VRAM, in MHz'] )] private ?int $memoryClock; #[ORM\Column( name: 'memory_size', nullable: TRUE, - options: array('comment' => 'VRAM size, in MiB') + options: ['comment' => 'VRAM size, in MiB'] )] private ?int $memorySize; #[ORM\Column( name: 'memory_bus', nullable: TRUE, - options: array("comment" => 'The width of the memory bus in bits') + options: ['comment' => 'The width of the memory bus in bits'] )] private ?int $memoryBus; @@ -156,10 +155,10 @@ class Gpu { #[ORM\Column(name: 'link', nullable: TRUE)] private ?string $link; - #[ORM\Column(name: 'count', nullable: FALSE, options: array('default' => 1))] + #[ORM\Column(name: 'count', nullable: FALSE, options: ['default' => 1])] private int $count = 1; - #[ORM\Column(name: 'acquired', nullable: FALSE, options: array('default' => TRUE))] + #[ORM\Column(name: 'acquired', nullable: FALSE, options: ['default' => TRUE])] private bool $acquired; #[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)] diff --git a/src/Entity/LensTrait.php b/src/Entity/LensTrait.php index 6d2d912..33e0aec 100644 --- a/src/Entity/LensTrait.php +++ b/src/Entity/LensTrait.php @@ -4,61 +4,60 @@ namespace App\Entity; use Doctrine\ORM\Mapping as ORM; -trait LensTrait -{ - use PurchasePrice; +trait LensTrait { + use PurchasePrice; - #[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: TRUE)] - private readonly ?string $brand; + #[ORM\Column(name: 'brand', type: 'string', length: 64, nullable: TRUE)] + private readonly ?string $brand; - #[ORM\Column(name: 'coatings', type: 'string', length: 64, nullable: TRUE)] - private readonly ?string $coatings; + #[ORM\Column(name: 'coatings', type: 'string', length: 64, nullable: TRUE)] + private readonly ?string $coatings; - #[ORM\Column(name: 'product_line', type: 'string', length: 64, nullable: TRUE)] - private readonly ?string $productLine; + #[ORM\Column(name: 'product_line', type: 'string', length: 64, nullable: TRUE)] + private readonly ?string $productLine; - #[ORM\Column(name: 'model', type: 'string', length: 64, nullable: TRUE)] - private readonly ?string $model; + #[ORM\Column(name: 'model', type: 'string', length: 64, nullable: TRUE)] + private readonly ?string $model; - #[ORM\Column(name: 'min_f_stop', type: 'string', length: 10, nullable: TRUE)] - private readonly ?string $minFStop; + #[ORM\Column(name: 'min_f_stop', type: 'string', length: 10, nullable: TRUE)] + private readonly ?string $minFStop; - #[ORM\Column(name: 'max_f_stop', type: 'float', precision: 10, scale: 0, nullable: TRUE)] - private readonly ?float $maxFStop; + #[ORM\Column(name: 'max_f_stop', type: 'float', precision: 10, scale: 0, nullable: TRUE)] + private readonly ?float $maxFStop; - #[ORM\Column(name: 'min_focal_length', type: 'integer', nullable: TRUE)] - private readonly ?int $minFocalLength; + #[ORM\Column(name: 'min_focal_length', type: 'integer', nullable: TRUE)] + private readonly ?int $minFocalLength; - #[ORM\Column(name: 'max_focal_length', type: 'integer', nullable: TRUE)] - private readonly ?int $maxFocalLength; + #[ORM\Column(name: 'max_focal_length', type: 'integer', nullable: TRUE)] + private readonly ?int $maxFocalLength; - #[ORM\Column(name: 'serial', type: 'string', length: 10, nullable: TRUE)] - private readonly ?string $serial; + #[ORM\Column(name: 'serial', type: 'string', length: 10, nullable: TRUE)] + private readonly ?string $serial; - #[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)] - private readonly ?string $notes; + #[ORM\Column(name: 'notes', type: 'text', nullable: TRUE)] + private readonly ?string $notes; - #[ORM\Column(name: 'image_size', type: 'string', nullable: FALSE, options: ['default' => '35mm'])] - private string $imageSize = '35mm'; + #[ORM\Column(name: 'image_size', type: 'string', nullable: FALSE, options: ['default' => '35mm'])] + private string $imageSize = '35mm'; - #[ORM\Column(name: 'mount', type: 'string', length: 40, nullable: TRUE)] - private readonly ?string $mount; + #[ORM\Column(name: 'mount', type: 'string', length: 40, nullable: TRUE)] + private readonly ?string $mount; - #[ORM\Column(name: 'front_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: TRUE)] - private readonly ?string $frontFilterSize; + #[ORM\Column(name: 'front_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: TRUE)] + private readonly ?string $frontFilterSize; - #[ORM\Column(name: 'rear_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: TRUE)] - private readonly ?string $rearFilterSize; + #[ORM\Column(name: 'rear_filter_size', type: 'decimal', precision: 10, scale: 0, nullable: TRUE)] + private readonly ?string $rearFilterSize; - #[ORM\Column(name: 'is_teleconverter', type: 'boolean', nullable: FALSE)] - private bool $isTeleconverter = FALSE; + #[ORM\Column(name: 'is_teleconverter', type: 'boolean', nullable: FALSE)] + private bool $isTeleconverter = FALSE; - #[ORM\Column(name: 'design_elements', type: 'smallint', nullable: TRUE)] - private readonly ?int $designElements; + #[ORM\Column(name: 'design_elements', type: 'smallint', nullable: TRUE)] + private readonly ?int $designElements; - #[ORM\Column(name: 'design_groups', type: 'smallint', nullable: TRUE)] - private readonly ?int $designGroups; + #[ORM\Column(name: 'design_groups', type: 'smallint', nullable: TRUE)] + private readonly ?int $designGroups; - #[ORM\Column(name: 'aperture_blades', type: 'smallint', nullable: TRUE)] - private readonly ?int $apertureBlades; + #[ORM\Column(name: 'aperture_blades', type: 'smallint', nullable: TRUE)] + private readonly ?int $apertureBlades; } diff --git a/src/Entity/Lenses.php b/src/Entity/Lenses.php index ff1fc3e..503b264 100644 --- a/src/Entity/Lenses.php +++ b/src/Entity/Lenses.php @@ -10,20 +10,19 @@ use Doctrine\ORM\Mapping as ORM; */ #[ORM\Table(name: 'lenses', schema: 'collection')] #[ORM\Entity(repositoryClass: LensesRepository::class)] -class Lenses -{ +class Lenses { use GetSet; - use LensTrait; + use LensTrait; - #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)] - #[ORM\Id] - #[ORM\GeneratedValue(strategy: 'IDENTITY')] - #[ORM\SequenceGenerator(sequenceName: 'camera.lenses_id_seq', allocationSize: 1, initialValue: 1)] - private int $id; + #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] + #[ORM\SequenceGenerator(sequenceName: 'camera.lenses_id_seq', allocationSize: 1, initialValue: 1)] + private int $id; - #[ORM\Column(name: 'received', type: 'boolean', nullable: FALSE)] - private bool $received = FALSE; + #[ORM\Column(name: 'received', type: 'boolean', nullable: FALSE)] + private bool $received = FALSE; - #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE)] - private bool $formerlyOwned = FALSE; + #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE)] + private bool $formerlyOwned = FALSE; } diff --git a/src/Entity/Motherboard.php b/src/Entity/Motherboard.php index cf28c82..5a3ecf4 100644 --- a/src/Entity/Motherboard.php +++ b/src/Entity/Motherboard.php @@ -2,8 +2,8 @@ namespace App\Entity; +use Doctrine\Common\Collections\{ArrayCollection, Collection}; use Doctrine\ORM\Mapping as ORM; -use Doctrine\Common\Collections\{Collection, ArrayCollection}; #[ORM\Table(name: 'motherboard', schema: 'collection')] #[ORM\Entity] @@ -41,7 +41,7 @@ class Motherboard { #[ORM\Column('link', type: 'string')] private string $link; - #[ORM\Column('notes', type: 'text', nullable: true)] + #[ORM\Column('notes', type: 'text', nullable: TRUE)] private ?string $notes = ''; // ------------------------------------------------------------------------ diff --git a/src/Entity/PreviouslyOwnedCamera.php b/src/Entity/PreviouslyOwnedCamera.php index d5a84c2..2ce685c 100644 --- a/src/Entity/PreviouslyOwnedCamera.php +++ b/src/Entity/PreviouslyOwnedCamera.php @@ -10,14 +10,13 @@ use Doctrine\ORM\Mapping as ORM; */ #[ORM\Table(name: 'previously_owned_camera', schema: 'collection')] #[ORM\Entity(repositoryClass: CameraRepository::class)] -class PreviouslyOwnedCamera -{ +class PreviouslyOwnedCamera { use GetSet; - use CameraBase; + use CameraBase; - #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)] - #[ORM\Id] - #[ORM\GeneratedValue(strategy: 'IDENTITY')] - #[ORM\SequenceGenerator(sequenceName: 'prevously_owned_camera_id_seq', allocationSize: 1, initialValue: 1)] - private int $id; + #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] + #[ORM\SequenceGenerator(sequenceName: 'prevously_owned_camera_id_seq', allocationSize: 1, initialValue: 1)] + private int $id; } diff --git a/src/Entity/PreviouslyOwnedFlash.php b/src/Entity/PreviouslyOwnedFlash.php index cb51f85..2a06835 100644 --- a/src/Entity/PreviouslyOwnedFlash.php +++ b/src/Entity/PreviouslyOwnedFlash.php @@ -9,19 +9,18 @@ use Doctrine\ORM\Mapping as ORM; */ #[ORM\Table(name: 'previously_owned_flash', schema: 'collection')] #[ORM\Entity] -class PreviouslyOwnedFlash -{ +class PreviouslyOwnedFlash { use GetSet; - use FlashBase; + use FlashBase; - #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)] - #[ORM\Id] - #[ORM\GeneratedValue(strategy: 'IDENTITY')] - private int $id; + #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] + private int $id; - #[ORM\Column(name: 'received', type: 'boolean', nullable: FALSE, options: ['default' => TRUE])] - private bool $received = TRUE; + #[ORM\Column(name: 'received', type: 'boolean', nullable: FALSE, options: ['default' => TRUE])] + private bool $received = TRUE; - #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE, options: ['default' => TRUE])] - private bool $formerlyOwned = TRUE; + #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE, options: ['default' => TRUE])] + private bool $formerlyOwned = TRUE; } diff --git a/src/Entity/PreviouslyOwnedLenses.php b/src/Entity/PreviouslyOwnedLenses.php index 2d85483..2af0788 100644 --- a/src/Entity/PreviouslyOwnedLenses.php +++ b/src/Entity/PreviouslyOwnedLenses.php @@ -10,19 +10,18 @@ use Doctrine\ORM\Mapping as ORM; */ #[ORM\Table(name: 'previously_owned_lenses', schema: 'collection')] #[ORM\Entity(repositoryClass: LensesRepository::class)] -class PreviouslyOwnedLenses -{ +class PreviouslyOwnedLenses { use GetSet; - use LensTrait; + use LensTrait; - #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)] - #[ORM\Id] - #[ORM\GeneratedValue(strategy: 'IDENTITY')] - private int $id; + #[ORM\Column(name: 'id', type: 'integer', nullable: FALSE)] + #[ORM\Id] + #[ORM\GeneratedValue(strategy: 'IDENTITY')] + private int $id; - #[ORM\Column(name: 'received', type: 'boolean', nullable: FALSE)] - private bool $received = TRUE; + #[ORM\Column(name: 'received', type: 'boolean', nullable: FALSE)] + private bool $received = TRUE; - #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE)] - private bool $formerlyOwned = TRUE; + #[ORM\Column(name: 'formerly_owned', type: 'boolean', nullable: FALSE)] + private bool $formerlyOwned = TRUE; } diff --git a/src/Entity/PurchasePrice.php b/src/Entity/PurchasePrice.php index b70468c..1f9195e 100644 --- a/src/Entity/PurchasePrice.php +++ b/src/Entity/PurchasePrice.php @@ -4,24 +4,24 @@ namespace App\Entity; use Doctrine\ORM\Mapping as ORM; -trait PurchasePrice -{ - #[ORM\Column(name: 'purchase_price', type: 'money', nullable: TRUE)] - private ?string $purchasePrice = NULL; +trait PurchasePrice { + #[ORM\Column(name: 'purchase_price', type: 'money', nullable: TRUE)] + private ?string $purchasePrice = NULL; - public function setPurchasePrice(?string $purchasePrice): self - { - $this->purchasePrice = $purchasePrice; + public function setPurchasePrice(?string $purchasePrice): self + { + $this->purchasePrice = $purchasePrice; - return $this; - } + return $this; + } - public function getPurchasePrice(): string - { - if (empty($this->purchasePrice)) { - return '0'; - } + public function getPurchasePrice(): string + { + if (empty($this->purchasePrice)) + { + return '0'; + } - return $this->purchasePrice; - } + return $this->purchasePrice; + } } diff --git a/src/Enum/CardBus.php b/src/Enum/CardBus.php index e1e267d..bda6f6f 100644 --- a/src/Enum/CardBus.php +++ b/src/Enum/CardBus.php @@ -26,18 +26,18 @@ enum CardBus: string { public static function getGroups(): array { - $filter = static fn (string $starts_with) => - array_filter(self::cases(), fn (CardBus $case) => - str_starts_with($case->name, $starts_with) - ); + $filter = static fn (string $starts_with) => array_filter( + self::cases(), + static fn (CardBus $case) => str_starts_with($case->name, $starts_with) + ); $pcie = $filter('PCIE_'); $agp = $filter('AGP_'); $pci = $filter('PCI_'); $isa = $filter('ISA_'); - $pcie16 = array_filter($pcie, fn (CardBus $case) => str_ends_with($case->name, '_16')); - $pcieOther = array_udiff($pcie, $pcie16, fn ($a, $b) => $a->name <=> $b->name); + $pcie16 = array_filter($pcie, static fn (CardBus $case) => str_ends_with($case->name, '_16')); + $pcieOther = array_udiff($pcie, $pcie16, static fn ($a, $b) => $a->name <=> $b->name); return [ 'PCI Express x16' => $pcie16, diff --git a/src/Enum/SlotKey.php b/src/Enum/SlotKey.php index fe815f0..bf43433 100644 --- a/src/Enum/SlotKey.php +++ b/src/Enum/SlotKey.php @@ -30,20 +30,22 @@ enum SlotKey: string { public static function getCases(): array { $cases = self::cases(); - return array_map(static fn(UnitEnum $case) => $case->name, $cases); + + return array_map(static fn (UnitEnum $case) => $case->name, $cases); } public static function getValues(): array { $cases = self::cases(); - return array_map(static fn(UnitEnum $case) => $case->value, $cases); + + return array_map(static fn (UnitEnum $case) => $case->value, $cases); } public static function getGroups(): array { - $filter = static fn (string $starts_with) => - array_filter(self::cases(), fn (SlotKey $case) => - str_starts_with($case->name, $starts_with) + $filter = static fn (string $starts_with) => array_filter( + self::cases(), + static fn (SlotKey $case) => str_starts_with($case->name, $starts_with) ); return [ @@ -68,7 +70,7 @@ enum SlotKey: string { self::ISA_16, self::ISA_8, self::ISA_VLB, - ] + ], ]; } } diff --git a/src/Form/BrandCategoryTrait.php b/src/Form/BrandCategoryTrait.php index 3512faa..b5127f0 100644 --- a/src/Form/BrandCategoryTrait.php +++ b/src/Form/BrandCategoryTrait.php @@ -2,17 +2,15 @@ namespace App\Form; -use Doctrine\ORM\EntityRepository; -use Doctrine\ORM\QueryBuilder; +use Doctrine\ORM\{EntityRepository, QueryBuilder}; trait BrandCategoryTrait { public static function filterBrands(string $filter): callable { - return static fn(EntityRepository $e) => - $e->createQueryBuilder('b') - ->join('b.categories', 'bc') - ->where('bc.name=:name') - ->orderBy('b.name', 'ASC') - ->setParameter('name', $filter); + return static fn (EntityRepository $e) => $e->createQueryBuilder('b') + ->join('b.categories', 'bc') + ->where('bc.name=:name') + ->orderBy('b.name', 'ASC') + ->setParameter('name', $filter); } } diff --git a/src/Form/BrandCategoryType.php b/src/Form/BrandCategoryType.php index 34d7864..7159446 100644 --- a/src/Form/BrandCategoryType.php +++ b/src/Form/BrandCategoryType.php @@ -1,25 +1,22 @@ -add('name') - ; - } +class BrandCategoryType extends AbstractType { + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder + ->add('name'); + } - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults([ - 'data_class' => BrandCategory::class, - ]); - } + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => BrandCategory::class, + ]); + } } diff --git a/src/Form/BrandType.php b/src/Form/BrandType.php index b484ef5..c640c7c 100644 --- a/src/Form/BrandType.php +++ b/src/Form/BrandType.php @@ -2,26 +2,22 @@ namespace App\Form; -use App\Entity\Brand; +use App\Entity\{Brand, BrandCategory}; use Symfony\Component\Form\{AbstractType, FormBuilderInterface}; -use App\Entity\BrandCategory; -use Doctrine\ORM\EntityRepository; -use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\OptionsResolver\OptionsResolver; -class BrandType extends AbstractType -{ - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $builder - ->add('name') +class BrandType extends AbstractType { + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder + ->add('name') ->add('categories'); - } + } - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults([ - 'data_class' => Brand::class, - ]); - } + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Brand::class, + ]); + } } diff --git a/src/Form/CameraType.php b/src/Form/CameraType.php index d3f9f38..32d2e0e 100644 --- a/src/Form/CameraType.php +++ b/src/Form/CameraType.php @@ -9,60 +9,59 @@ use Symfony\Component\OptionsResolver\Exception\AccessException; use Symfony\Component\OptionsResolver\OptionsResolver; -class CameraType extends AbstractType -{ - /** - * {@inheritDoc} - */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $builder->add('brand') - ->add('type') - ->add('isDigital') - ->add('mount') - ->add('model') - ->add('filmFormat', ChoiceType::class, [ - 'choices' => [ - 'Small Format' => [ - '35mm' => '135', - '110' => '110', - ], - 'Medium Format' => [ - '120' => '120', - '127' => '127', - '620' => '620', - ], - ], - ]) - ->add('cropFactor') - ->add('serial') - ->add('purchasePrice', MoneyType::class, [ - 'currency' => 'USD', - ]) - ->add('batteryType') - ->add('received') - ->add('isWorking') - ->add('formerlyOwned') - ->add('notes'); - } +class CameraType extends AbstractType { + /** + * {@inheritDoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder->add('brand') + ->add('type') + ->add('isDigital') + ->add('mount') + ->add('model') + ->add('filmFormat', ChoiceType::class, [ + 'choices' => [ + 'Small Format' => [ + '35mm' => '135', + '110' => '110', + ], + 'Medium Format' => [ + '120' => '120', + '127' => '127', + '620' => '620', + ], + ], + ]) + ->add('cropFactor') + ->add('serial') + ->add('purchasePrice', MoneyType::class, [ + 'currency' => 'USD', + ]) + ->add('batteryType') + ->add('received') + ->add('isWorking') + ->add('formerlyOwned') + ->add('notes'); + } - /** - * {@inheritDoc} - * - * @throws AccessException - */ - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults([ - 'data_class' => Camera::class, - ]); - } + /** + * {@inheritDoc} + * + * @throws AccessException + */ + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Camera::class, + ]); + } - /** - * {@inheritDoc} - */ - public function getBlockPrefix(): string - { - return 'camerabundle_camera'; - } + /** + * {@inheritDoc} + */ + public function getBlockPrefix(): string + { + return 'camerabundle_camera'; + } } diff --git a/src/Form/CameraTypeType.php b/src/Form/CameraTypeType.php index f32d508..8d3d16d 100644 --- a/src/Form/CameraTypeType.php +++ b/src/Form/CameraTypeType.php @@ -8,34 +8,33 @@ use Symfony\Component\OptionsResolver\Exception\AccessException; use Symfony\Component\OptionsResolver\OptionsResolver; -class CameraTypeType extends AbstractType -{ - /** - * {@inheritDoc} - */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $builder->add('type') - ->add('description'); - } +class CameraTypeType extends AbstractType { + /** + * {@inheritDoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder->add('type') + ->add('description'); + } - /** - * {@inheritDoc} - * - * @throws AccessException - */ - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults([ - 'data_class' => CameraType::class, - ]); - } + /** + * {@inheritDoc} + * + * @throws AccessException + */ + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => CameraType::class, + ]); + } - /** - * {@inheritDoc} - */ - public function getBlockPrefix(): string - { - return 'camerabundle_cameratype'; - } + /** + * {@inheritDoc} + */ + public function getBlockPrefix(): string + { + return 'camerabundle_cameratype'; + } } diff --git a/src/Form/ChipsetType.php b/src/Form/ChipsetType.php index 6734082..f33a1e3 100644 --- a/src/Form/ChipsetType.php +++ b/src/Form/ChipsetType.php @@ -1,35 +1,31 @@ -add('brand', EntityType::class, [ 'class' => Brand::class, 'query_builder' => self::filterBrands('chipset'), ]) - ->add('name') - ->add('parts') - ->add('link') - ; - } + ->add('name') + ->add('parts') + ->add('link'); + } - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults([ - 'data_class' => Chipset::class, - ]); - } + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Chipset::class, + ]); + } } diff --git a/src/Form/CpuType.php b/src/Form/CpuType.php index 7764182..64777cf 100644 --- a/src/Form/CpuType.php +++ b/src/Form/CpuType.php @@ -1,15 +1,12 @@ -add('architecture', EnumType::class, [ 'class' => CpuArchitecture::class, - 'choice_label' => fn(UnitEnum $choice): string => $choice->value, + 'choice_label' => static fn (UnitEnum $choice): string => $choice->value, 'choices' => CpuArchitecture::getGroups(), ]) ->add('brand', EntityType::class, [ @@ -37,50 +34,50 @@ class CpuType extends AbstractType { ->add('codeName') // Cache Stuff - ->add('L1dCount', null, [ + ->add('L1dCount', NULL, [ 'label' => 'L1 Data Cache(s)', ]) - ->add('L1dSize', null, [ - 'label' => 'L1 Data Size KB' + ->add('L1dSize', NULL, [ + 'label' => 'L1 Data Size KB', ]) - ->add('L1dWay', null, [ - 'label' => 'L1 Data (x-way)' + ->add('L1dWay', NULL, [ + 'label' => 'L1 Data (x-way)', ]) - ->add('L1cCount', null, [ + ->add('L1cCount', NULL, [ 'label' => 'L1 Instruction Cache(s)', ]) - ->add('L1cSize', null, [ - 'label' => 'L1 Instruction Size KB' + ->add('L1cSize', NULL, [ + 'label' => 'L1 Instruction Size KB', ]) - ->add('L1cWay', null, [ - 'label' => 'L1 Instruction (x-way)' + ->add('L1cWay', NULL, [ + 'label' => 'L1 Instruction (x-way)', ]) - ->add('L1uCount', null, [ + ->add('L1uCount', NULL, [ 'label' => 'L1 Unified Cache(s)', ]) - ->add('L1uSize', null, [ - 'label' => 'L1 Unified Cache Size: KB' + ->add('L1uSize', NULL, [ + 'label' => 'L1 Unified Cache Size: KB', ]) - ->add('L1uWay', null, [ - 'label' => 'L1 Unified (x-way)' + ->add('L1uWay', NULL, [ + 'label' => 'L1 Unified (x-way)', ]) - ->add('L2Count', null, [ - 'label' => 'L2 Cache(s)' + ->add('L2Count', NULL, [ + 'label' => 'L2 Cache(s)', ]) - ->add('L2Size', null, [ - 'label' => 'L2 Cache Size KB (per unit)' + ->add('L2Size', NULL, [ + 'label' => 'L2 Cache Size KB (per unit)', ]) - ->add('L2Way', null, [ - 'label' => 'L2 Cache (x-way)' + ->add('L2Way', NULL, [ + 'label' => 'L2 Cache (x-way)', ]) - ->add('L3Count', null, [ - 'label' => 'L3 Cache(s)' + ->add('L3Count', NULL, [ + 'label' => 'L3 Cache(s)', ]) - ->add('L3Size', null, [ - 'label' => 'L3 Cache Size KB (per unit)' + ->add('L3Size', NULL, [ + 'label' => 'L3 Cache Size KB (per unit)', ]) - ->add('L3Way', null, [ - 'label' => 'L3 Cache (x-way)' + ->add('L3Way', NULL, [ + 'label' => 'L3 Cache (x-way)', ]) ->add('baseSpeed') @@ -95,8 +92,7 @@ class CpuType extends AbstractType { ->add('usable') ->add('received') ->add('link', UrlType::class) - ->add('notes') - ; + ->add('notes'); } public function configureOptions(OptionsResolver $resolver): void diff --git a/src/Form/FilmType.php b/src/Form/FilmType.php index 1a7eaa8..aa28d61 100644 --- a/src/Form/FilmType.php +++ b/src/Form/FilmType.php @@ -7,68 +7,67 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\{AbstractType, FormBuilderInterface}; use Symfony\Component\OptionsResolver\OptionsResolver; -class FilmType extends AbstractType -{ - /** - * {@inheritDoc} - */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $builder->add('brand') - ->add('productLine') - ->add('filmName') - ->add('filmAlias') - ->add('filmSpeedAsa') - ->add('filmSpeedDin') - ->add('filmFormat', ChoiceType::class, [ - 'choices' => [ - 'Small Format' => [ - '35mm' => '135', - '110' => '110', - ], - 'Medium Format' => [ - '120' => '120', - '127' => '127', - '620' => '620', - ], - ], - ]) - ->add('filmBase', ChoiceType::class, [ - 'choices' => [ - 'Cellulose Triacetate' => 'Cellulose Triacetate', - 'Polyester' => 'Polyester', - 'Polyethylene Naphtalate' => 'Polyethylene Naphtalate', - ], - ]) - ->add('unusedRolls') - ->add('rollsInCamera') - ->add('developedRolls') - ->add('chemistry', ChoiceType::class, [ - 'choices' => [ - 'B & W' => 'B & W', - 'C-41' => 'C-41', - 'E-6' => 'E-6', - 'Other' => 'Other', - ], - ]) - ->add('notes'); - } +class FilmType extends AbstractType { + /** + * {@inheritDoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder->add('brand') + ->add('productLine') + ->add('filmName') + ->add('filmAlias') + ->add('filmSpeedAsa') + ->add('filmSpeedDin') + ->add('filmFormat', ChoiceType::class, [ + 'choices' => [ + 'Small Format' => [ + '35mm' => '135', + '110' => '110', + ], + 'Medium Format' => [ + '120' => '120', + '127' => '127', + '620' => '620', + ], + ], + ]) + ->add('filmBase', ChoiceType::class, [ + 'choices' => [ + 'Cellulose Triacetate' => 'Cellulose Triacetate', + 'Polyester' => 'Polyester', + 'Polyethylene Naphtalate' => 'Polyethylene Naphtalate', + ], + ]) + ->add('unusedRolls') + ->add('rollsInCamera') + ->add('developedRolls') + ->add('chemistry', ChoiceType::class, [ + 'choices' => [ + 'B & W' => 'B & W', + 'C-41' => 'C-41', + 'E-6' => 'E-6', + 'Other' => 'Other', + ], + ]) + ->add('notes'); + } - /** - * {@inheritDoc} - */ - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults([ - 'data_class' => Film::class, - ]); - } + /** + * {@inheritDoc} + */ + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Film::class, + ]); + } - /** - * {@inheritDoc} - */ - public function getBlockPrefix(): string - { - return 'camerabundle_film'; - } + /** + * {@inheritDoc} + */ + public function getBlockPrefix(): string + { + return 'camerabundle_film'; + } } diff --git a/src/Form/FlashType.php b/src/Form/FlashType.php index e911e33..edfa05c 100644 --- a/src/Form/FlashType.php +++ b/src/Form/FlashType.php @@ -8,46 +8,45 @@ use Symfony\Component\OptionsResolver\Exception\AccessException; use Symfony\Component\OptionsResolver\OptionsResolver; -class FlashType extends AbstractType -{ - /** - * {@inheritDoc} - */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $builder->add('brand') - ->add('model') - ->add('isAutoFlash') - ->add('isTtl') - ->add('ttlType') - ->add('isPTtl') - ->add('pTtlType') - ->add('guideNumber') - ->add('purchasePrice') - ->add('batteries') - ->add('notes') - ->add('serial') - ->add('received') - ->add('formerlyOwned'); - } +class FlashType extends AbstractType { + /** + * {@inheritDoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder->add('brand') + ->add('model') + ->add('isAutoFlash') + ->add('isTtl') + ->add('ttlType') + ->add('isPTtl') + ->add('pTtlType') + ->add('guideNumber') + ->add('purchasePrice') + ->add('batteries') + ->add('notes') + ->add('serial') + ->add('received') + ->add('formerlyOwned'); + } - /** - * {@inheritDoc} - * - * @throws AccessException - */ - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults([ - 'data_class' => Flash::class, - ]); - } + /** + * {@inheritDoc} + * + * @throws AccessException + */ + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Flash::class, + ]); + } - /** - * {@inheritDoc} - */ - public function getBlockPrefix(): string - { - return 'camerabundle_flash'; - } + /** + * {@inheritDoc} + */ + public function getBlockPrefix(): string + { + return 'camerabundle_flash'; + } } diff --git a/src/Form/FpuType.php b/src/Form/FpuType.php index bc5166e..508c513 100644 --- a/src/Form/FpuType.php +++ b/src/Form/FpuType.php @@ -1,43 +1,38 @@ -add('socket', EntityType::class, [ 'class' => Socket::class, - 'query_builder' => static fn(EntityRepository $e) => $e->createQueryBuilder('s')->orderBy('s.name', 'ASC'), + 'query_builder' => static fn (EntityRepository $e) => $e->createQueryBuilder('s')->orderBy('s.name', 'ASC'), ]) ->add('brand', EntityType::class, [ 'class' => Brand::class, 'query_builder' => self::filterBrands('fpu'), ]) ->add('series') - ->add('model') - ->add('clockSpeed') - ->add('count') - ->add('notes') - ; - } + ->add('model') + ->add('clockSpeed') + ->add('count') + ->add('notes'); + } - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults([ - 'data_class' => Fpu::class, - ]); - } + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Fpu::class, + ]); + } } diff --git a/src/Form/GPUCoreType.php b/src/Form/GPUCoreType.php index d603591..627509c 100644 --- a/src/Form/GPUCoreType.php +++ b/src/Form/GPUCoreType.php @@ -3,36 +3,33 @@ namespace App\Form; use App\Entity\{Brand, GpuCore}; -use Doctrine\ORM\EntityRepository; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\{AbstractType, FormBuilderInterface}; use Symfony\Component\OptionsResolver\OptionsResolver; -class GPUCoreType extends AbstractType -{ +class GPUCoreType extends AbstractType { use BrandCategoryTrait; - public function buildForm(FormBuilderInterface $builder, array $options): void + public function buildForm(FormBuilderInterface $builder, array $options): void { - $builder - ->add('brand', EntityType::class, [ - 'class' => Brand::class, - 'query_builder' => self::filterBrands('gpu_core'), - ]) - ->add('name') - ->add('variant') - ->add('architecture') - ->add('architectureLink') - ->add('generationName') - ->add('generationLink') - ->add('processNode'); - } + $builder + ->add('brand', EntityType::class, [ + 'class' => Brand::class, + 'query_builder' => self::filterBrands('gpu_core'), + ]) + ->add('name') + ->add('variant') + ->add('architecture') + ->add('architectureLink') + ->add('generationName') + ->add('generationLink') + ->add('processNode'); + } - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults([ - 'data_class' => GpuCore::class, - ]); - } + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => GpuCore::class, + ]); + } } - diff --git a/src/Form/GpuType.php b/src/Form/GpuType.php index 8c15a63..d2c3ed3 100644 --- a/src/Form/GpuType.php +++ b/src/Form/GpuType.php @@ -2,8 +2,8 @@ namespace App\Form; -use App\Enum\{CardBus, SlotKey}; use App\Entity\{Brand, Gpu, GpuCore}; +use App\Enum\{CardBus, SlotKey}; use Doctrine\ORM\EntityRepository; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\ @@ -24,7 +24,7 @@ class GpuType extends AbstractType { ->add('modelName') ->add('gpuCore', EntityType::class, [ 'class' => GpuCore::class, - 'query_builder' => static fn(EntityRepository $e) => $e->createQueryBuilder('gc')->orderBy('gc.brand', 'ASC')->orderBy('gc.name', 'ASC'), + 'query_builder' => static fn (EntityRepository $e) => $e->createQueryBuilder('gc')->orderBy('gc.brand', 'ASC')->orderBy('gc.name', 'ASC'), 'placeholder' => 'Unknown', 'empty_data' => NULL, 'required' => FALSE, @@ -40,12 +40,12 @@ class GpuType extends AbstractType { ->add('cardKey', EnumType::class, [ 'class' => SlotKey::class, 'choices' => SlotKey::getGroups(), - 'choice_label' => fn(UnitEnum $choice): string => $choice->value, + 'choice_label' => static fn (UnitEnum $choice): string => $choice->value, ]) ->add('busInterface', EnumType::class, [ 'class' => CardBus::class, 'choices' => CardBus::getGroups(), - 'choice_label' => fn(UnitEnum $choice): string => $choice->value, + 'choice_label' => static fn (UnitEnum $choice): string => $choice->value, ]) ->add('slotSpan') ->add('molexPower', NULL, ['label' => 'Molex Power Connectors']) diff --git a/src/Form/LensesType.php b/src/Form/LensesType.php index cd4b3a8..86032ba 100644 --- a/src/Form/LensesType.php +++ b/src/Form/LensesType.php @@ -9,66 +9,65 @@ use Symfony\Component\OptionsResolver\Exception\AccessException; use Symfony\Component\OptionsResolver\OptionsResolver; -class LensesType extends AbstractType -{ - /** - * {@inheritDoc} - */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $builder->add('brand') - ->add('coatings') - ->add('productLine') - ->add('model') - ->add('mount') - ->add('imageSize', ChoiceType::class, [ - 'choices' => [ - 'Small Format' => [ - '35mm' => '35mm', - 'APS-C' => 'APS-C', - 'Micro 4/3' => 'Micro 4/3', - ], - 'Medium Format' => [ - '6x6' => '6x6cm', - '6x4.5' => '6x4.5cm', - '4x4' => '4x4cm', - ], - ], - ]) - ->add('minFStop') - ->add('maxFStop') - ->add('minFocalLength') - ->add('maxFocalLength') - ->add('serial') - ->add('purchasePrice') - ->add('notes') - ->add('received') - ->add('formerlyOwned') - ->add('frontFilterSize') - ->add('rearFilterSize') - ->add('isTeleconverter') - ->add('designElements') - ->add('designGroups') - ->add('apertureBlades'); - } +class LensesType extends AbstractType { + /** + * {@inheritDoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder->add('brand') + ->add('coatings') + ->add('productLine') + ->add('model') + ->add('mount') + ->add('imageSize', ChoiceType::class, [ + 'choices' => [ + 'Small Format' => [ + '35mm' => '35mm', + 'APS-C' => 'APS-C', + 'Micro 4/3' => 'Micro 4/3', + ], + 'Medium Format' => [ + '6x6' => '6x6cm', + '6x4.5' => '6x4.5cm', + '4x4' => '4x4cm', + ], + ], + ]) + ->add('minFStop') + ->add('maxFStop') + ->add('minFocalLength') + ->add('maxFocalLength') + ->add('serial') + ->add('purchasePrice') + ->add('notes') + ->add('received') + ->add('formerlyOwned') + ->add('frontFilterSize') + ->add('rearFilterSize') + ->add('isTeleconverter') + ->add('designElements') + ->add('designGroups') + ->add('apertureBlades'); + } - /** - * {@inheritDoc} - * - * @throws AccessException - */ - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults([ - 'data_class' => Lenses::class, - ]); - } + /** + * {@inheritDoc} + * + * @throws AccessException + */ + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Lenses::class, + ]); + } - /** - * {@inheritDoc} - */ - public function getBlockPrefix(): string - { - return 'camerabundle_lenses'; - } + /** + * {@inheritDoc} + */ + public function getBlockPrefix(): string + { + return 'camerabundle_lenses'; + } } diff --git a/src/Form/PreviouslyOwnedCameraType.php b/src/Form/PreviouslyOwnedCameraType.php index 29ad7c8..4917690 100644 --- a/src/Form/PreviouslyOwnedCameraType.php +++ b/src/Form/PreviouslyOwnedCameraType.php @@ -8,46 +8,45 @@ use Symfony\Component\OptionsResolver\Exception\AccessException; use Symfony\Component\OptionsResolver\OptionsResolver; -class PreviouslyOwnedCameraType extends AbstractType -{ - /** - * {@inheritDoc} - */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $builder->add('brand') - ->add('mount') - ->add('model') - ->add('isDigital') - ->add('cropFactor') - ->add('isWorking') - ->add('notes') - ->add('serial') - ->add('formerlyOwned') - ->add('purchasePrice') - ->add('batteryType') - ->add('filmFormat') - ->add('received') - ->add('type'); - } +class PreviouslyOwnedCameraType extends AbstractType { + /** + * {@inheritDoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder->add('brand') + ->add('mount') + ->add('model') + ->add('isDigital') + ->add('cropFactor') + ->add('isWorking') + ->add('notes') + ->add('serial') + ->add('formerlyOwned') + ->add('purchasePrice') + ->add('batteryType') + ->add('filmFormat') + ->add('received') + ->add('type'); + } - /** - * {@inheritDoc} - * - * @throws AccessException - */ - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults([ - 'data_class' => PreviouslyOwnedCamera::class, - ]); - } + /** + * {@inheritDoc} + * + * @throws AccessException + */ + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => PreviouslyOwnedCamera::class, + ]); + } - /** - * {@inheritDoc} - */ - public function getBlockPrefix(): string - { - return 'camerabundle_previouslyownedcamera'; - } + /** + * {@inheritDoc} + */ + public function getBlockPrefix(): string + { + return 'camerabundle_previouslyownedcamera'; + } } diff --git a/src/Form/PreviouslyOwnedFlashType.php b/src/Form/PreviouslyOwnedFlashType.php index 6110f0b..72456bf 100644 --- a/src/Form/PreviouslyOwnedFlashType.php +++ b/src/Form/PreviouslyOwnedFlashType.php @@ -8,47 +8,46 @@ use Symfony\Component\OptionsResolver\Exception\AccessException; use Symfony\Component\OptionsResolver\OptionsResolver; -class PreviouslyOwnedFlashType extends AbstractType -{ - /** - * {@inheritDoc} - */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $builder - ->add('brand') - ->add('model') - ->add('isAutoFlash') - ->add('isTtl') - ->add('ttlType') - ->add('isPTtl') - ->add('pTtlType') - ->add('guideNumber') - ->add('purchasePrice') - ->add('batteries') - ->add('notes') - ->add('serial') - ->add('received') - ->add('formerlyOwned'); - } +class PreviouslyOwnedFlashType extends AbstractType { + /** + * {@inheritDoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder + ->add('brand') + ->add('model') + ->add('isAutoFlash') + ->add('isTtl') + ->add('ttlType') + ->add('isPTtl') + ->add('pTtlType') + ->add('guideNumber') + ->add('purchasePrice') + ->add('batteries') + ->add('notes') + ->add('serial') + ->add('received') + ->add('formerlyOwned'); + } - /** - * {@inheritDoc} - * - * @throws AccessException - */ - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults([ - 'data_class' => PreviouslyOwnedFlash::class, - ]); - } + /** + * {@inheritDoc} + * + * @throws AccessException + */ + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => PreviouslyOwnedFlash::class, + ]); + } - /** - * {@inheritDoc} - */ - public function getBlockPrefix(): string - { - return 'camerabundle_previouslyownedflash'; - } + /** + * {@inheritDoc} + */ + public function getBlockPrefix(): string + { + return 'camerabundle_previouslyownedflash'; + } } diff --git a/src/Form/PreviouslyOwnedLensesType.php b/src/Form/PreviouslyOwnedLensesType.php index b091e9b..37b5254 100644 --- a/src/Form/PreviouslyOwnedLensesType.php +++ b/src/Form/PreviouslyOwnedLensesType.php @@ -8,53 +8,52 @@ use Symfony\Component\OptionsResolver\Exception\AccessException; use Symfony\Component\OptionsResolver\OptionsResolver; -class PreviouslyOwnedLensesType extends AbstractType -{ - /** - * {@inheritDoc} - */ - public function buildForm(FormBuilderInterface $builder, array $options): void - { - $builder->add('brand') - ->add('coatings') - ->add('productLine') - ->add('model') - ->add('minFStop') - ->add('maxFStop') - ->add('minFocalLength') - ->add('maxFocalLength') - ->add('serial') - ->add('purchasePrice') - ->add('notes') - ->add('mount') - ->add('imageSize') - ->add('received') - ->add('formerlyOwned') - ->add('frontFilterSize') - ->add('rearFilterSize') - ->add('isTeleconverter') - ->add('designElements') - ->add('designGroups') - ->add('apertureBlades'); - } +class PreviouslyOwnedLensesType extends AbstractType { + /** + * {@inheritDoc} + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder->add('brand') + ->add('coatings') + ->add('productLine') + ->add('model') + ->add('minFStop') + ->add('maxFStop') + ->add('minFocalLength') + ->add('maxFocalLength') + ->add('serial') + ->add('purchasePrice') + ->add('notes') + ->add('mount') + ->add('imageSize') + ->add('received') + ->add('formerlyOwned') + ->add('frontFilterSize') + ->add('rearFilterSize') + ->add('isTeleconverter') + ->add('designElements') + ->add('designGroups') + ->add('apertureBlades'); + } - /** - * {@inheritDoc} - * - * @throws AccessException - */ - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults([ - 'data_class' => PreviouslyOwnedLenses::class, - ]); - } + /** + * {@inheritDoc} + * + * @throws AccessException + */ + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => PreviouslyOwnedLenses::class, + ]); + } - /** - * {@inheritDoc} - */ - public function getBlockPrefix(): string - { - return 'camerabundle_previouslyownedlenses'; - } + /** + * {@inheritDoc} + */ + public function getBlockPrefix(): string + { + return 'camerabundle_previouslyownedlenses'; + } } diff --git a/src/Form/SocketTypeForm.php b/src/Form/SocketTypeForm.php index 117a08e..da473c9 100644 --- a/src/Form/SocketTypeForm.php +++ b/src/Form/SocketTypeForm.php @@ -1,32 +1,29 @@ -add('name') - ->add('otherName') - ->add('pinCount') - ->add('type', EnumType::class,[ +class SocketTypeForm extends AbstractType { + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder + ->add('name') + ->add('otherName') + ->add('pinCount') + ->add('type', EnumType::class, [ 'class' => SocketType::class, - ]) - ; - } + ]); + } - public function configureOptions(OptionsResolver $resolver): void - { - $resolver->setDefaults([ - 'data_class' => Socket::class, - ]); - } + public function configureOptions(OptionsResolver $resolver): void + { + $resolver->setDefaults([ + 'data_class' => Socket::class, + ]); + } } diff --git a/src/Kernel.php b/src/Kernel.php index 256dcf6..4bb6fd6 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -18,32 +18,30 @@ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigura use Symfony\Component\HttpKernel\Kernel as BaseKernel; use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; -class Kernel extends BaseKernel -{ - use MicroKernelTrait; +class Kernel extends BaseKernel { + use MicroKernelTrait; - protected function configureContainer( + protected function configureContainer( ContainerConfigurator $container, LoaderInterface $loader, ContainerBuilder $builder - ): void - { + ): void { $configDir = $this->getConfigDir(); - $container->import('../config/{packages}/*.yaml'); - $container->import('../config/{packages}/' . $this->environment . '/*.yaml'); + $container->import('../config/{packages}/*.yaml'); + $container->import('../config/{packages}/' . $this->environment . '/*.yaml'); $container->import('../config/{packages}/*.php'); $container->import('../config/{packages}/' . $this->environment . '/*.php'); $container->import('../config/{services}.php'); $container->import('../config/{services}_' . $this->environment . '.php'); - } + } - protected function configureRoutes(RoutingConfigurator $routes): void - { - $routes->import('../config/{routes}/' . $this->environment . '/*.php'); - $routes->import('../config/{routes}/*.php'); - $routes->import('../config/{routes}.php'); - } + protected function configureRoutes(RoutingConfigurator $routes): void + { + $routes->import('../config/{routes}/' . $this->environment . '/*.php'); + $routes->import('../config/{routes}/*.php'); + $routes->import('../config/{routes}.php'); + } } diff --git a/src/Maker/MakeCollectionCrud.php b/src/Maker/MakeCollectionCrud.php index efc035b..0676eed 100644 --- a/src/Maker/MakeCollectionCrud.php +++ b/src/Maker/MakeCollectionCrud.php @@ -1,4 +1,4 @@ - */ -final class MakeCollectionCrud extends AbstractMaker -{ +final class MakeCollectionCrud extends AbstractMaker { private Inflector $inflector; private string $controllerClassName; - private bool $generateTests = false; + private bool $generateTests = FALSE; public function __construct(private DoctrineHelper $doctrineHelper, private FormTypeRenderer $formTypeRenderer) { $this->inflector = InflectorFactory::create()->build(); - define('CRUD_TEMPLATE_PREFIX', __DIR__.'/../Resources/crud'); + define('CRUD_TEMPLATE_PREFIX', __DIR__ . '/../Resources/crud'); } public static function getCommandName(): string @@ -72,15 +62,15 @@ final class MakeCollectionCrud extends AbstractMaker { $command ->addArgument('entity-class', InputArgument::OPTIONAL, sprintf('The class name of the entity to create CRUD (e.g. %s)', Str::asClassName(Str::getRandomTerm()))) - ->setHelp(file_get_contents(__DIR__.'/../Resources/help/MakeCrud.txt')) - ; + ->setHelp(file_get_contents(__DIR__ . '/../Resources/help/MakeCrud.txt')); $inputConfig->setArgumentAsNonInteractive('entity-class'); } public function interact(InputInterface $input, ConsoleStyle $io, Command $command): void { - if (null === $input->getArgument('entity-class')) { + if (NULL === $input->getArgument('entity-class')) + { $argument = $command->getDefinition()->getArgument('entity-class'); $entities = $this->doctrineHelper->getEntitiesForAutocomplete(); @@ -100,7 +90,7 @@ final class MakeCollectionCrud extends AbstractMaker $defaultControllerClass ); - $this->generateTests = $io->confirm('Do you want to generate tests for the controller?. [Experimental]', false); + $this->generateTests = $io->confirm('Do you want to generate tests for the controller?. [Experimental]', FALSE); } public function generate(InputInterface $input, ConsoleStyle $io, Generator $generator): void @@ -115,9 +105,10 @@ final class MakeCollectionCrud extends AbstractMaker $repositoryVars = []; $repositoryClassName = EntityManagerInterface::class; - if (null !== $entityDoctrineDetails->getRepositoryClass()) { + if (NULL !== $entityDoctrineDetails->getRepositoryClass()) + { $repositoryClassDetails = $generator->createClassNameDetails( - '\\'.$entityDoctrineDetails->getRepositoryClass(), + '\\' . $entityDoctrineDetails->getRepositoryClass(), 'Repository\\', 'Repository' ); @@ -138,14 +129,17 @@ final class MakeCollectionCrud extends AbstractMaker ); $iter = 0; - do { + + do + { $formClassDetails = $generator->createClassNameDetails( - $entityClassDetails->getRelativeNameWithoutSuffix().($iter ?: '').'Type', + $entityClassDetails->getRelativeNameWithoutSuffix() . ($iter ?: '') . 'Type', 'Form\\', 'Type' ); - ++$iter; - } while (class_exists($formClassDetails->getFullName())); + $iter++; + } + while (class_exists($formClassDetails->getFullName())); $entityVarPlural = lcfirst($this->inflector->pluralize($entityClassDetails->getShortName())); $entityVarSingular = lcfirst($this->inflector->singularize($entityClassDetails->getShortName())); @@ -169,20 +163,21 @@ final class MakeCollectionCrud extends AbstractMaker $generator->generateController( $controllerClassDetails->getFullName(), CRUD_TEMPLATE_PREFIX . '/controller/Controller.tpl.php', - array_merge([ - 'use_statements' => $useStatements, - 'entity_class_name' => $entityClassDetails->getShortName(), - 'form_class_name' => $formClassDetails->getShortName(), - 'route_path' => Str::asRoutePath($controllerClassDetails->getRelativeNameWithoutSuffix()), - 'route_name' => $routeName, - 'templates_path' => $templatesPath, - 'entity_var_plural' => $entityVarPlural, - 'entity_twig_var_plural' => $entityTwigVarPlural, - 'entity_var_singular' => $entityVarSingular, - 'entity_twig_var_singular' => $entityTwigVarSingular, - 'entity_identifier' => $entityDoctrineDetails->getIdentifier(), - 'use_render_form' => method_exists(AbstractController::class, 'renderForm'), - ], + array_merge( + [ + 'use_statements' => $useStatements, + 'entity_class_name' => $entityClassDetails->getShortName(), + 'form_class_name' => $formClassDetails->getShortName(), + 'route_path' => Str::asRoutePath($controllerClassDetails->getRelativeNameWithoutSuffix()), + 'route_name' => $routeName, + 'templates_path' => $templatesPath, + 'entity_var_plural' => $entityVarPlural, + 'entity_twig_var_plural' => $entityTwigVarPlural, + 'entity_var_singular' => $entityVarSingular, + 'entity_twig_var_singular' => $entityTwigVarSingular, + 'entity_identifier' => $entityDoctrineDetails->getIdentifier(), + 'use_render_form' => method_exists(AbstractController::class, 'renderForm'), + ], $repositoryVars ) ); @@ -224,15 +219,17 @@ final class MakeCollectionCrud extends AbstractMaker ], ]; - foreach ($templates as $template => $variables) { + foreach ($templates as $template => $variables) + { $generator->generateTemplate( - $templatesPath.'/'.$template.'.html.twig', - CRUD_TEMPLATE_PREFIX . '/templates/'.$template.'.tpl.php', + $templatesPath . '/' . $template . '.html.twig', + CRUD_TEMPLATE_PREFIX . '/templates/' . $template . '.tpl.php', $variables ); } - if ($this->generateTests) { + if ($this->generateTests) + { $testClassDetails = $generator->createClassNameDetails( $entityClassDetails->getRelativeNameWithoutSuffix(), 'Test\\Controller\\', @@ -248,12 +245,13 @@ final class MakeCollectionCrud extends AbstractMaker $usesEntityManager = EntityManagerInterface::class === $repositoryClassName; - if ($usesEntityManager) { + if ($usesEntityManager) + { $useStatements->addUseStatement(EntityRepository::class); } $generator->generateFile( - 'tests/Controller/'.$testClassDetails->getShortName().'.php', + 'tests/Controller/' . $testClassDetails->getShortName() . '.php', $usesEntityManager ? 'crud/test/Test.EntityManager.tpl.php' : 'crud/test/Test.tpl.php', [ 'use_statements' => $useStatements, @@ -270,7 +268,8 @@ final class MakeCollectionCrud extends AbstractMaker ] ); - if (!class_exists(WebTestCase::class)) { + if ( ! class_exists(WebTestCase::class)) + { $io->caution('You\'ll need to install the `symfony/test-pack` to execute the tests for your new controller.'); } } diff --git a/src/Migrations/Version20221117193508.php b/src/Migrations/Version20221117193508.php index 6b48013..10c19fd 100644 --- a/src/Migrations/Version20221117193508.php +++ b/src/Migrations/Version20221117193508.php @@ -10,46 +10,45 @@ use Doctrine\Migrations\AbstractMigration; /** * Auto-generated Migration: Please modify to your needs! */ -final class Version20221117193508 extends AbstractMigration -{ - public function getDescription(): string - { - return ''; - } +final class Version20221117193508 extends AbstractMigration { + public function getDescription(): string + { + return ''; + } - public function up(Schema $schema): void - { - // this up() migration is auto-generated, please modify it to your needs - $this->addSql('DROP SEQUENCE collection.battery_type_id_seq CASCADE'); - $this->addSql('CREATE TABLE collection.chipset (id SERIAL NOT NULL, brand_id INT NOT NULL, name VARCHAR(255) NOT NULL, parts VARCHAR(255) NOT NULL, link VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_110BAE8044F5D008 ON collection.chipset (brand_id)'); - $this->addSql('CREATE TABLE collection.motherboard (id SERIAL NOT NULL, brand_id INT NOT NULL, chipset_id INT DEFAULT NULL, model VARCHAR(255) NOT NULL, link VARCHAR(255) NOT NULL, notes TEXT DEFAULT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_5C3F5E3144F5D008 ON collection.motherboard (brand_id)'); - $this->addSql('CREATE INDEX IDX_5C3F5E31BC1433B9 ON collection.motherboard (chipset_id)'); - $this->addSql('CREATE TABLE collection.motherboard_socket_link (motherboard_id INT NOT NULL, socket_id INT NOT NULL, PRIMARY KEY(motherboard_id, socket_id))'); - $this->addSql('CREATE INDEX IDX_D635BC6D6511E8A3 ON collection.motherboard_socket_link (motherboard_id)'); - $this->addSql('CREATE INDEX IDX_D635BC6DD20E239C ON collection.motherboard_socket_link (socket_id)'); - $this->addSql('ALTER TABLE collection.chipset ADD CONSTRAINT FK_110BAE8044F5D008 FOREIGN KEY (brand_id) REFERENCES collection.brand (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE collection.motherboard ADD CONSTRAINT FK_5C3F5E3144F5D008 FOREIGN KEY (brand_id) REFERENCES collection.brand (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE collection.motherboard ADD CONSTRAINT FK_5C3F5E31BC1433B9 FOREIGN KEY (chipset_id) REFERENCES collection.chipset (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE collection.motherboard_socket_link ADD CONSTRAINT FK_D635BC6D6511E8A3 FOREIGN KEY (motherboard_id) REFERENCES collection.motherboard (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE collection.motherboard_socket_link ADD CONSTRAINT FK_D635BC6DD20E239C FOREIGN KEY (socket_id) REFERENCES collection.socket (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('DROP TABLE collection.battery_type'); - } + public function up(Schema $schema): void + { + // this up() migration is auto-generated, please modify it to your needs + $this->addSql('DROP SEQUENCE collection.battery_type_id_seq CASCADE'); + $this->addSql('CREATE TABLE collection.chipset (id SERIAL NOT NULL, brand_id INT NOT NULL, name VARCHAR(255) NOT NULL, parts VARCHAR(255) NOT NULL, link VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_110BAE8044F5D008 ON collection.chipset (brand_id)'); + $this->addSql('CREATE TABLE collection.motherboard (id SERIAL NOT NULL, brand_id INT NOT NULL, chipset_id INT DEFAULT NULL, model VARCHAR(255) NOT NULL, link VARCHAR(255) NOT NULL, notes TEXT DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_5C3F5E3144F5D008 ON collection.motherboard (brand_id)'); + $this->addSql('CREATE INDEX IDX_5C3F5E31BC1433B9 ON collection.motherboard (chipset_id)'); + $this->addSql('CREATE TABLE collection.motherboard_socket_link (motherboard_id INT NOT NULL, socket_id INT NOT NULL, PRIMARY KEY(motherboard_id, socket_id))'); + $this->addSql('CREATE INDEX IDX_D635BC6D6511E8A3 ON collection.motherboard_socket_link (motherboard_id)'); + $this->addSql('CREATE INDEX IDX_D635BC6DD20E239C ON collection.motherboard_socket_link (socket_id)'); + $this->addSql('ALTER TABLE collection.chipset ADD CONSTRAINT FK_110BAE8044F5D008 FOREIGN KEY (brand_id) REFERENCES collection.brand (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE collection.motherboard ADD CONSTRAINT FK_5C3F5E3144F5D008 FOREIGN KEY (brand_id) REFERENCES collection.brand (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE collection.motherboard ADD CONSTRAINT FK_5C3F5E31BC1433B9 FOREIGN KEY (chipset_id) REFERENCES collection.chipset (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE collection.motherboard_socket_link ADD CONSTRAINT FK_D635BC6D6511E8A3 FOREIGN KEY (motherboard_id) REFERENCES collection.motherboard (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE collection.motherboard_socket_link ADD CONSTRAINT FK_D635BC6DD20E239C FOREIGN KEY (socket_id) REFERENCES collection.socket (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('DROP TABLE collection.battery_type'); + } - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('CREATE SCHEMA public'); - $this->addSql('CREATE SEQUENCE collection.battery_type_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE TABLE collection.battery_type (id SERIAL NOT NULL, PRIMARY KEY(id))'); - $this->addSql('ALTER TABLE collection.chipset DROP CONSTRAINT FK_110BAE8044F5D008'); - $this->addSql('ALTER TABLE collection.motherboard DROP CONSTRAINT FK_5C3F5E3144F5D008'); - $this->addSql('ALTER TABLE collection.motherboard DROP CONSTRAINT FK_5C3F5E31BC1433B9'); - $this->addSql('ALTER TABLE collection.motherboard_socket_link DROP CONSTRAINT FK_D635BC6D6511E8A3'); - $this->addSql('ALTER TABLE collection.motherboard_socket_link DROP CONSTRAINT FK_D635BC6DD20E239C'); - $this->addSql('DROP TABLE collection.chipset'); - $this->addSql('DROP TABLE collection.motherboard'); - $this->addSql('DROP TABLE collection.motherboard_socket_link'); - } + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE SCHEMA public'); + $this->addSql('CREATE SEQUENCE collection.battery_type_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE TABLE collection.battery_type (id SERIAL NOT NULL, PRIMARY KEY(id))'); + $this->addSql('ALTER TABLE collection.chipset DROP CONSTRAINT FK_110BAE8044F5D008'); + $this->addSql('ALTER TABLE collection.motherboard DROP CONSTRAINT FK_5C3F5E3144F5D008'); + $this->addSql('ALTER TABLE collection.motherboard DROP CONSTRAINT FK_5C3F5E31BC1433B9'); + $this->addSql('ALTER TABLE collection.motherboard_socket_link DROP CONSTRAINT FK_D635BC6D6511E8A3'); + $this->addSql('ALTER TABLE collection.motherboard_socket_link DROP CONSTRAINT FK_D635BC6DD20E239C'); + $this->addSql('DROP TABLE collection.chipset'); + $this->addSql('DROP TABLE collection.motherboard'); + $this->addSql('DROP TABLE collection.motherboard_socket_link'); + } } diff --git a/src/Repository/AcquireRepository.php b/src/Repository/AcquireRepository.php index f180acc..a87ccc3 100644 --- a/src/Repository/AcquireRepository.php +++ b/src/Repository/AcquireRepository.php @@ -7,39 +7,43 @@ use Doctrine\ORM\{EntityRepository}; use ReflectionObject; use Throwable; -abstract class AcquireRepository extends EntityRepository -{ - abstract public function reacquire(mixed $currentRecord): void; +abstract class AcquireRepository extends EntityRepository { + abstract public function reacquire(mixed $currentRecord): void; - abstract public function deacquire(mixed $currentRecord): void; + abstract public function deacquire(mixed $currentRecord): void; - /** - * Move a record from the table represented by $currentRecord - * into the table represented by $newRecord - */ - protected function moveRecord(mixed $currentRecord, mixed $newRecord): void - { - $em = $this->getEntityManager(); + /** + * Move a record from the table represented by $currentRecord + * into the table represented by $newRecord + */ + protected function moveRecord(mixed $currentRecord, mixed $newRecord): void + { + $em = $this->getEntityManager(); - $old = new ReflectionObject($currentRecord); - $new = new ReflectionObject($newRecord); + $old = new ReflectionObject($currentRecord); + $new = new ReflectionObject($newRecord); - foreach ($old->getProperties() as $property) { - $propertyName = $property->getName(); - if ($new->hasProperty($propertyName)) { - $newProperty = $new->getProperty($propertyName); - $newProperty->setAccessible(TRUE); - $property->setAccessible(TRUE); - $newProperty->setValue($newRecord, $property->getValue($currentRecord)); - } - } + foreach ($old->getProperties() as $property) + { + $propertyName = $property->getName(); + if ($new->hasProperty($propertyName)) + { + $newProperty = $new->getProperty($propertyName); + $newProperty->setAccessible(TRUE); + $property->setAccessible(TRUE); + $newProperty->setValue($newRecord, $property->getValue($currentRecord)); + } + } - try { - $em->persist($newRecord); - $em->remove($currentRecord); - $em->flush(); - } catch (Throwable) { - dump($newRecord); - } - } + try + { + $em->persist($newRecord); + $em->remove($currentRecord); + $em->flush(); + } + catch (Throwable) + { + dump($newRecord); + } + } } diff --git a/src/Repository/CameraRepository.php b/src/Repository/CameraRepository.php index f7fa76c..c6f95d4 100644 --- a/src/Repository/CameraRepository.php +++ b/src/Repository/CameraRepository.php @@ -5,26 +5,25 @@ namespace App\Repository; use App\Entity\{Camera, PreviouslyOwnedCamera}; use Doctrine\ORM\{ORMInvalidArgumentException}; -class CameraRepository extends AcquireRepository -{ - /** - * @throws ORMInvalidArgumentException - */ - public function deacquire(mixed $currentRecord): void - { - $currentRecord->setFormerlyOwned(TRUE) - ->setReceived(TRUE); +class CameraRepository extends AcquireRepository { + /** + * @throws ORMInvalidArgumentException + */ + public function deacquire(mixed $currentRecord): void + { + $currentRecord->setFormerlyOwned(TRUE) + ->setReceived(TRUE); - $this->moveRecord($currentRecord, new PreviouslyOwnedCamera()); - } + $this->moveRecord($currentRecord, new PreviouslyOwnedCamera()); + } - /** - * @throws ORMInvalidArgumentException - */ - public function reacquire(mixed $currentRecord): void - { - $currentRecord->setFormerlyOwned(FALSE); + /** + * @throws ORMInvalidArgumentException + */ + public function reacquire(mixed $currentRecord): void + { + $currentRecord->setFormerlyOwned(FALSE); - $this->moveRecord($currentRecord, new Camera()); - } + $this->moveRecord($currentRecord, new Camera()); + } } diff --git a/src/Repository/FlashRepository.php b/src/Repository/FlashRepository.php index 029f6bc..9b7c708 100644 --- a/src/Repository/FlashRepository.php +++ b/src/Repository/FlashRepository.php @@ -5,26 +5,25 @@ namespace App\Repository; use App\Entity\{Flash, PreviouslyOwnedFlash}; use Doctrine\ORM\{ORMInvalidArgumentException}; -class FlashRepository extends AcquireRepository -{ - /** - * @throws ORMInvalidArgumentException - */ - public function deacquire(mixed $currentRecord): void - { - $currentRecord->setFormerlyOwned(TRUE) - ->setReceived(TRUE); +class FlashRepository extends AcquireRepository { + /** + * @throws ORMInvalidArgumentException + */ + public function deacquire(mixed $currentRecord): void + { + $currentRecord->setFormerlyOwned(TRUE) + ->setReceived(TRUE); - $this->moveRecord($currentRecord, new PreviouslyOwnedFlash()); - } + $this->moveRecord($currentRecord, new PreviouslyOwnedFlash()); + } - /** - * @throws ORMInvalidArgumentException - */ - public function reacquire(mixed $currentRecord): void - { - $currentRecord->setFormerlyOwned(FALSE); + /** + * @throws ORMInvalidArgumentException + */ + public function reacquire(mixed $currentRecord): void + { + $currentRecord->setFormerlyOwned(FALSE); - $this->moveRecord($currentRecord, new Flash()); - } + $this->moveRecord($currentRecord, new Flash()); + } } diff --git a/src/Repository/LensesRepository.php b/src/Repository/LensesRepository.php index f3fa640..153072a 100644 --- a/src/Repository/LensesRepository.php +++ b/src/Repository/LensesRepository.php @@ -4,20 +4,19 @@ namespace App\Repository; use App\Entity\{Lenses, PreviouslyOwnedLenses}; -class LensesRepository extends AcquireRepository -{ - public function deacquire(mixed $currentRecord): void - { - $currentRecord->setFormerlyOwned(TRUE) - ->setReceived(TRUE); +class LensesRepository extends AcquireRepository { + public function deacquire(mixed $currentRecord): void + { + $currentRecord->setFormerlyOwned(TRUE) + ->setReceived(TRUE); - $this->moveRecord($currentRecord, new PreviouslyOwnedLenses()); - } + $this->moveRecord($currentRecord, new PreviouslyOwnedLenses()); + } - public function reacquire(mixed $currentRecord): void - { - $currentRecord->setFormerlyOwned(FALSE); + public function reacquire(mixed $currentRecord): void + { + $currentRecord->setFormerlyOwned(FALSE); - $this->moveRecord($currentRecord, new Lenses()); - } + $this->moveRecord($currentRecord, new Lenses()); + } } diff --git a/src/Resources/crud/controller/Controller.tpl.php b/src/Resources/crud/controller/Controller.tpl.php index 23c7455..a1f6fde 100644 --- a/src/Resources/crud/controller/Controller.tpl.php +++ b/src/Resources/crud/controller/Controller.tpl.php @@ -32,9 +32,12 @@ class extends AbstractController { generateRouteForControllerMethod('/new', sprintf('%s_new', $route_name), ['GET', 'POST']) ?> - repositoryHasSaveAndRemoveMethods($repository_full_class_name)) { ?> + repositoryHasSaveAndRemoveMethods($repository_full_class_name)) + { ?> public function new(Request $request, $): Response - + public function new(Request $request): Response { @@ -48,9 +51,12 @@ class extends AbstractController { } generateRouteForControllerMethod(sprintf('/{%s}/edit', $entity_identifier), sprintf('%s_edit', $route_name), ['GET', 'POST']) ?> - repositoryHasSaveAndRemoveMethods($repository_full_class_name)) { ?> + repositoryHasSaveAndRemoveMethods($repository_full_class_name)) + { ?> public function edit(Request $request, $, $): Response - + public function edit(Request $request, $): Response { @@ -58,9 +64,12 @@ class extends AbstractController { } generateRouteForControllerMethod(sprintf('/{%s}', $entity_identifier), sprintf('%s_delete', $route_name), ['POST']) ?> - repositoryHasSaveAndRemoveMethods($repository_full_class_name)) { ?> + repositoryHasSaveAndRemoveMethods($repository_full_class_name)) + { ?> public function delete(Request $request, $, $): Response - + public function delete(Request $request, $): Response { diff --git a/src/Types/MoneyType.php b/src/Types/MoneyType.php index df9ce39..adb1abd 100644 --- a/src/Types/MoneyType.php +++ b/src/Types/MoneyType.php @@ -7,25 +7,24 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Types\Type; -class MoneyType extends Type -{ - public function getSQLDeclaration(array $column, AbstractPlatform $platform): string - { - return 'MONEY'; - } +class MoneyType extends Type { + public function getSQLDeclaration(array $column, AbstractPlatform $platform): string + { + return 'MONEY'; + } - public function convertToPHPValue($value, AbstractPlatform $platform): float - { - return (float) (string) new Money($value); - } + public function convertToPHPValue($value, AbstractPlatform $platform): float + { + return (float) (string) new Money($value); + } - public function getName(): string - { - return 'money'; - } + public function getName(): string + { + return 'money'; + } - public function requiresSQLCommentHint(AbstractPlatform $platform): bool - { - return TRUE; - } + public function requiresSQLCommentHint(AbstractPlatform $platform): bool + { + return TRUE; + } } diff --git a/src/ValueObject/Money.php b/src/ValueObject/Money.php index 83f53e1..4bc9074 100644 --- a/src/ValueObject/Money.php +++ b/src/ValueObject/Money.php @@ -4,22 +4,21 @@ namespace App\ValueObject; use Stringable; -class Money implements Stringable -{ - private readonly float $value; +class Money implements Stringable { + private readonly float $value; - public function __construct(mixed $value) - { - $this->value = (float) str_replace(['$', ','], '', (string) $value); - } + public function __construct(mixed $value) + { + $this->value = (float) str_replace(['$', ','], '', (string) $value); + } - public function getValue(): float - { - return (float) str_replace(['$', ','], '', (string) $this->value); - } + public function __toString(): string + { + return (string) $this->getValue(); + } - public function __toString(): string - { - return (string) $this->getValue(); - } + public function getValue(): float + { + return (float) str_replace(['$', ','], '', (string) $this->value); + } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 3f725b7..eb4e2d0 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -4,8 +4,11 @@ use Symfony\Component\Dotenv\Dotenv; require dirname(__DIR__) . '/vendor/autoload.php'; -if (file_exists(dirname(__DIR__) . '/config/bootstrap.php')) { - require dirname(__DIR__) . '/config/bootstrap.php'; -} elseif (method_exists(Dotenv::class, 'bootEnv')) { - (new Dotenv())->bootEnv(dirname(__DIR__) . '/.env'); +if (file_exists(dirname(__DIR__) . '/config/bootstrap.php')) +{ + require dirname(__DIR__) . '/config/bootstrap.php'; +} +elseif (method_exists(Dotenv::class, 'bootEnv')) +{ + (new Dotenv())->bootEnv(dirname(__DIR__) . '/.env'); } diff --git a/tools/common.inc.php b/tools/common.inc.php index b44a2d3..1884f21 100644 --- a/tools/common.inc.php +++ b/tools/common.inc.php @@ -2,7 +2,8 @@ function walk_array(callable $method, array $items): void { - foreach ($items as $item) { - $method($item); - } + foreach ($items as $item) + { + $method($item); + } } diff --git a/translations/messages.en.php b/translations/messages.en.php index 0363e74..115b1fe 100644 --- a/translations/messages.en.php +++ b/translations/messages.en.php @@ -1,92 +1,92 @@ '', - '4x4' => '4x4cm', - '5V 32-bit PCI' => '5V 32-bit PCI', - '5V 64-bit PCI' => '5V 64-bit PCI', - '6x6' => '6x6cm', - '6x4.5' => '6x4.5cm', - '8-bit ISA' => '8-bit ISA', - '16-bit ISA' => '16-bit ISA', - '35mm' => '35mm', - '1.5V AGP' => '1.5V AGP', - '110' => '110', - '120' => '120', - '127' => '127', - '3.3V 32-bit PCI' => '3.3V 32-bit PCI', - '3.3V 64-bit PCI' => '3.3V 64-bit PCI', - '3.3V AGP' => '3.3V AGP', - '3.3V PCI 33' => '3.3V PCI 33', - '620' => '620', - 'Acquired' => 'Acquired', - 'AGP 1x' => 'AGP 1x', - 'AGP 2x' => 'AGP 2x', - 'AGP 4x' => 'AGP 4x', - 'AGP 8x' => 'AGP 8x', - 'AGP' => 'AGP', - 'Alternate model name' => 'Alternate Model Name', - 'Aperture blades' => '# of Aperture Blades', - 'APS-C' => 'APS-C', - 'Architecture link' => 'Architecture Link', - 'Architecture' => 'Architecture', - 'arm' => 'arm', - 'arm64' => 'arm64', - 'B & W' => 'B & W', - 'Base speed' => 'Base Speed', - 'Batteries' => 'Batteries', - 'Battery type' => 'Battery Type', - 'Board brand' => 'GPU Board Brand', - 'Boost speed' => 'Boost Speed', - 'Brand' => 'Brand', - 'Bus interface' => 'Bus Interface', - 'C-41' => 'C-41', - 'Card key' => 'Card Interface Keying', - 'Categories' => 'Categories', - 'Cellulose Triacetate' => 'Cellulose Triacetate', - 'Chemistry' => 'Film Chemistry', - 'Clock speed' => 'Clock Speed (MHz)', - 'Coatings' => 'Coatings', - 'Code name' => 'Codename', - 'Common' => 'Common', - 'Compute units' => 'Compute Units/Cores', - 'Cores' => 'Cores', - 'Count' => 'Count', - 'Crop factor' => 'Crop Factor', - 'Description' => 'Description', - 'Design elements' => '# of Design Elements', - 'Design groups' => '# of Design Groups', - 'Developed rolls' => '# of Developed Rolls', - 'DirectX Support' => 'DirectX Support', - 'DUAL_INLINE_PACKAGE' => 'DIP', - 'E-6' => 'E-6', - 'Film alias' => 'Film Alias', - 'Film base' => 'Film Base', - 'Film format' => 'Film Format', - 'Film name' => 'Film Name', - 'Film speed asa' => 'Film Speed (ASA)', - 'Film speed din' => 'Film Speed (DIN)', - 'Formerly owned' => 'Formerly Owned', - 'Front filter size' => 'Front filter size (mm)', + '' => '', + '4x4' => '4x4cm', + '5V 32-bit PCI' => '5V 32-bit PCI', + '5V 64-bit PCI' => '5V 64-bit PCI', + '6x6' => '6x6cm', + '6x4.5' => '6x4.5cm', + '8-bit ISA' => '8-bit ISA', + '16-bit ISA' => '16-bit ISA', + '35mm' => '35mm', + '1.5V AGP' => '1.5V AGP', + '110' => '110', + '120' => '120', + '127' => '127', + '3.3V 32-bit PCI' => '3.3V 32-bit PCI', + '3.3V 64-bit PCI' => '3.3V 64-bit PCI', + '3.3V AGP' => '3.3V AGP', + '3.3V PCI 33' => '3.3V PCI 33', + '620' => '620', + 'Acquired' => 'Acquired', + 'AGP 1x' => 'AGP 1x', + 'AGP 2x' => 'AGP 2x', + 'AGP 4x' => 'AGP 4x', + 'AGP 8x' => 'AGP 8x', + 'AGP' => 'AGP', + 'Alternate model name' => 'Alternate Model Name', + 'Aperture blades' => '# of Aperture Blades', + 'APS-C' => 'APS-C', + 'Architecture link' => 'Architecture Link', + 'Architecture' => 'Architecture', + 'arm' => 'arm', + 'arm64' => 'arm64', + 'B & W' => 'B & W', + 'Base speed' => 'Base Speed', + 'Batteries' => 'Batteries', + 'Battery type' => 'Battery Type', + 'Board brand' => 'GPU Board Brand', + 'Boost speed' => 'Boost Speed', + 'Brand' => 'Brand', + 'Bus interface' => 'Bus Interface', + 'C-41' => 'C-41', + 'Card key' => 'Card Interface Keying', + 'Categories' => 'Categories', + 'Cellulose Triacetate' => 'Cellulose Triacetate', + 'Chemistry' => 'Film Chemistry', + 'Clock speed' => 'Clock Speed (MHz)', + 'Coatings' => 'Coatings', + 'Code name' => 'Codename', + 'Common' => 'Common', + 'Compute units' => 'Compute Units/Cores', + 'Cores' => 'Cores', + 'Count' => 'Count', + 'Crop factor' => 'Crop Factor', + 'Description' => 'Description', + 'Design elements' => '# of Design Elements', + 'Design groups' => '# of Design Groups', + 'Developed rolls' => '# of Developed Rolls', + 'DirectX Support' => 'DirectX Support', + 'DUAL_INLINE_PACKAGE' => 'DIP', + 'E-6' => 'E-6', + 'Film alias' => 'Film Alias', + 'Film base' => 'Film Base', + 'Film format' => 'Film Format', + 'Film name' => 'Film Name', + 'Film speed asa' => 'Film Speed (ASA)', + 'Film speed din' => 'Film Speed (DIN)', + 'Formerly owned' => 'Formerly Owned', + 'Front filter size' => 'Front filter size (mm)', 'Generation link' => 'Generation Link', 'Generation name' => 'Generation Name', 'GPU Base Clock (MHz)' => 'GPU Base Clock (MHz)', 'GPU Boost Clock (MHz)' => 'GPU Boost Clock (MHz)', 'Gpu brand' => 'GPU Brand', 'Gpu core' => 'GPU Core', - 'Guide number' => 'Guide Number', + 'Guide number' => 'Guide Number', 'Historical' => 'Historical', 'IBM POWER' => 'IBM POWER', 'Igp' => 'IGP', - 'Image size' => 'Image Size', + 'Image size' => 'Image Size', 'Intel 8088' => 'Intel 8088', 'Intel 80186' => 'Intel 80186', - 'Is auto flash' => 'Is auto flash', - 'Is digital' => 'Is Digital', - 'Is p ttl' => 'Is P-TTL', - 'Is teleconverter' => 'Is teleconverter', - 'Is ttl' => 'Is TTL', - 'Is working' => 'Is Working', + 'Is auto flash' => 'Is auto flash', + 'Is digital' => 'Is Digital', + 'Is p ttl' => 'Is P-TTL', + 'Is teleconverter' => 'Is teleconverter', + 'Is ttl' => 'Is TTL', + 'Is working' => 'Is Working', 'ISA' => 'ISA', 'L1 Cache' => 'Level 1 Cache', 'L1 Data (x-way)' => 'L1 Data (x-way)', @@ -109,32 +109,32 @@ return [ 'LEAD_LESS_CHIP_CARRIER' => 'Leadless Chip Carrier', 'Link' => 'Link', 'Lot number' => 'Lot Number', - 'Max f stop' => 'Max aperture (smallest f number)', - 'Max focal length' => 'Max focal length (mm)', - 'Medium Format' => 'Medium Format', + 'Max f stop' => 'Max aperture (smallest f number)', + 'Max focal length' => 'Max focal length (mm)', + 'Medium Format' => 'Medium Format', 'Memory Bus Size (bits)' => 'Memory Bus Size (bits)', 'Memory Size (MB)' => 'Memory Size (MB)', 'Memory Speed (MHz)' => 'Memory Speed (MHz)', 'Memory type' => 'Memory Type', - 'Micro 4/3' => 'μ 4/3', + 'Micro 4/3' => 'μ 4/3', 'Micro architecture' => 'μArchitecture', - 'Min f stop' => 'Min aperture (largest f number)', - 'Min focal length' => 'Min focal length (mm)', + 'Min f stop' => 'Min aperture (largest f number)', + 'Min focal length' => 'Min focal length (mm)', 'MIPS' => 'MIPS', 'Model name' => 'Model Name', - 'Model' => 'Model', + 'Model' => 'Model', 'Molex Power Connectors' => 'Molex Power Connectors', 'MOS 6502' => 'MOS 6502', 'Motorola 68k' => 'Motorola 68k', - 'Mount' => 'Mount', + 'Mount' => 'Mount', 'Name' => 'Name', - 'Notes' => 'Notes', + 'Notes' => 'Notes', 'OpenCL Support' => 'OpenCL Support', 'OpenGL Support' => 'OpenGL Support', 'Other name' => 'Other Name', - 'Other' => 'Other', + 'Other' => 'Other', 'Others' => 'Others', - 'P ttl type' => 'P-TTL Type', + 'P ttl type' => 'P-TTL Type', 'Parts' => 'Parts', 'Part number' => 'Part Number', 'PCI 32-bit' => 'PCI 32-bit', @@ -163,37 +163,37 @@ return [ 'Pin count' => 'Pin Count', 'PIN_GRID_ARRAY' => 'PGA', 'PLASTIC_LEADED_CHIP_CARRIER' => 'Plastic Leaded Chip Carrier', - 'Polyester' => 'Polyester', + 'Polyester' => 'Polyester', 'Polyethylene Naphtalate' => 'Polyethylene Naphtalate', 'PowerPC' => 'PowerPC', 'Process node' => 'Process Node', - 'Product line' => 'Product Line', - 'Purchase price' => 'Purchase Price', - 'Rear filter size' => 'Rear filter size (mm)', - 'Received' => 'Received', + 'Product line' => 'Product Line', + 'Purchase price' => 'Purchase Price', + 'Rear filter size' => 'Rear filter size (mm)', + 'Received' => 'Received', 'RISC V' => 'RISC V', - 'Rolls in camera' => '# of Rolls in a Camera', + 'Rolls in camera' => '# of Rolls in a Camera', 'ROPs' => 'ROPs', - 'Serial' => 'Serial', + 'Serial' => 'Serial', 'Series' => 'Series', 'Shader model' => 'Shader Model', 'Shading units' => 'Shading Units', 'Slot span' => 'Slot Span', 'SLOT' => 'Slot', - 'Small Format' => 'Small Format', + 'Small Format' => 'Small Format', 'Socket' => 'Socket', 'Sockets' => 'Sockets', 'TDP (Watts)' => 'TDP (Watts)', 'Tdp' => 'TDP', 'Threads' => 'Threads', 'TMUs' => 'TMUs', - 'Ttl type' => 'TTL Type', - 'Type' => 'Type', + 'Ttl type' => 'TTL Type', + 'Type' => 'Type', 'Universal 32-bit PCI' => 'Universal 32-bit PCI', 'Universal 64-bit PCI' => 'Universal 64-bit PCI', 'Universal AGP' => 'Universal AGP', 'Unknown' => 'Unknown', - 'Unused rolls' => '# of Unused Rolls', + 'Unused rolls' => '# of Unused Rolls', 'Usable' => 'Usable', 'Variant' => 'Variant', 'VESA Local Bus' => 'VESA Local Bus', diff --git a/translations/validators.en.php b/translations/validators.en.php index 486c92e..39cda14 100644 --- a/translations/validators.en.php +++ b/translations/validators.en.php @@ -1,97 +1,97 @@ 'This value should be false.', - 'This value should be true.' => 'This value should be true.', - 'This value should be of type {{ type }}.' => 'This value should be of type {{ type }}.', - 'This value should be blank.' => 'This value should be blank.', - 'The value you selected is not a valid choice.' => 'The value you selected is not a valid choice.', - 'You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.' => 'You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.', - 'You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.' => 'You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.', - 'One or more of the given values is invalid.' => 'One or more of the given values is invalid.', - 'This field was not expected.' => 'This field was not expected.', - 'This field is missing.' => 'This field is missing.', - 'This value is not a valid date.' => 'This value is not a valid date.', - 'This value is not a valid datetime.' => 'This value is not a valid datetime.', - 'This value is not a valid email address.' => 'This value is not a valid email address.', - 'The file could not be found.' => 'The file could not be found.', - 'The file is not readable.' => 'The file is not readable.', - 'The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.' => 'The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.', - 'The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.' => 'The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.', - 'This value should be {{ limit }} or less.' => 'This value should be {{ limit }} or less.', - 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.' => 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.', - 'This value should be {{ limit }} or more.' => 'This value should be {{ limit }} or more.', - 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.' => 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.', - 'This value should not be blank.' => 'This value should not be blank.', - 'This value should not be null.' => 'This value should not be null.', - 'This value should be null.' => 'This value should be null.', - 'This value is not valid.' => 'This value is not valid.', - 'This value is not a valid time.' => 'This value is not a valid time.', - 'This value is not a valid URL.' => 'This value is not a valid URL.', - 'The two values should be equal.' => 'The two values should be equal.', - 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.' => 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.', - 'The file is too large.' => 'The file is too large.', - 'The file could not be uploaded.' => 'The file could not be uploaded.', - 'This value should be a valid number.' => 'This value should be a valid number.', - 'This file is not a valid image.' => 'This file is not a valid image.', - 'This is not a valid IP address.' => 'This is not a valid IP address.', - 'This value is not a valid language.' => 'This value is not a valid language.', - 'This value is not a valid locale.' => 'This value is not a valid locale.', - 'This value is not a valid country.' => 'This value is not a valid country.', - 'This value is already used.' => 'This value is already used.', - 'The size of the image could not be detected.' => 'The size of the image could not be detected.', - 'The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.' => 'The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.', - 'The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.' => 'The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.', - 'The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.' => 'The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.', - 'The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.' => 'The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.', - 'This value should be the user\'s current password.' => 'This value should be the user\'s current password.', - 'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.' => 'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.', - 'The file was only partially uploaded.' => 'The file was only partially uploaded.', - 'No file was uploaded.' => 'No file was uploaded.', - 'No temporary folder was configured in php.ini.' => 'No temporary folder was configured in php.ini, or the configured folder does not exist.', - 'Cannot write temporary file to disk.' => 'Cannot write temporary file to disk.', - 'A PHP extension caused the upload to fail.' => 'A PHP extension caused the upload to fail.', - 'This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.' => 'This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.', - 'This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.' => 'This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.', - 'This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.' => 'This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.', - 'Invalid card number.' => 'Invalid card number.', - 'Unsupported card type or invalid card number.' => 'Unsupported card type or invalid card number.', - 'This is not a valid International Bank Account Number (IBAN).' => 'This is not a valid International Bank Account Number (IBAN).', - 'This value is not a valid ISBN-10.' => 'This value is not a valid ISBN-10.', - 'This value is not a valid ISBN-13.' => 'This value is not a valid ISBN-13.', - 'This value is neither a valid ISBN-10 nor a valid ISBN-13.' => 'This value is neither a valid ISBN-10 nor a valid ISBN-13.', - 'This value is not a valid ISSN.' => 'This value is not a valid ISSN.', - 'This value is not a valid currency.' => 'This value is not a valid currency.', - 'This value should be equal to {{ compared_value }}.' => 'This value should be equal to {{ compared_value }}.', - 'This value should be greater than {{ compared_value }}.' => 'This value should be greater than {{ compared_value }}.', - 'This value should be greater than or equal to {{ compared_value }}.' => 'This value should be greater than or equal to {{ compared_value }}.', - 'This value should be identical to {{ compared_value_type }} {{ compared_value }}.' => 'This value should be identical to {{ compared_value_type }} {{ compared_value }}.', - 'This value should be less than {{ compared_value }}.' => 'This value should be less than {{ compared_value }}.', - 'This value should be less than or equal to {{ compared_value }}.' => 'This value should be less than or equal to {{ compared_value }}.', - 'This value should not be equal to {{ compared_value }}.' => 'This value should not be equal to {{ compared_value }}.', - 'This value should not be identical to {{ compared_value_type }} {{ compared_value }}.' => 'This value should not be identical to {{ compared_value_type }} {{ compared_value }}.', - 'The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.' => 'The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.', - 'The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.' => 'The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.', - 'The image is square ({{ width }}x{{ height }}px). Square images are not allowed.' => 'The image is square ({{ width }}x{{ height }}px). Square images are not allowed.', - 'The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.' => 'The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.', - 'The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.' => 'The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.', - 'An empty file is not allowed.' => 'An empty file is not allowed.', - 'The host could not be resolved.' => 'The host could not be resolved.', - 'This value does not match the expected {{ charset }} charset.' => 'This value does not match the expected {{ charset }} charset.', - 'This is not a valid Business Identifier Code (BIC).' => 'This is not a valid Business Identifier Code (BIC).', - 'Error' => 'Error', - 'This is not a valid UUID.' => 'This is not a valid UUID.', - 'This value should be a multiple of {{ compared_value }}.' => 'This value should be a multiple of {{ compared_value }}.', - 'This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.' => 'This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.', - 'This value should be valid JSON.' => 'This value should be valid JSON.', - 'This collection should contain only unique elements.' => 'This collection should contain only unique elements.', - 'This value should be positive.' => 'This value should be positive.', - 'This value should be either positive or zero.' => 'This value should be either positive or zero.', - 'This value should be negative.' => 'This value should be negative.', - 'This value should be either negative or zero.' => 'This value should be either negative or zero.', - 'This value is not a valid timezone.' => 'This value is not a valid timezone.', - 'This password has been leaked in a data breach, it must not be used. Please use another password.' => 'This password has been leaked in a data breach, it must not be used. Please use another password.', - 'This form should not contain extra fields.' => 'This form should not contain extra fields.', - 'The uploaded file was too large. Please try to upload a smaller file.' => 'The uploaded file was too large. Please try to upload a smaller file.', - 'The CSRF token is invalid. Please try to resubmit the form.' => 'The CSRF token is invalid. Please try to resubmit the form.', + 'This value should be false.' => 'This value should be false.', + 'This value should be true.' => 'This value should be true.', + 'This value should be of type {{ type }}.' => 'This value should be of type {{ type }}.', + 'This value should be blank.' => 'This value should be blank.', + 'The value you selected is not a valid choice.' => 'The value you selected is not a valid choice.', + 'You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.' => 'You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.', + 'You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.' => 'You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.', + 'One or more of the given values is invalid.' => 'One or more of the given values is invalid.', + 'This field was not expected.' => 'This field was not expected.', + 'This field is missing.' => 'This field is missing.', + 'This value is not a valid date.' => 'This value is not a valid date.', + 'This value is not a valid datetime.' => 'This value is not a valid datetime.', + 'This value is not a valid email address.' => 'This value is not a valid email address.', + 'The file could not be found.' => 'The file could not be found.', + 'The file is not readable.' => 'The file is not readable.', + 'The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.' => 'The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.', + 'The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.' => 'The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.', + 'This value should be {{ limit }} or less.' => 'This value should be {{ limit }} or less.', + 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.' => 'This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.', + 'This value should be {{ limit }} or more.' => 'This value should be {{ limit }} or more.', + 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.' => 'This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.', + 'This value should not be blank.' => 'This value should not be blank.', + 'This value should not be null.' => 'This value should not be null.', + 'This value should be null.' => 'This value should be null.', + 'This value is not valid.' => 'This value is not valid.', + 'This value is not a valid time.' => 'This value is not a valid time.', + 'This value is not a valid URL.' => 'This value is not a valid URL.', + 'The two values should be equal.' => 'The two values should be equal.', + 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.' => 'The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.', + 'The file is too large.' => 'The file is too large.', + 'The file could not be uploaded.' => 'The file could not be uploaded.', + 'This value should be a valid number.' => 'This value should be a valid number.', + 'This file is not a valid image.' => 'This file is not a valid image.', + 'This is not a valid IP address.' => 'This is not a valid IP address.', + 'This value is not a valid language.' => 'This value is not a valid language.', + 'This value is not a valid locale.' => 'This value is not a valid locale.', + 'This value is not a valid country.' => 'This value is not a valid country.', + 'This value is already used.' => 'This value is already used.', + 'The size of the image could not be detected.' => 'The size of the image could not be detected.', + 'The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.' => 'The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.', + 'The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.' => 'The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.', + 'The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.' => 'The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.', + 'The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.' => 'The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.', + 'This value should be the user\'s current password.' => 'This value should be the user\'s current password.', + 'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.' => 'This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.', + 'The file was only partially uploaded.' => 'The file was only partially uploaded.', + 'No file was uploaded.' => 'No file was uploaded.', + 'No temporary folder was configured in php.ini.' => 'No temporary folder was configured in php.ini, or the configured folder does not exist.', + 'Cannot write temporary file to disk.' => 'Cannot write temporary file to disk.', + 'A PHP extension caused the upload to fail.' => 'A PHP extension caused the upload to fail.', + 'This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.' => 'This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.', + 'This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.' => 'This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.', + 'This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.' => 'This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.', + 'Invalid card number.' => 'Invalid card number.', + 'Unsupported card type or invalid card number.' => 'Unsupported card type or invalid card number.', + 'This is not a valid International Bank Account Number (IBAN).' => 'This is not a valid International Bank Account Number (IBAN).', + 'This value is not a valid ISBN-10.' => 'This value is not a valid ISBN-10.', + 'This value is not a valid ISBN-13.' => 'This value is not a valid ISBN-13.', + 'This value is neither a valid ISBN-10 nor a valid ISBN-13.' => 'This value is neither a valid ISBN-10 nor a valid ISBN-13.', + 'This value is not a valid ISSN.' => 'This value is not a valid ISSN.', + 'This value is not a valid currency.' => 'This value is not a valid currency.', + 'This value should be equal to {{ compared_value }}.' => 'This value should be equal to {{ compared_value }}.', + 'This value should be greater than {{ compared_value }}.' => 'This value should be greater than {{ compared_value }}.', + 'This value should be greater than or equal to {{ compared_value }}.' => 'This value should be greater than or equal to {{ compared_value }}.', + 'This value should be identical to {{ compared_value_type }} {{ compared_value }}.' => 'This value should be identical to {{ compared_value_type }} {{ compared_value }}.', + 'This value should be less than {{ compared_value }}.' => 'This value should be less than {{ compared_value }}.', + 'This value should be less than or equal to {{ compared_value }}.' => 'This value should be less than or equal to {{ compared_value }}.', + 'This value should not be equal to {{ compared_value }}.' => 'This value should not be equal to {{ compared_value }}.', + 'This value should not be identical to {{ compared_value_type }} {{ compared_value }}.' => 'This value should not be identical to {{ compared_value_type }} {{ compared_value }}.', + 'The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.' => 'The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}.', + 'The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.' => 'The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}.', + 'The image is square ({{ width }}x{{ height }}px). Square images are not allowed.' => 'The image is square ({{ width }}x{{ height }}px). Square images are not allowed.', + 'The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.' => 'The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed.', + 'The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.' => 'The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed.', + 'An empty file is not allowed.' => 'An empty file is not allowed.', + 'The host could not be resolved.' => 'The host could not be resolved.', + 'This value does not match the expected {{ charset }} charset.' => 'This value does not match the expected {{ charset }} charset.', + 'This is not a valid Business Identifier Code (BIC).' => 'This is not a valid Business Identifier Code (BIC).', + 'Error' => 'Error', + 'This is not a valid UUID.' => 'This is not a valid UUID.', + 'This value should be a multiple of {{ compared_value }}.' => 'This value should be a multiple of {{ compared_value }}.', + 'This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.' => 'This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.', + 'This value should be valid JSON.' => 'This value should be valid JSON.', + 'This collection should contain only unique elements.' => 'This collection should contain only unique elements.', + 'This value should be positive.' => 'This value should be positive.', + 'This value should be either positive or zero.' => 'This value should be either positive or zero.', + 'This value should be negative.' => 'This value should be negative.', + 'This value should be either negative or zero.' => 'This value should be either negative or zero.', + 'This value is not a valid timezone.' => 'This value is not a valid timezone.', + 'This password has been leaked in a data breach, it must not be used. Please use another password.' => 'This password has been leaked in a data breach, it must not be used. Please use another password.', + 'This form should not contain extra fields.' => 'This form should not contain extra fields.', + 'The uploaded file was too large. Please try to upload a smaller file.' => 'The uploaded file was too large. Please try to upload a smaller file.', + 'The CSRF token is invalid. Please try to resubmit the form.' => 'The CSRF token is invalid. Please try to resubmit the form.', ];