From c4916bf0b7826d97238683efa2f551489560f0d2 Mon Sep 17 00:00:00 2001 From: Egoist Date: Sat, 23 Apr 2022 02:17:05 +0300 Subject: [PATCH] Add project --- .codecov.yml | 1 + .editorconfig | 766 ++++++++++++++++++ .gitattributes | 13 + .gitignore | 17 + .styleci.yml | 67 ++ README.md | 95 +++ composer.json | 57 ++ ...22_01_01_100000_create_ts_themes_table.php | 60 ++ ...2_01_01_100001_create_ts_authors_table.php | 55 ++ ..._100002_create_ts_themes_authors_table.php | 52 ++ ...1_01_100003_create_ts_categories_table.php | 53 ++ ...0004_create_ts_themes_categories_table.php | 50 ++ ..._01_01_100005_create_ts_releases_table.php | 59 ++ development.md | 16 + lang/az/suffix.php | 20 + lang/de/suffix.php | 20 + lang/en/suffix.php | 20 + lang/fr/suffix.php | 20 + lang/it/suffix.php | 20 + lang/ja/suffix.php | 20 + lang/ko/suffix.php | 20 + lang/nl/suffix.php | 20 + lang/pl/suffix.php | 20 + lang/ru/suffix.php | 20 + lang/tr/suffix.php | 20 + lang/zh/suffix.php | 20 + phpunit.xml | 32 + src/Directives/NumberDirectives.php | 36 + src/Facades/ReadableNumbers.php | 13 + src/ReadableNumbersServiceProvider.php | 45 + src/Services/ReadableNumbers.php | 69 ++ 31 files changed, 1796 insertions(+) create mode 100644 .codecov.yml create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .styleci.yml create mode 100644 README.md create mode 100644 composer.json create mode 100644 database/migrations/2022_01_01_100000_create_ts_themes_table.php create mode 100644 database/migrations/2022_01_01_100001_create_ts_authors_table.php create mode 100644 database/migrations/2022_01_01_100002_create_ts_themes_authors_table.php create mode 100644 database/migrations/2022_01_01_100003_create_ts_categories_table.php create mode 100644 database/migrations/2022_01_01_100004_create_ts_themes_categories_table.php create mode 100644 database/migrations/2022_01_01_100005_create_ts_releases_table.php create mode 100644 development.md create mode 100644 lang/az/suffix.php create mode 100644 lang/de/suffix.php create mode 100644 lang/en/suffix.php create mode 100644 lang/fr/suffix.php create mode 100644 lang/it/suffix.php create mode 100644 lang/ja/suffix.php create mode 100644 lang/ko/suffix.php create mode 100644 lang/nl/suffix.php create mode 100644 lang/pl/suffix.php create mode 100644 lang/ru/suffix.php create mode 100644 lang/tr/suffix.php create mode 100644 lang/zh/suffix.php create mode 100644 phpunit.xml create mode 100644 src/Directives/NumberDirectives.php create mode 100644 src/Facades/ReadableNumbers.php create mode 100644 src/ReadableNumbersServiceProvider.php create mode 100644 src/Services/ReadableNumbers.php diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..db24720 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1 @@ +comment: off diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ccb65c9 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,766 @@ +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +max_line_length = 160 +tab_width = 4 +trim_trailing_whitespace = true +ij_continuation_indent_size = 8 +ij_formatter_off_tag = @formatter:off +ij_formatter_on_tag = @formatter:on +ij_formatter_tags_enabled = true +ij_smart_tabs = false +ij_visual_guides = none +ij_wrap_on_typing = false + +[*.blade.php] +ij_continuation_indent_size = 4 +ij_blade_keep_indents_on_empty_lines = false + +[*.css] +ij_css_align_closing_brace_with_properties = false +ij_css_blank_lines_around_nested_selector = 1 +ij_css_blank_lines_between_blocks = 1 +ij_css_brace_placement = end_of_line +ij_css_enforce_quotes_on_format = false +ij_css_hex_color_long_format = true +ij_css_hex_color_lower_case = false +ij_css_hex_color_short_format = false +ij_css_hex_color_upper_case = true +ij_css_keep_blank_lines_in_code = 1 +ij_css_keep_indents_on_empty_lines = false +ij_css_keep_single_line_blocks = true +ij_css_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_css_space_after_colon = true +ij_css_space_before_opening_brace = true +ij_css_use_double_quotes = true +ij_css_value_alignment = do_not_align + +[*.haml] +indent_size = 2 +ij_haml_keep_indents_on_empty_lines = false + +[*.less] +indent_size = 2 +ij_less_align_closing_brace_with_properties = false +ij_less_blank_lines_around_nested_selector = 1 +ij_less_blank_lines_between_blocks = 1 +ij_less_brace_placement = 0 +ij_less_enforce_quotes_on_format = false +ij_less_hex_color_long_format = true +ij_less_hex_color_lower_case = false +ij_less_hex_color_short_format = false +ij_less_hex_color_upper_case = true +ij_less_keep_blank_lines_in_code = 2 +ij_less_keep_indents_on_empty_lines = false +ij_less_keep_single_line_blocks = false +ij_less_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_less_space_after_colon = true +ij_less_space_before_opening_brace = true +ij_less_use_double_quotes = true +ij_less_value_alignment = 0 + +[*.sass] +indent_size = 2 +ij_sass_align_closing_brace_with_properties = false +ij_sass_blank_lines_around_nested_selector = 1 +ij_sass_blank_lines_between_blocks = 1 +ij_sass_brace_placement = 0 +ij_sass_enforce_quotes_on_format = false +ij_sass_hex_color_long_format = false +ij_sass_hex_color_lower_case = false +ij_sass_hex_color_short_format = false +ij_sass_hex_color_upper_case = false +ij_sass_keep_blank_lines_in_code = 2 +ij_sass_keep_indents_on_empty_lines = false +ij_sass_keep_single_line_blocks = false +ij_sass_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_sass_space_after_colon = true +ij_sass_space_before_opening_brace = true +ij_sass_use_double_quotes = true +ij_sass_value_alignment = 0 + +[*.scss] +ij_scss_align_closing_brace_with_properties = false +ij_scss_blank_lines_around_nested_selector = 1 +ij_scss_blank_lines_between_blocks = 1 +ij_scss_brace_placement = 0 +ij_scss_enforce_quotes_on_format = true +ij_scss_hex_color_long_format = true +ij_scss_hex_color_lower_case = false +ij_scss_hex_color_short_format = false +ij_scss_hex_color_upper_case = true +ij_scss_keep_blank_lines_in_code = 1 +ij_scss_keep_indents_on_empty_lines = false +ij_scss_keep_single_line_blocks = true +ij_scss_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_scss_space_after_colon = true +ij_scss_space_before_opening_brace = true +ij_scss_use_double_quotes = false +ij_scss_value_alignment = 0 + +[*.twig] +ij_twig_keep_indents_on_empty_lines = false +ij_twig_spaces_inside_comments_delimiters = true +ij_twig_spaces_inside_delimiters = true +ij_twig_spaces_inside_variable_delimiters = true + +[*.vue] +ij_continuation_indent_size = 4 +ij_vue_indent_children_of_top_level = template +ij_vue_interpolation_new_line_after_start_delimiter = true +ij_vue_interpolation_new_line_before_end_delimiter = true +ij_vue_interpolation_wrap = off +ij_vue_keep_indents_on_empty_lines = false +ij_vue_spaces_within_interpolation_expressions = true +ij_vue_uniform_indent = true + +[.editorconfig] +ij_editorconfig_align_group_field_declarations = false +ij_editorconfig_space_after_colon = false +ij_editorconfig_space_after_comma = true +ij_editorconfig_space_before_colon = false +ij_editorconfig_space_before_comma = false +ij_editorconfig_spaces_around_assignment_operators = true + +[{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.rng,*.tld,*.wsdl,*.xml,*.xsd,*.xsl,*.xslt,*.xul,phpunit.xml.dist}] +ij_xml_align_attributes = true +ij_xml_align_text = false +ij_xml_attribute_wrap = normal +ij_xml_block_comment_at_first_column = true +ij_xml_keep_blank_lines = 2 +ij_xml_keep_indents_on_empty_lines = false +ij_xml_keep_line_breaks = true +ij_xml_keep_line_breaks_in_text = true +ij_xml_keep_whitespaces = false +ij_xml_keep_whitespaces_around_cdata = preserve +ij_xml_keep_whitespaces_inside_cdata = false +ij_xml_line_comment_at_first_column = true +ij_xml_space_after_tag_name = false +ij_xml_space_around_equals_in_attribute = false +ij_xml_space_inside_empty_tag = false +ij_xml_text_wrap = normal + +[{*.ats,*.ts}] +ij_continuation_indent_size = 4 +ij_typescript_align_imports = false +ij_typescript_align_multiline_array_initializer_expression = false +ij_typescript_align_multiline_binary_operation = false +ij_typescript_align_multiline_chained_methods = false +ij_typescript_align_multiline_extends_list = false +ij_typescript_align_multiline_for = true +ij_typescript_align_multiline_parameters = true +ij_typescript_align_multiline_parameters_in_calls = false +ij_typescript_align_multiline_ternary_operation = false +ij_typescript_align_object_properties = 0 +ij_typescript_align_union_types = false +ij_typescript_align_var_statements = 0 +ij_typescript_array_initializer_new_line_after_left_brace = false +ij_typescript_array_initializer_right_brace_on_new_line = false +ij_typescript_array_initializer_wrap = off +ij_typescript_assignment_wrap = off +ij_typescript_binary_operation_sign_on_next_line = false +ij_typescript_binary_operation_wrap = off +ij_typescript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/** +ij_typescript_blank_lines_after_imports = 1 +ij_typescript_blank_lines_around_class = 1 +ij_typescript_blank_lines_around_field = 0 +ij_typescript_blank_lines_around_field_in_interface = 0 +ij_typescript_blank_lines_around_function = 1 +ij_typescript_blank_lines_around_method = 1 +ij_typescript_blank_lines_around_method_in_interface = 1 +ij_typescript_block_brace_style = end_of_line +ij_typescript_call_parameters_new_line_after_left_paren = false +ij_typescript_call_parameters_right_paren_on_new_line = false +ij_typescript_call_parameters_wrap = off +ij_typescript_catch_on_new_line = false +ij_typescript_chained_call_dot_on_new_line = true +ij_typescript_class_brace_style = end_of_line +ij_typescript_comma_on_new_line = false +ij_typescript_do_while_brace_force = never +ij_typescript_else_on_new_line = false +ij_typescript_enforce_trailing_comma = keep +ij_typescript_extends_keyword_wrap = off +ij_typescript_extends_list_wrap = off +ij_typescript_field_prefix = _ +ij_typescript_file_name_style = relaxed +ij_typescript_finally_on_new_line = false +ij_typescript_for_brace_force = never +ij_typescript_for_statement_new_line_after_left_paren = false +ij_typescript_for_statement_right_paren_on_new_line = false +ij_typescript_for_statement_wrap = off +ij_typescript_force_quote_style = false +ij_typescript_force_semicolon_style = false +ij_typescript_function_expression_brace_style = end_of_line +ij_typescript_if_brace_force = never +ij_typescript_import_merge_members = global +ij_typescript_import_prefer_absolute_path = global +ij_typescript_import_sort_members = true +ij_typescript_import_sort_module_name = false +ij_typescript_import_use_node_resolution = true +ij_typescript_imports_wrap = on_every_item +ij_typescript_indent_case_from_switch = true +ij_typescript_indent_chained_calls = true +ij_typescript_indent_package_children = 0 +ij_typescript_jsdoc_include_types = false +ij_typescript_jsx_attribute_value = braces +ij_typescript_keep_blank_lines_in_code = 2 +ij_typescript_keep_first_column_comment = true +ij_typescript_keep_indents_on_empty_lines = false +ij_typescript_keep_line_breaks = true +ij_typescript_keep_simple_blocks_in_one_line = false +ij_typescript_keep_simple_methods_in_one_line = false +ij_typescript_line_comment_add_space = true +ij_typescript_line_comment_at_first_column = false +ij_typescript_method_brace_style = end_of_line +ij_typescript_method_call_chain_wrap = off +ij_typescript_method_parameters_new_line_after_left_paren = false +ij_typescript_method_parameters_right_paren_on_new_line = false +ij_typescript_method_parameters_wrap = off +ij_typescript_object_literal_wrap = on_every_item +ij_typescript_parentheses_expression_new_line_after_left_paren = false +ij_typescript_parentheses_expression_right_paren_on_new_line = false +ij_typescript_place_assignment_sign_on_next_line = false +ij_typescript_prefer_as_type_cast = false +ij_typescript_prefer_explicit_types_function_expression_returns = false +ij_typescript_prefer_explicit_types_function_returns = false +ij_typescript_prefer_explicit_types_vars_fields = false +ij_typescript_prefer_parameters_wrap = false +ij_typescript_reformat_c_style_comments = false +ij_typescript_space_after_colon = true +ij_typescript_space_after_comma = true +ij_typescript_space_after_dots_in_rest_parameter = false +ij_typescript_space_after_generator_mult = true +ij_typescript_space_after_property_colon = true +ij_typescript_space_after_quest = true +ij_typescript_space_after_type_colon = true +ij_typescript_space_after_unary_not = false +ij_typescript_space_before_async_arrow_lparen = true +ij_typescript_space_before_catch_keyword = true +ij_typescript_space_before_catch_left_brace = true +ij_typescript_space_before_catch_parentheses = true +ij_typescript_space_before_class_lbrace = true +ij_typescript_space_before_class_left_brace = true +ij_typescript_space_before_colon = true +ij_typescript_space_before_comma = false +ij_typescript_space_before_do_left_brace = true +ij_typescript_space_before_else_keyword = true +ij_typescript_space_before_else_left_brace = true +ij_typescript_space_before_finally_keyword = true +ij_typescript_space_before_finally_left_brace = true +ij_typescript_space_before_for_left_brace = true +ij_typescript_space_before_for_parentheses = true +ij_typescript_space_before_for_semicolon = false +ij_typescript_space_before_function_left_parenth = true +ij_typescript_space_before_generator_mult = false +ij_typescript_space_before_if_left_brace = true +ij_typescript_space_before_if_parentheses = true +ij_typescript_space_before_method_call_parentheses = false +ij_typescript_space_before_method_left_brace = true +ij_typescript_space_before_method_parentheses = false +ij_typescript_space_before_property_colon = false +ij_typescript_space_before_quest = true +ij_typescript_space_before_switch_left_brace = true +ij_typescript_space_before_switch_parentheses = true +ij_typescript_space_before_try_left_brace = true +ij_typescript_space_before_type_colon = false +ij_typescript_space_before_unary_not = false +ij_typescript_space_before_while_keyword = true +ij_typescript_space_before_while_left_brace = true +ij_typescript_space_before_while_parentheses = true +ij_typescript_spaces_around_additive_operators = true +ij_typescript_spaces_around_arrow_function_operator = true +ij_typescript_spaces_around_assignment_operators = true +ij_typescript_spaces_around_bitwise_operators = true +ij_typescript_spaces_around_equality_operators = true +ij_typescript_spaces_around_logical_operators = true +ij_typescript_spaces_around_multiplicative_operators = true +ij_typescript_spaces_around_relational_operators = true +ij_typescript_spaces_around_shift_operators = true +ij_typescript_spaces_around_unary_operator = false +ij_typescript_spaces_within_array_initializer_brackets = false +ij_typescript_spaces_within_brackets = false +ij_typescript_spaces_within_catch_parentheses = false +ij_typescript_spaces_within_for_parentheses = false +ij_typescript_spaces_within_if_parentheses = false +ij_typescript_spaces_within_imports = false +ij_typescript_spaces_within_interpolation_expressions = false +ij_typescript_spaces_within_method_call_parentheses = false +ij_typescript_spaces_within_method_parentheses = false +ij_typescript_spaces_within_object_literal_braces = false +ij_typescript_spaces_within_object_type_braces = true +ij_typescript_spaces_within_parentheses = false +ij_typescript_spaces_within_switch_parentheses = false +ij_typescript_spaces_within_type_assertion = false +ij_typescript_spaces_within_union_types = true +ij_typescript_spaces_within_while_parentheses = false +ij_typescript_special_else_if_treatment = true +ij_typescript_ternary_operation_signs_on_next_line = false +ij_typescript_ternary_operation_wrap = off +ij_typescript_union_types_wrap = on_every_item +ij_typescript_use_chained_calls_group_indents = false +ij_typescript_use_double_quotes = true +ij_typescript_use_explicit_js_extension = global +ij_typescript_use_path_mapping = always +ij_typescript_use_public_modifier = false +ij_typescript_use_semicolon_after_statement = true +ij_typescript_var_declaration_wrap = normal +ij_typescript_while_brace_force = never +ij_typescript_while_on_new_line = false +ij_typescript_wrap_comments = false + +[{*.bash,*.sh,*.zsh}] +ij_shell_binary_ops_start_line = false +ij_shell_keep_column_alignment_padding = false +ij_shell_minify_program = false +ij_shell_redirect_followed_by_space = false +ij_shell_switch_cases_indented = false + +[{*.cjs,*.js}] +ij_continuation_indent_size = 4 +ij_javascript_align_imports = false +ij_javascript_align_multiline_array_initializer_expression = false +ij_javascript_align_multiline_binary_operation = false +ij_javascript_align_multiline_chained_methods = false +ij_javascript_align_multiline_extends_list = false +ij_javascript_align_multiline_for = true +ij_javascript_align_multiline_parameters = true +ij_javascript_align_multiline_parameters_in_calls = false +ij_javascript_align_multiline_ternary_operation = false +ij_javascript_align_object_properties = 0 +ij_javascript_align_union_types = false +ij_javascript_align_var_statements = 1 +ij_javascript_array_initializer_new_line_after_left_brace = true +ij_javascript_array_initializer_right_brace_on_new_line = true +ij_javascript_array_initializer_wrap = on_every_item +ij_javascript_assignment_wrap = off +ij_javascript_binary_operation_sign_on_next_line = false +ij_javascript_binary_operation_wrap = off +ij_javascript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/** +ij_javascript_blank_lines_after_imports = 1 +ij_javascript_blank_lines_around_class = 1 +ij_javascript_blank_lines_around_field = 0 +ij_javascript_blank_lines_around_function = 1 +ij_javascript_blank_lines_around_method = 1 +ij_javascript_block_brace_style = end_of_line +ij_javascript_call_parameters_new_line_after_left_paren = false +ij_javascript_call_parameters_right_paren_on_new_line = false +ij_javascript_call_parameters_wrap = off +ij_javascript_catch_on_new_line = false +ij_javascript_chained_call_dot_on_new_line = true +ij_javascript_class_brace_style = next_line +ij_javascript_comma_on_new_line = false +ij_javascript_do_while_brace_force = never +ij_javascript_else_on_new_line = false +ij_javascript_enforce_trailing_comma = remove +ij_javascript_extends_keyword_wrap = off +ij_javascript_extends_list_wrap = off +ij_javascript_field_prefix = _ +ij_javascript_file_name_style = lisp_case +ij_javascript_finally_on_new_line = false +ij_javascript_for_brace_force = never +ij_javascript_for_statement_new_line_after_left_paren = false +ij_javascript_for_statement_right_paren_on_new_line = false +ij_javascript_for_statement_wrap = off +ij_javascript_force_quote_style = true +ij_javascript_force_semicolon_style = true +ij_javascript_function_expression_brace_style = end_of_line +ij_javascript_if_brace_force = never +ij_javascript_import_merge_members = global +ij_javascript_import_prefer_absolute_path = true +ij_javascript_import_sort_members = true +ij_javascript_import_sort_module_name = false +ij_javascript_import_use_node_resolution = true +ij_javascript_imports_wrap = on_every_item +ij_javascript_indent_case_from_switch = true +ij_javascript_indent_chained_calls = true +ij_javascript_indent_package_children = 0 +ij_javascript_jsx_attribute_value = braces +ij_javascript_keep_blank_lines_in_code = 2 +ij_javascript_keep_first_column_comment = true +ij_javascript_keep_indents_on_empty_lines = false +ij_javascript_keep_line_breaks = true +ij_javascript_keep_simple_blocks_in_one_line = false +ij_javascript_keep_simple_methods_in_one_line = false +ij_javascript_line_comment_add_space = false +ij_javascript_line_comment_at_first_column = false +ij_javascript_method_brace_style = end_of_line +ij_javascript_method_call_chain_wrap = off +ij_javascript_method_parameters_new_line_after_left_paren = false +ij_javascript_method_parameters_right_paren_on_new_line = false +ij_javascript_method_parameters_wrap = off +ij_javascript_object_literal_wrap = on_every_item +ij_javascript_parentheses_expression_new_line_after_left_paren = false +ij_javascript_parentheses_expression_right_paren_on_new_line = false +ij_javascript_place_assignment_sign_on_next_line = false +ij_javascript_prefer_as_type_cast = false +ij_javascript_prefer_explicit_types_function_expression_returns = false +ij_javascript_prefer_explicit_types_function_returns = false +ij_javascript_prefer_explicit_types_vars_fields = false +ij_javascript_prefer_parameters_wrap = false +ij_javascript_reformat_c_style_comments = false +ij_javascript_space_after_colon = true +ij_javascript_space_after_comma = true +ij_javascript_space_after_dots_in_rest_parameter = false +ij_javascript_space_after_generator_mult = true +ij_javascript_space_after_property_colon = true +ij_javascript_space_after_quest = true +ij_javascript_space_after_type_colon = true +ij_javascript_space_after_unary_not = true +ij_javascript_space_before_async_arrow_lparen = true +ij_javascript_space_before_catch_keyword = true +ij_javascript_space_before_catch_left_brace = true +ij_javascript_space_before_catch_parentheses = true +ij_javascript_space_before_class_lbrace = true +ij_javascript_space_before_class_left_brace = true +ij_javascript_space_before_colon = true +ij_javascript_space_before_comma = false +ij_javascript_space_before_do_left_brace = true +ij_javascript_space_before_else_keyword = true +ij_javascript_space_before_else_left_brace = true +ij_javascript_space_before_finally_keyword = true +ij_javascript_space_before_finally_left_brace = true +ij_javascript_space_before_for_left_brace = true +ij_javascript_space_before_for_parentheses = true +ij_javascript_space_before_for_semicolon = false +ij_javascript_space_before_function_left_parenth = true +ij_javascript_space_before_generator_mult = false +ij_javascript_space_before_if_left_brace = true +ij_javascript_space_before_if_parentheses = true +ij_javascript_space_before_method_call_parentheses = false +ij_javascript_space_before_method_left_brace = true +ij_javascript_space_before_method_parentheses = false +ij_javascript_space_before_property_colon = false +ij_javascript_space_before_quest = true +ij_javascript_space_before_switch_left_brace = true +ij_javascript_space_before_switch_parentheses = true +ij_javascript_space_before_try_left_brace = true +ij_javascript_space_before_type_colon = false +ij_javascript_space_before_unary_not = false +ij_javascript_space_before_while_keyword = true +ij_javascript_space_before_while_left_brace = true +ij_javascript_space_before_while_parentheses = true +ij_javascript_spaces_around_additive_operators = true +ij_javascript_spaces_around_arrow_function_operator = true +ij_javascript_spaces_around_assignment_operators = true +ij_javascript_spaces_around_bitwise_operators = true +ij_javascript_spaces_around_equality_operators = true +ij_javascript_spaces_around_logical_operators = true +ij_javascript_spaces_around_multiplicative_operators = true +ij_javascript_spaces_around_relational_operators = true +ij_javascript_spaces_around_shift_operators = true +ij_javascript_spaces_around_unary_operator = false +ij_javascript_spaces_within_array_initializer_brackets = false +ij_javascript_spaces_within_brackets = false +ij_javascript_spaces_within_catch_parentheses = false +ij_javascript_spaces_within_for_parentheses = false +ij_javascript_spaces_within_if_parentheses = false +ij_javascript_spaces_within_imports = true +ij_javascript_spaces_within_interpolation_expressions = true +ij_javascript_spaces_within_method_call_parentheses = false +ij_javascript_spaces_within_method_parentheses = false +ij_javascript_spaces_within_object_literal_braces = true +ij_javascript_spaces_within_object_type_braces = true +ij_javascript_spaces_within_parentheses = false +ij_javascript_spaces_within_switch_parentheses = false +ij_javascript_spaces_within_type_assertion = false +ij_javascript_spaces_within_union_types = true +ij_javascript_spaces_within_while_parentheses = false +ij_javascript_special_else_if_treatment = true +ij_javascript_ternary_operation_signs_on_next_line = false +ij_javascript_ternary_operation_wrap = off +ij_javascript_union_types_wrap = on_every_item +ij_javascript_use_chained_calls_group_indents = true +ij_javascript_use_double_quotes = false +ij_javascript_use_explicit_js_extension = global +ij_javascript_use_path_mapping = always +ij_javascript_use_public_modifier = false +ij_javascript_use_semicolon_after_statement = true +ij_javascript_var_declaration_wrap = on_every_item +ij_javascript_while_brace_force = never +ij_javascript_while_on_new_line = false +ij_javascript_wrap_comments = false + +[{*.ctp,*.hphp,*.inc,*.module,*.php,*.php4,*.php5,*.phtml}] +ij_continuation_indent_size = 4 +ij_php_align_assignments = true +ij_php_align_class_constants = false +ij_php_align_group_field_declarations = false +ij_php_align_inline_comments = true +ij_php_align_key_value_pairs = true +ij_php_align_multiline_array_initializer_expression = true +ij_php_align_multiline_binary_operation = false +ij_php_align_multiline_chained_methods = false +ij_php_align_multiline_extends_list = false +ij_php_align_multiline_for = false +ij_php_align_multiline_parameters = false +ij_php_align_multiline_parameters_in_calls = false +ij_php_align_multiline_ternary_operation = false +ij_php_align_phpdoc_comments = false +ij_php_align_phpdoc_param_names = false +ij_php_anonymous_brace_style = end_of_line +ij_php_api_weight = 28 +ij_php_array_initializer_new_line_after_left_brace = true +ij_php_array_initializer_right_brace_on_new_line = true +ij_php_array_initializer_wrap = on_every_item +ij_php_assignment_wrap = on_every_item +ij_php_attributes_wrap = split_into_lines +ij_php_author_weight = 3 +ij_php_binary_operation_sign_on_next_line = false +ij_php_binary_operation_wrap = on_every_item +ij_php_blank_lines_after_class_header = 0 +ij_php_blank_lines_after_function = 1 +ij_php_blank_lines_after_imports = 1 +ij_php_blank_lines_after_opening_tag = 0 +ij_php_blank_lines_after_package = 1 +ij_php_blank_lines_around_class = 1 +ij_php_blank_lines_around_constants = 1 +ij_php_blank_lines_around_field = 1 +ij_php_blank_lines_around_method = 1 +ij_php_blank_lines_before_class_end = 0 +ij_php_blank_lines_before_imports = 1 +ij_php_blank_lines_before_method_body = 0 +ij_php_blank_lines_before_package = 1 +ij_php_blank_lines_before_return_statement = 1 +ij_php_blank_lines_between_imports = 1 +ij_php_block_brace_style = end_of_line +ij_php_call_parameters_new_line_after_left_paren = false +ij_php_call_parameters_right_paren_on_new_line = false +ij_php_call_parameters_wrap = normal +ij_php_catch_on_new_line = true +ij_php_category_weight = 28 +ij_php_class_brace_style = next_line +ij_php_comma_after_last_array_element = true +ij_php_concat_spaces = true +ij_php_copyright_weight = 28 +ij_php_deprecated_weight = 0 +ij_php_do_while_brace_force = always +ij_php_else_if_style = combine +ij_php_else_on_new_line = false +ij_php_example_weight = 28 +ij_php_extends_keyword_wrap = normal +ij_php_extends_list_wrap = off +ij_php_fields_default_visibility = protected +ij_php_filesource_weight = 28 +ij_php_finally_on_new_line = true +ij_php_for_brace_force = always +ij_php_for_statement_new_line_after_left_paren = false +ij_php_for_statement_right_paren_on_new_line = false +ij_php_for_statement_wrap = normal +ij_php_force_short_declaration_array_style = true +ij_php_getters_setters_naming_style = camel_case +ij_php_getters_setters_order_style = getters_first +ij_php_global_weight = 28 +ij_php_group_use_wrap = on_every_item +ij_php_if_brace_force = always +ij_php_if_lparen_on_next_line = false +ij_php_if_rparen_on_next_line = false +ij_php_ignore_weight = 28 +ij_php_import_sorting = alphabetic +ij_php_indent_break_from_case = true +ij_php_indent_case_from_switch = true +ij_php_indent_code_in_php_tags = false +ij_php_internal_weight = 28 +ij_php_keep_blank_lines_after_lbrace = 1 +ij_php_keep_blank_lines_before_right_brace = 0 +ij_php_keep_blank_lines_in_code = 1 +ij_php_keep_blank_lines_in_declarations = 0 +ij_php_keep_control_statement_in_one_line = true +ij_php_keep_first_column_comment = true +ij_php_keep_indents_on_empty_lines = false +ij_php_keep_line_breaks = true +ij_php_keep_rparen_and_lbrace_on_one_line = true +ij_php_keep_simple_classes_in_one_line = true +ij_php_keep_simple_methods_in_one_line = false +ij_php_lambda_brace_style = end_of_line +ij_php_license_weight = 28 +ij_php_line_comment_add_space = true +ij_php_line_comment_at_first_column = false +ij_php_link_weight = 2 +ij_php_lower_case_boolean_const = true +ij_php_lower_case_keywords = true +ij_php_lower_case_null_const = true +ij_php_method_brace_style = next_line +ij_php_method_call_chain_wrap = on_every_item +ij_php_method_parameters_new_line_after_left_paren = true +ij_php_method_parameters_right_paren_on_new_line = true +ij_php_method_parameters_wrap = normal +ij_php_method_weight = 8 +ij_php_modifier_list_wrap = false +ij_php_multiline_chained_calls_semicolon_on_new_line = false +ij_php_namespace_brace_style = 2 +ij_php_new_line_after_php_opening_tag = true +ij_php_null_type_position = in_the_end +ij_php_package_weight = 28 +ij_php_param_weight = 4 +ij_php_parameters_attributes_wrap = off +ij_php_parentheses_expression_new_line_after_left_paren = false +ij_php_parentheses_expression_right_paren_on_new_line = false +ij_php_phpdoc_blank_line_before_tags = true +ij_php_phpdoc_blank_lines_around_parameters = true +ij_php_phpdoc_keep_blank_lines = true +ij_php_phpdoc_param_spaces_between_name_and_description = 2 +ij_php_phpdoc_param_spaces_between_tag_and_type = 2 +ij_php_phpdoc_param_spaces_between_type_and_name = 2 +ij_php_phpdoc_use_fqcn = true +ij_php_phpdoc_wrap_long_lines = true +ij_php_place_assignment_sign_on_next_line = false +ij_php_place_parens_for_constructor = 0 +ij_php_property_read_weight = 6 +ij_php_property_weight = 5 +ij_php_property_write_weight = 7 +ij_php_return_type_on_new_line = false +ij_php_return_weight = 10 +ij_php_see_weight = 1 +ij_php_since_weight = 28 +ij_php_sort_phpdoc_elements = true +ij_php_space_after_colon = true +ij_php_space_after_colon_in_named_argument = true +ij_php_space_after_colon_in_return_type = true +ij_php_space_after_comma = true +ij_php_space_after_for_semicolon = true +ij_php_space_after_quest = true +ij_php_space_after_type_cast = true +ij_php_space_after_unary_not = true +ij_php_space_before_array_initializer_left_brace = true +ij_php_space_before_catch_keyword = true +ij_php_space_before_catch_left_brace = true +ij_php_space_before_catch_parentheses = true +ij_php_space_before_class_left_brace = true +ij_php_space_before_closure_left_parenthesis = true +ij_php_space_before_colon = true +ij_php_space_before_colon_in_named_argument = false +ij_php_space_before_colon_in_return_type = false +ij_php_space_before_comma = false +ij_php_space_before_do_left_brace = true +ij_php_space_before_else_keyword = true +ij_php_space_before_else_left_brace = true +ij_php_space_before_finally_keyword = true +ij_php_space_before_finally_left_brace = true +ij_php_space_before_for_left_brace = true +ij_php_space_before_for_parentheses = true +ij_php_space_before_for_semicolon = false +ij_php_space_before_if_left_brace = true +ij_php_space_before_if_parentheses = true +ij_php_space_before_method_call_parentheses = false +ij_php_space_before_method_left_brace = true +ij_php_space_before_method_parentheses = false +ij_php_space_before_quest = true +ij_php_space_before_short_closure_left_parenthesis = true +ij_php_space_before_switch_left_brace = true +ij_php_space_before_switch_parentheses = true +ij_php_space_before_try_left_brace = true +ij_php_space_before_unary_not = false +ij_php_space_before_while_keyword = true +ij_php_space_before_while_left_brace = true +ij_php_space_before_while_parentheses = true +ij_php_space_between_ternary_quest_and_colon = false +ij_php_spaces_around_additive_operators = true +ij_php_spaces_around_arrow = false +ij_php_spaces_around_assignment_in_declare = true +ij_php_spaces_around_assignment_operators = true +ij_php_spaces_around_bitwise_operators = true +ij_php_spaces_around_equality_operators = true +ij_php_spaces_around_logical_operators = true +ij_php_spaces_around_multiplicative_operators = true +ij_php_spaces_around_null_coalesce_operator = true +ij_php_spaces_around_relational_operators = true +ij_php_spaces_around_shift_operators = true +ij_php_spaces_around_unary_operator = false +ij_php_spaces_around_var_within_brackets = false +ij_php_spaces_within_array_initializer_braces = false +ij_php_spaces_within_brackets = false +ij_php_spaces_within_catch_parentheses = false +ij_php_spaces_within_for_parentheses = false +ij_php_spaces_within_if_parentheses = false +ij_php_spaces_within_method_call_parentheses = false +ij_php_spaces_within_method_parentheses = false +ij_php_spaces_within_parentheses = false +ij_php_spaces_within_short_echo_tags = true +ij_php_spaces_within_switch_parentheses = false +ij_php_spaces_within_while_parentheses = false +ij_php_special_else_if_treatment = false +ij_php_subpackage_weight = 28 +ij_php_ternary_operation_signs_on_next_line = true +ij_php_ternary_operation_wrap = on_every_item +ij_php_throws_weight = 9 +ij_php_todo_weight = 28 +ij_php_unknown_tag_weight = 28 +ij_php_upper_case_boolean_const = false +ij_php_upper_case_null_const = false +ij_php_uses_weight = 28 +ij_php_var_weight = 28 +ij_php_variable_naming_style = snake_case +ij_php_version_weight = 28 +ij_php_while_brace_force = always +ij_php_while_on_new_line = true + +[{*.har,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.stylelintrc,bowerrc,composer.lock,jest.config}] +ij_continuation_indent_size = 4 +ij_json_keep_blank_lines_in_code = 1 +ij_json_keep_indents_on_empty_lines = false +ij_json_keep_line_breaks = true +ij_json_space_after_colon = true +ij_json_space_after_comma = true +ij_json_space_before_colon = true +ij_json_space_before_comma = false +ij_json_spaces_within_braces = false +ij_json_spaces_within_brackets = false +ij_json_wrap_long_lines = false + +[{*.htm,*.html,*.sht,*.shtm,*.shtml}] +ij_continuation_indent_size = 4 +ij_visual_guides = 160 +ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 +ij_html_align_attributes = false +ij_html_align_text = false +ij_html_attribute_wrap = on_every_item +ij_html_block_comment_at_first_column = true +ij_html_do_not_align_children_of_min_lines = 0 +ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p +ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot +ij_html_enforce_quotes = true +ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var +ij_html_keep_blank_lines = 2 +ij_html_keep_indents_on_empty_lines = false +ij_html_keep_line_breaks = true +ij_html_keep_line_breaks_in_text = true +ij_html_keep_whitespaces = false +ij_html_keep_whitespaces_inside = span,pre,textarea +ij_html_line_comment_at_first_column = true +ij_html_new_line_after_last_attribute = never +ij_html_new_line_before_first_attribute = when multiline +ij_html_quote_style = double +ij_html_remove_new_line_before_tags = br +ij_html_space_after_tag_name = false +ij_html_space_around_equality_in_attribute = false +ij_html_space_inside_empty_tag = true +ij_html_text_wrap = off +ij_html_uniform_ident = false + +[{*.markdown,*.md}] +ij_markdown_force_one_space_after_blockquote_symbol = true +ij_markdown_force_one_space_after_header_symbol = true +ij_markdown_force_one_space_after_list_bullet = true +ij_markdown_force_one_space_between_words = true +ij_markdown_keep_indents_on_empty_lines = false +ij_markdown_max_lines_around_block_elements = 1 +ij_markdown_max_lines_around_header = 1 +ij_markdown_max_lines_between_paragraphs = 1 +ij_markdown_min_lines_around_block_elements = 1 +ij_markdown_min_lines_around_header = 2 +ij_markdown_min_lines_between_paragraphs = 1 + +[{*.yaml,*.yml}] +ij_yaml_align_values_properties = do_not_align +ij_yaml_autoinsert_sequence_marker = true +ij_yaml_block_mapping_on_new_line = false +ij_yaml_indent_sequence_value = true +ij_yaml_keep_indents_on_empty_lines = false +ij_yaml_keep_line_breaks = true +ij_yaml_sequence_on_new_line = true +ij_yaml_space_before_colon = false +ij_yaml_spaces_within_braces = true +ij_yaml_spaces_within_brackets = true diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..949650b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,13 @@ +* text=auto + +.github/ export-ignore +tests/ export-ignore + +.codecov.yml export-ignore +.editorconfig export-ignore +.gitattributes export-ignore +.gitignore export-ignore +.scrutinizer.yml export-ignore +.styleci.yml export-ignore + +phpunit.xml export-ignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bb09f88 --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +.idea/ + +build/ +node_modules/ +vendor/ + +*.bak +*.cache +*.clover +*.orig + +*.lock + +mix-manifest.json + +resources/apps/ +.vscode/settings.json diff --git a/.styleci.yml b/.styleci.yml new file mode 100644 index 0000000..cb07b4b --- /dev/null +++ b/.styleci.yml @@ -0,0 +1,67 @@ +preset: psr12 + +risky: true + +enabled: + - align_double_arrow + - align_equals + - align_phpdoc + - alpha_ordered_imports + - binary_operator_spaces + - blank_line_before_continue + - blank_line_before_declare + - blank_line_before_return + - blank_line_before_throw + - blank_line_before_try + - cast_spaces + - combine_consecutive_issets + - const_separation + - dir_constant + - fully_qualified_strict_types + - logical_operators + - method_separation + - no_alias_functions + - no_blank_lines_after_phpdoc + - no_blank_lines_between_traits + - no_empty_comment + - no_empty_phpdoc + - no_extra_block_blank_lines + - no_extra_consecutive_blank_lines + - no_short_bool_cast + - no_trailing_comma_in_singleline_array + - no_unneeded_control_parentheses + - no_unused_imports + - ordered_class_elements + - php_unit_construct + - php_unit_fqcn_annotation + - phpdoc_indent + - phpdoc_inline_tag + - phpdoc_link_to_see + - phpdoc_no_access + - phpdoc_no_empty_return + - phpdoc_no_package + - phpdoc_no_useless_inheritdoc + - phpdoc_order + - phpdoc_property + - phpdoc_return_self_reference + - phpdoc_scalar + - phpdoc_separation + - phpdoc_summary + - phpdoc_to_comment + - phpdoc_trim + - phpdoc_type_to_var + - phpdoc_types + - phpdoc_types_order + - phpdoc_var_without_name + - property_separation + - self_accessor + - short_array_syntax + - short_list_syntax + - single_line_class_definition + - single_line_throw + - single_quote + - space_after_semicolon + - standardize_not_equals + - ternary_to_null_coalescing + - trailing_comma_in_multiline_array + - trim_array_spaces diff --git a/README.md b/README.md new file mode 100644 index 0000000..7b3f353 --- /dev/null +++ b/README.md @@ -0,0 +1,95 @@ +# Readable Numbers + +[![EgoistDeveloper Readable Numbers](https://preview.dragon-code.pro/EgoistDeveloper/Readable-Numbers.svg?brand=laravel)](https://github.com/laravel-ready/readable-numbers) + +[![Stable Version][badge_stable]][link_packagist] +[![Unstable Version][badge_unstable]][link_packagist] +[![Total Downloads][badge_downloads]][link_packagist] +[![License][badge_license]][link_license] + +Human readable numbers for Laravel. In some cases, you may need to format numbers in a way that is easier to read. Especially when you are dealing with numbers that are very large, for example we want to show page views and we have `100000000` views. So we can show it in the `100M` format. + +## Installation + +```bash +composer require laravel-ready/readable-numbers +``` + +## Thresholds + +| Threshold | Suffix | Result | +| ------------------ | ----------- | ------ | +| 900 | | 900 | +| 900.000 | k | 0.9 K | +| 900.000.000 | m | 0.9 M | +| 900.000.000.000 | b | 9 T | +| 90.000.000.000.000 | t | 900 T | + +## Usages + +`make` method takes 3 aguments: `make(float $value, int $decimals = 1, $lang = null)` + + +### Service Example + +```php + +use LaravelReady\ReadableNumbers\Services\ReadableNumbers; + +... + +$readableNumber = ReadableNumbers::make(123456789); // 123.5 M +$readableNumber = ReadableNumbers::make(-123456789); // -123.5 M + +// with more decimals +$readableNumber = ReadableNumbers::make(123456789, 2); // 123.46 M + +// with target language (default is english) +$readableNumber = ReadableNumbers::make(123456789, 2, 'tr'); // 123.46 Mn +$readableNumber = ReadableNumbers::make(123456789, 3, 'ja'); // 123.457 億 +$readableNumber = ReadableNumbers::make(123456789, 4, 'de'); // 123.4568 Mio. + +``` + +### Directive Example + +There is only one directive: `@readableNumber()`, again takes three arguments: `@readableNumber(float $value, int $decimals = 1, $lang = null)` and all arguments are required. If you use a multi-language system, you should remember to directives are cached. So, you should pass decimal count and language. + + +```html + +... + + + @readableNumber(123456789, 1, app()->getLocale()) + + +... + + + + + Viewed @readableNumber($blogPost->views, 1, app()->getLocale()) times + + +``` + +## Languages + +Supported languages are listed [here](lang/) and reference are used in [unicode.org](https://www.unicode.org/cldr/cldr-aux/charts/28/verify/numbers/). If you want to add your own language and send PR. + +Don't forget to these shortings are depends on a mathematical view. + + +[badge_downloads]: https://img.shields.io/packagist/dt/laravel-ready/readable-numbers.svg?style=flat-square + +[badge_license]: https://img.shields.io/packagist/l/laravel-ready/readable-numbers.svg?style=flat-square + +[badge_stable]: https://img.shields.io/github/v/release/laravel-ready/readable-numbers?label=stable&style=flat-square + +[badge_unstable]: https://img.shields.io/badge/unstable-dev--main-orange?style=flat-square + +[link_license]: LICENSE + +[link_packagist]: https://packagist.org/packages/laravel-ready/readable-numbers + diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..836a32d --- /dev/null +++ b/composer.json @@ -0,0 +1,57 @@ +{ + "name": "laravel-ready/readable-numbers", + "description": "Human readable numbers for Laravel", + "type": "library", + "license": "MIT", + "version": "1.0.0", + "keywords": [ + "laravel", + "readable numbers", + "human readable numbers" + ], + "authors": [ + { + "name": "EgoistDeveloper", + "email": "epsilonelittr@gmail.com" + } + ], + "support": { + "issues": "https://github.com/laravel-ready/theme-store/issues", + "source": "https://github.com/laravel-ready/theme-store" + }, + "require": { + "php": "^8.0.2", + "illuminate/support": "^9.0" + }, + "require-dev": { + "mockery/mockery": "^1.4", + "orchestra/testbench": "^7.0.0", + "phpunit/phpunit": "^9.5" + }, + "autoload": { + "psr-4": { + "LaravelReady\\ReadableNumbers\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests" + } + }, + "config": { + "preferred-install": "dist", + "sort-packages": true + }, + "extra": { + "laravel": { + "providers": [ + "LaravelReady\\ReadableNumbers\\ReadableNumbersServiceProvider" + ], + "aliases": { + "ReadableNumbers": "LaravelReady\\ReadableNumbers\\Facades\\ReadableNumbers" + } + } + }, + "minimum-stability": "stable", + "prefer-stable": true +} diff --git a/database/migrations/2022_01_01_100000_create_ts_themes_table.php b/database/migrations/2022_01_01_100000_create_ts_themes_table.php new file mode 100644 index 0000000..b6ff542 --- /dev/null +++ b/database/migrations/2022_01_01_100000_create_ts_themes_table.php @@ -0,0 +1,60 @@ +prefix = Config::get('theme-store.default_table_prefix', 'ts_'); + + $this->table = "{$this->prefix}_themes"; + } + + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + if (!Schema::hasTable($this->table)) { + Schema::create($this->table, function (Blueprint $table) { + $table->bigIncrements('id'); + + $table->string('name', 50); + $table->string('slug', 50)->unique(); + $table->text('description'); + $table->string('vendor', 50); + $table->string('group', 50); + $table->boolean('status')->default(true); + $table->string('cover', 50)->nullable(); + $table->boolean('featured')->default(false); + + $table->unique(['slug', 'vendor', 'group']); + + $table->softDeletes(); + $table->timestamps(); + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + if (Schema::hasTable($this->table)) { + Schema::table($this->table, function (Blueprint $table) { + $table->dropUnique(['slug', 'vendor', 'group']); + + $table->dropIfExists(); + }); + } + } +} diff --git a/database/migrations/2022_01_01_100001_create_ts_authors_table.php b/database/migrations/2022_01_01_100001_create_ts_authors_table.php new file mode 100644 index 0000000..8eaa6e5 --- /dev/null +++ b/database/migrations/2022_01_01_100001_create_ts_authors_table.php @@ -0,0 +1,55 @@ +prefix = Config::get('theme-store.default_table_prefix', 'ts_'); + + $this->table = "{$this->prefix}_authors"; + } + + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + if (!Schema::hasTable($this->table)) { + Schema::create($this->table, function (Blueprint $table) { + $table->bigIncrements('id'); + + $table->string('name', 50); + $table->string('slug', 50); + $table->string('contact', 50); + $table->string('avatar', 50)->nullable(); + $table->boolean('featured')->default(false); + + $table->softDeletes(); + $table->timestamps(); + + $table->unique(['name', 'contact']); + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + if (Schema::hasTable($this->table)) { + Schema::table($this->table, function (Blueprint $table) { + $table->dropIfExists(); + }); + } + } +} diff --git a/database/migrations/2022_01_01_100002_create_ts_themes_authors_table.php b/database/migrations/2022_01_01_100002_create_ts_themes_authors_table.php new file mode 100644 index 0000000..29b76ba --- /dev/null +++ b/database/migrations/2022_01_01_100002_create_ts_themes_authors_table.php @@ -0,0 +1,52 @@ +prefix = Config::get('theme-store.default_table_prefix', 'ts_'); + + $this->table = "{$this->prefix}_themes_authors"; + } + + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + if (!Schema::hasTable($this->table)) { + Schema::create($this->table, function (Blueprint $table) { + $table->foreignId('theme_id') + ->constrained("{$this->prefix}_themes") + ->onDelete('cascade'); + + $table->foreignId('author_id') + ->constrained("{$this->prefix}_authors") + ->onDelete('cascade'); + + $table->unique(['theme_id', 'author_id']); + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + if (Schema::hasTable($this->table)) { + Schema::table($this->table, function (Blueprint $table) { + $table->dropIfExists(); + }); + } + } +} diff --git a/database/migrations/2022_01_01_100003_create_ts_categories_table.php b/database/migrations/2022_01_01_100003_create_ts_categories_table.php new file mode 100644 index 0000000..cb64d0a --- /dev/null +++ b/database/migrations/2022_01_01_100003_create_ts_categories_table.php @@ -0,0 +1,53 @@ +prefix = Config::get('theme-store.default_table_prefix', 'ts_'); + + $this->table = "{$this->prefix}_categories"; + } + + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + if (!Schema::hasTable($this->table)) { + Schema::create($this->table, function (Blueprint $table) { + $table->bigIncrements('id'); + + $table->string('name', 50); + $table->string('slug', 50)->unique(); + $table->text('description', 500)->nullable(); + $table->string('image', 50)->nullable(); + $table->boolean('featured')->default(false); + + $table->softDeletes(); + $table->timestamps(); + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + if (Schema::hasTable($this->table)) { + Schema::table($this->table, function (Blueprint $table) { + $table->dropIfExists(); + }); + } + } +} diff --git a/database/migrations/2022_01_01_100004_create_ts_themes_categories_table.php b/database/migrations/2022_01_01_100004_create_ts_themes_categories_table.php new file mode 100644 index 0000000..6e40011 --- /dev/null +++ b/database/migrations/2022_01_01_100004_create_ts_themes_categories_table.php @@ -0,0 +1,50 @@ +prefix = Config::get('theme-store.default_table_prefix', 'ts_'); + + $this->table = "{$this->prefix}_themes_categories"; + } + + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + if (!Schema::hasTable($this->table)) { + Schema::create($this->table, function (Blueprint $table) { + $table->foreignId('theme_id') + ->constrained("{$this->prefix}_themes") + ->onDelete('cascade'); + + $table->foreignId('category_id') + ->constrained("{$this->prefix}_categories") + ->onDelete('cascade'); + + $table->unique(['theme_id', 'category_id']); + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table($this->table, function (Blueprint $table) { + $table->dropIfExists(); + }); + } +} diff --git a/database/migrations/2022_01_01_100005_create_ts_releases_table.php b/database/migrations/2022_01_01_100005_create_ts_releases_table.php new file mode 100644 index 0000000..b7fe066 --- /dev/null +++ b/database/migrations/2022_01_01_100005_create_ts_releases_table.php @@ -0,0 +1,59 @@ +prefix = Config::get('theme-store.default_table_prefix', 'ts_'); + + $this->table = "{$this->prefix}_releases"; + } + + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + if (!Schema::hasTable($this->table)) { + Schema::create($this->table, function (Blueprint $table) { + $table->bigIncrements('id'); + + $table->foreignId('theme_id') + ->constrained("{$this->prefix}_themes") + ->onDelete('cascade'); + + $table->text('notes'); + $table->string('version', 20)->unique(); + $table->string('zip_file', 50); + $table->bigInteger('file_size')->nullable(); + $table->boolean('status')->default(true); + + $table->softDeletes(); + $table->timestamps(); + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + if (Schema::hasTable($this->table)) { + Schema::table($this->table, function (Blueprint $table) { + $table->dropConstrainedForeignId('theme_id'); + + $table->dropIfExists(); + }); + } + } +} diff --git a/development.md b/development.md new file mode 100644 index 0000000..cdbf25d --- /dev/null +++ b/development.md @@ -0,0 +1,16 @@ +## Migrations + +Publish the migrations + +`php artisan vendor:publish --tag=theme-store-migrations --force` + +Apply migrations + +`php artisan migrate --path=/database/migrations/laravel-ready/theme-store` + +Rollback migrations + +`php artisan migrate:rollback --path=/database/migrations/laravel-ready/theme-store` + + +`php artisan migrate:refresh` diff --git a/lang/az/suffix.php b/lang/az/suffix.php new file mode 100644 index 0000000..e03b1d3 --- /dev/null +++ b/lang/az/suffix.php @@ -0,0 +1,20 @@ + '', + 'k' => 'K', + 'm' => 'M', + 'b' => 'G', + 't' => 'T', +]; diff --git a/lang/de/suffix.php b/lang/de/suffix.php new file mode 100644 index 0000000..608d485 --- /dev/null +++ b/lang/de/suffix.php @@ -0,0 +1,20 @@ + '', + 'k' => 'Tsd.', + 'm' => 'Mio.', + 'b' => 'Mrd.', + 't' => 'Bio.', +]; diff --git a/lang/en/suffix.php b/lang/en/suffix.php new file mode 100644 index 0000000..41997fc --- /dev/null +++ b/lang/en/suffix.php @@ -0,0 +1,20 @@ + '', + 'k' => 'K', + 'm' => 'M', + 'b' => 'B', + 't' => 'T', +]; diff --git a/lang/fr/suffix.php b/lang/fr/suffix.php new file mode 100644 index 0000000..e13ff9a --- /dev/null +++ b/lang/fr/suffix.php @@ -0,0 +1,20 @@ + '', + 'k' => 'k', + 'm' => 'M', + 'b' => 'Md', + 't' => 'Bn', +]; diff --git a/lang/it/suffix.php b/lang/it/suffix.php new file mode 100644 index 0000000..463e61a --- /dev/null +++ b/lang/it/suffix.php @@ -0,0 +1,20 @@ + '', + 'k' => '', + 'm' => 'Mln', + 'b' => 'Mld', + 't' => 'Bln', +]; diff --git a/lang/ja/suffix.php b/lang/ja/suffix.php new file mode 100644 index 0000000..5af0528 --- /dev/null +++ b/lang/ja/suffix.php @@ -0,0 +1,20 @@ + '', + 'k' => '万', + 'm' => '億', + 'b' => '億', + 't' => '兆', +]; diff --git a/lang/ko/suffix.php b/lang/ko/suffix.php new file mode 100644 index 0000000..f49d4b4 --- /dev/null +++ b/lang/ko/suffix.php @@ -0,0 +1,20 @@ + '', + 'k' => '만', + 'm' => '만', + 'b' => '억', + 't' => '조', +]; diff --git a/lang/nl/suffix.php b/lang/nl/suffix.php new file mode 100644 index 0000000..041d59b --- /dev/null +++ b/lang/nl/suffix.php @@ -0,0 +1,20 @@ + '', + 'k' => 'K', + 'm' => 'mln.', + 'b' => 'mld.', + 't' => 'bln.', +]; diff --git a/lang/pl/suffix.php b/lang/pl/suffix.php new file mode 100644 index 0000000..a06bf28 --- /dev/null +++ b/lang/pl/suffix.php @@ -0,0 +1,20 @@ + '', + 'k' => 'tys.', + 'm' => 'mln', + 'b' => 'mld', + 't' => 'bln', +]; diff --git a/lang/ru/suffix.php b/lang/ru/suffix.php new file mode 100644 index 0000000..ac60eeb --- /dev/null +++ b/lang/ru/suffix.php @@ -0,0 +1,20 @@ + '', + 'k' => 'тыс.', + 'm' => 'млн', + 'b' => 'млрд', + 't' => 'трлн', +]; diff --git a/lang/tr/suffix.php b/lang/tr/suffix.php new file mode 100644 index 0000000..c9548ee --- /dev/null +++ b/lang/tr/suffix.php @@ -0,0 +1,20 @@ + '', + 'k' => 'B', + 'm' => 'Mn', + 'b' => 'Mr', + 't' => 'Tn', +]; diff --git a/lang/zh/suffix.php b/lang/zh/suffix.php new file mode 100644 index 0000000..2dde49f --- /dev/null +++ b/lang/zh/suffix.php @@ -0,0 +1,20 @@ + '', + 'k' => '万', + 'm' => '亿', + 'b' => '兆', + 't' => '兆', +]; diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..ab9ad17 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,32 @@ + + + + + ./src + + + + + + + + + + ./tests + + + diff --git a/src/Directives/NumberDirectives.php b/src/Directives/NumberDirectives.php new file mode 100644 index 0000000..5fd06fa --- /dev/null +++ b/src/Directives/NumberDirectives.php @@ -0,0 +1,36 @@ +directives = [ + 'readableNumber' => function ($args) { + $args = $this->getDirectiveArguments($args); + + $args[1] = $args[1] ?? 1; + $args[2] = $args[2] ?? null; + + return ReadableNumbers::make($args[0], $args[1], $args[2]); + }, + ]; + } + + /** + * Extract blade directive arguments as array + * + * @param string $args + * + * @return array + */ + private function getDirectiveArguments(string $args): array + { + return explode(',', str_replace(['(', ')', ' ', "'"], '', $args)); + } +} diff --git a/src/Facades/ReadableNumbers.php b/src/Facades/ReadableNumbers.php new file mode 100644 index 0000000..1917492 --- /dev/null +++ b/src/Facades/ReadableNumbers.php @@ -0,0 +1,13 @@ +bootPublishes(); + } + + public function register(): void + { + $this->registerDirectives(); + + $this->app->singleton('readable-numbers', function () { + return new ReadableNumbers(); + }); + } + + /** + * Boot publishes + */ + private function bootPublishes(): void + { + $this->loadTranslationsFrom(__DIR__ . '/../lang', 'readable-trans'); + } + + /** + * Register blade directives + */ + private function registerDirectives(): void + { + foreach ((new NumberDirectives())->directives as $name => $function) { + Blade::directive($name, $function); + } + } +} diff --git a/src/Services/ReadableNumbers.php b/src/Services/ReadableNumbers.php new file mode 100644 index 0000000..0cb383e --- /dev/null +++ b/src/Services/ReadableNumbers.php @@ -0,0 +1,69 @@ + 'threshold'] */ + private static $thresholds = [ + '' => 900, + 'k' => 900000, + 'm' => 900000000, + 'b' => 900000000000, + 't' => 90000000000000, + ]; + + /** + * Find readable number in thresholds range + * + * @param float $value + * @param int $decimals + * @return string + */ + public static function make(float $value, int $decimals = 1, $lang = null): string + { + if ($value == 0) { + return '0'; + } + + $value = abs($value); + $isNegative = $value < 0; + $lang = $lang ? strtolower($lang) : app()->getLocale(); + + foreach (self::$thresholds as $suffix => $threshold) { + if ($value <= $threshold) { + $suffix = trans("readable-trans::suffix.{$suffix}", [], $lang); + + return ($isNegative ? '-' : '') . self::format($value, $decimals, $threshold, $suffix); + } + } + + return '0'; + } + + /** + * Format and translate number + * + * @param float $value + * @param int $decimals + * @param int $threshold + * @param string $suffix + * @return string + */ + public static function format(float $value, int $decimals, int $threshold, string $suffix): string + { + $value = $value / ($threshold / self::$thresholds['']); + + $formattedNumber = number_format($value, $decimals); + + $cleanedNumber = (strpos($formattedNumber, '.') === false) + ? $formattedNumber + : rtrim(rtrim($formattedNumber, '0'), '.'); + + return "{$cleanedNumber} {$suffix}"; + } +}