├── .browserslistrc
├── .eslintignore
├── .eslintrc.js
├── .github
└── workflows
│ ├── deploy-pages.yml
│ ├── lint.yml
│ └── test.yml
├── .gitignore
├── LICENSE
├── README.md
├── babel.config.js
├── index.html
├── package-lock.json
├── package.json
├── postcss.config.js
├── public
└── favicon.ico
├── screenshots
└── screenshot.png
├── src
├── @types
│ └── shims-vue.d.ts
├── App.vue
├── assets
│ ├── logo.png
│ └── scss
│ │ ├── _prism_theme.scss
│ │ └── theme.scss
├── components
│ ├── Alert.vue
│ ├── Card.vue
│ ├── Code.vue
│ ├── Footer.vue
│ ├── Settings.vue
│ ├── ThemeColorSwitch.vue
│ ├── buttons
│ │ └── IconButton.vue
│ ├── form
│ │ ├── Checkbox.vue
│ │ ├── FormGroup.vue
│ │ ├── Label.vue
│ │ ├── Select.vue
│ │ ├── TextArea.vue
│ │ └── TextInput.vue
│ ├── icons
│ │ ├── CheckIcon.vue
│ │ ├── ClipboardIcon.vue
│ │ ├── CloudArrowDownIcon.vue
│ │ ├── GithubIcon.vue
│ │ ├── HalfFilledCircleIcon.vue
│ │ ├── MoonIcon.vue
│ │ └── SunIcon.vue
│ ├── loaders
│ │ └── Spinner.vue
│ └── tab-panel
│ │ ├── TabContent.vue
│ │ ├── TabNav.vue
│ │ ├── TabNavItem.vue
│ │ └── TabPanel.vue
├── dto
│ ├── PhpClass.ts
│ ├── PhpProperty.ts
│ ├── SelectOption.ts
│ └── Settings.ts
├── enums
│ ├── PhpDocblock.ts
│ ├── PhpVersion.ts
│ ├── PhpVisibility.ts
│ ├── PropertyDocblockType.ts
│ ├── StringCase.ts
│ └── ThemeColor.ts
├── factories
│ ├── JsonToPhpFactory.ts
│ ├── PhpClassFactory.ts
│ └── PhpTypeFactory.ts
├── hooks
│ ├── use-file-export.ts
│ ├── use-json-converter.ts
│ ├── use-php-class-export.ts
│ ├── use-php-code-presenter.ts
│ └── use-settings.ts
├── main.ts
├── php-types
│ ├── ArrayType.ts
│ ├── BooleanType.ts
│ ├── FloatType.ts
│ ├── IntType.ts
│ ├── NullType.ts
│ ├── PhpClassType.ts
│ ├── PhpType.ts
│ ├── StdClassType.ts
│ ├── StringType.ts
│ └── UnknownType.ts
├── php
│ └── ReservedKeywords.ts
├── presenters
│ ├── PhpClassFromJsonMethodPresenter.ts
│ ├── PhpClassPresenter.ts
│ ├── PhpConstructorPresenter.ts
│ ├── PhpDocblockPresenter.ts
│ ├── PhpFluentSetterPresenter.ts
│ ├── PhpGetterPresenter.ts
│ ├── PhpPropertyPresenter.ts
│ ├── PhpPropertyTypePresenter.ts
│ └── PhpSetterPresenter.ts
├── router
│ └── index.ts
├── support
│ ├── EnumSelect.ts
│ └── Str.ts
├── views
│ └── Generator.vue
└── writers
│ └── CodeWriter.ts
├── tailwind.config.js
├── tests
├── converter
│ ├── fixtures
│ │ ├── all_types_json.txt
│ │ ├── merges_nested_arrays.txt
│ │ ├── results
│ │ │ ├── all_types_json_php_7_3_with_constructor.txt
│ │ │ ├── all_types_json_php_7_3_with_constructor_and_readonly_properties.txt
│ │ │ ├── all_types_json_php_7_3_with_constructor_promoted_properties_getters_and_setters.txt
│ │ │ ├── all_types_json_php_7_3_with_constructor_readonly_properties_and_promoted_properties.txt
│ │ │ ├── all_types_json_php_7_3_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt
│ │ │ ├── all_types_json_php_7_3_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt
│ │ │ ├── all_types_json_php_7_3_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt
│ │ │ ├── all_types_json_php_7_3_with_custom_namespace_root_class_name_and_strict_types.txt
│ │ │ ├── all_types_json_php_7_3_with_final_classes_and_all_properties_nullable.txt
│ │ │ ├── all_types_json_php_7_3_with_getters_fluent_setters_all_docblocks_extra_new_lines_for_properties_and_from_json_method.txt
│ │ │ ├── all_types_json_php_7_3_with_setters_and_from_json_array_method.txt
│ │ │ ├── all_types_json_php_7_3_with_setters_and_from_json_method.txt
│ │ │ ├── all_types_json_php_7_3_without_constructor.txt
│ │ │ ├── all_types_json_php_7_3_without_constructor_and_readonly_classes.txt
│ │ │ ├── all_types_json_php_7_3_without_constructor_and_readonly_properties.txt
│ │ │ ├── all_types_json_php_7_4_with_constructor.txt
│ │ │ ├── all_types_json_php_7_4_with_constructor_and_readonly_properties.txt
│ │ │ ├── all_types_json_php_7_4_with_constructor_promoted_properties_getters_and_setters.txt
│ │ │ ├── all_types_json_php_7_4_with_constructor_readonly_properties_and_promoted_properties.txt
│ │ │ ├── all_types_json_php_7_4_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt
│ │ │ ├── all_types_json_php_7_4_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt
│ │ │ ├── all_types_json_php_7_4_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt
│ │ │ ├── all_types_json_php_7_4_with_custom_namespace_root_class_name_and_strict_types.txt
│ │ │ ├── all_types_json_php_7_4_with_final_classes_and_all_properties_nullable.txt
│ │ │ ├── all_types_json_php_7_4_with_getters_fluent_setters_all_docblocks_extra_new_lines_for_properties_and_from_json_method.txt
│ │ │ ├── all_types_json_php_7_4_with_setters_and_from_json_array_method.txt
│ │ │ ├── all_types_json_php_7_4_with_setters_and_from_json_method.txt
│ │ │ ├── all_types_json_php_7_4_without_constructor.txt
│ │ │ ├── all_types_json_php_7_4_without_constructor_and_readonly_classes.txt
│ │ │ ├── all_types_json_php_7_4_without_constructor_and_readonly_properties.txt
│ │ │ ├── all_types_json_php_8_0_with_constructor.txt
│ │ │ ├── all_types_json_php_8_0_with_constructor_and_readonly_properties.txt
│ │ │ ├── all_types_json_php_8_0_with_constructor_promoted_properties_getters_and_setters.txt
│ │ │ ├── all_types_json_php_8_0_with_constructor_readonly_properties_and_promoted_properties.txt
│ │ │ ├── all_types_json_php_8_0_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt
│ │ │ ├── all_types_json_php_8_0_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt
│ │ │ ├── all_types_json_php_8_0_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt
│ │ │ ├── all_types_json_php_8_0_with_custom_namespace_root_class_name_and_strict_types.txt
│ │ │ ├── all_types_json_php_8_0_with_final_classes_and_all_properties_nullable.txt
│ │ │ ├── all_types_json_php_8_0_with_getters_fluent_setters_all_docblocks_extra_new_lines_for_properties_and_from_json_method.txt
│ │ │ ├── all_types_json_php_8_0_with_setters_and_from_json_array_method.txt
│ │ │ ├── all_types_json_php_8_0_with_setters_and_from_json_method.txt
│ │ │ ├── all_types_json_php_8_0_without_constructor.txt
│ │ │ ├── all_types_json_php_8_0_without_constructor_and_readonly_classes.txt
│ │ │ ├── all_types_json_php_8_0_without_constructor_and_readonly_properties.txt
│ │ │ ├── all_types_json_php_8_1_with_constructor.txt
│ │ │ ├── all_types_json_php_8_1_with_constructor_and_readonly_properties.txt
│ │ │ ├── all_types_json_php_8_1_with_constructor_promoted_properties_getters_and_setters.txt
│ │ │ ├── all_types_json_php_8_1_with_constructor_readonly_properties_and_promoted_properties.txt
│ │ │ ├── all_types_json_php_8_1_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt
│ │ │ ├── all_types_json_php_8_1_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt
│ │ │ ├── all_types_json_php_8_1_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt
│ │ │ ├── all_types_json_php_8_1_with_custom_namespace_root_class_name_and_strict_types.txt
│ │ │ ├── all_types_json_php_8_1_with_final_classes_and_all_properties_nullable.txt
│ │ │ ├── all_types_json_php_8_1_with_getters_fluent_setters_all_docblocks_extra_new_lines_for_properties_and_from_json_method.txt
│ │ │ ├── all_types_json_php_8_1_with_setters_and_from_json_array_method.txt
│ │ │ ├── all_types_json_php_8_1_with_setters_and_from_json_method.txt
│ │ │ ├── all_types_json_php_8_1_without_constructor.txt
│ │ │ ├── all_types_json_php_8_1_without_constructor_and_readonly_classes.txt
│ │ │ ├── all_types_json_php_8_1_without_constructor_and_readonly_properties.txt
│ │ │ ├── all_types_json_php_8_2_with_constructor.txt
│ │ │ ├── all_types_json_php_8_2_with_constructor_and_readonly_properties.txt
│ │ │ ├── all_types_json_php_8_2_with_constructor_promoted_properties_getters_and_setters.txt
│ │ │ ├── all_types_json_php_8_2_with_constructor_readonly_properties_and_promoted_properties.txt
│ │ │ ├── all_types_json_php_8_2_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt
│ │ │ ├── all_types_json_php_8_2_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt
│ │ │ ├── all_types_json_php_8_2_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt
│ │ │ ├── all_types_json_php_8_2_with_custom_namespace_root_class_name_and_strict_types.txt
│ │ │ ├── all_types_json_php_8_2_with_final_classes_and_all_properties_nullable.txt
│ │ │ ├── all_types_json_php_8_2_with_getters_fluent_setters_all_docblocks_extra_new_lines_for_properties_and_from_json_method.txt
│ │ │ ├── all_types_json_php_8_2_with_setters_and_from_json_array_method.txt
│ │ │ ├── all_types_json_php_8_2_with_setters_and_from_json_method.txt
│ │ │ ├── all_types_json_php_8_2_without_constructor.txt
│ │ │ ├── all_types_json_php_8_2_without_constructor_and_readonly_classes.txt
│ │ │ ├── all_types_json_php_8_2_without_constructor_and_readonly_properties.txt
│ │ │ ├── all_types_json_php_8_3_with_constructor.txt
│ │ │ ├── all_types_json_php_8_3_with_constructor_and_readonly_properties.txt
│ │ │ ├── all_types_json_php_8_3_with_constructor_promoted_properties_getters_and_setters.txt
│ │ │ ├── all_types_json_php_8_3_with_constructor_readonly_properties_and_promoted_properties.txt
│ │ │ ├── all_types_json_php_8_3_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt
│ │ │ ├── all_types_json_php_8_3_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt
│ │ │ ├── all_types_json_php_8_3_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt
│ │ │ ├── all_types_json_php_8_3_with_custom_namespace_root_class_name_and_strict_types.txt
│ │ │ ├── all_types_json_php_8_3_with_final_classes_and_all_properties_nullable.txt
│ │ │ ├── all_types_json_php_8_3_with_getters_fluent_setters_all_docblocks_extra_new_lines_for_properties_and_from_json_method.txt
│ │ │ ├── all_types_json_php_8_3_with_setters_and_from_json_array_method.txt
│ │ │ ├── all_types_json_php_8_3_with_setters_and_from_json_method.txt
│ │ │ ├── all_types_json_php_8_3_without_constructor.txt
│ │ │ ├── all_types_json_php_8_3_without_constructor_and_readonly_classes.txt
│ │ │ ├── all_types_json_php_8_3_without_constructor_and_readonly_properties.txt
│ │ │ ├── merges_nested_arrays_php_7_3_with_constructor.txt
│ │ │ ├── merges_nested_arrays_php_7_3_with_constructor_and_readonly_properties.txt
│ │ │ ├── merges_nested_arrays_php_7_3_with_constructor_promoted_properties_getters_and_setters.txt
│ │ │ ├── merges_nested_arrays_php_7_3_with_constructor_readonly_properties_and_promoted_properties.txt
│ │ │ ├── merges_nested_arrays_php_7_3_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt
│ │ │ ├── merges_nested_arrays_php_7_3_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt
│ │ │ ├── merges_nested_arrays_php_7_3_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt
│ │ │ ├── merges_nested_arrays_php_7_3_with_custom_namespace_root_class_name_and_strict_types.txt
│ │ │ ├── merges_nested_arrays_php_7_3_with_final_classes_and_all_properties_nullable.txt
│ │ │ ├── merges_nested_arrays_php_7_3_with_getters_fluent_setters_all_docblocks_extra_new_lines_for_properties_and_from_json_method.txt
│ │ │ ├── merges_nested_arrays_php_7_3_with_setters_and_from_json_array_method.txt
│ │ │ ├── merges_nested_arrays_php_7_3_with_setters_and_from_json_method.txt
│ │ │ ├── merges_nested_arrays_php_7_3_without_constructor.txt
│ │ │ ├── merges_nested_arrays_php_7_3_without_constructor_and_readonly_classes.txt
│ │ │ ├── merges_nested_arrays_php_7_3_without_constructor_and_readonly_properties.txt
│ │ │ ├── merges_nested_arrays_php_7_4_with_constructor.txt
│ │ │ ├── merges_nested_arrays_php_7_4_with_constructor_and_readonly_properties.txt
│ │ │ ├── merges_nested_arrays_php_7_4_with_constructor_promoted_properties_getters_and_setters.txt
│ │ │ ├── merges_nested_arrays_php_7_4_with_constructor_readonly_properties_and_promoted_properties.txt
│ │ │ ├── merges_nested_arrays_php_7_4_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt
│ │ │ ├── merges_nested_arrays_php_7_4_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt
│ │ │ ├── merges_nested_arrays_php_7_4_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt
│ │ │ ├── merges_nested_arrays_php_7_4_with_custom_namespace_root_class_name_and_strict_types.txt
│ │ │ ├── merges_nested_arrays_php_7_4_with_final_classes_and_all_properties_nullable.txt
│ │ │ ├── merges_nested_arrays_php_7_4_with_getters_fluent_setters_all_docblocks_extra_new_lines_for_properties_and_from_json_method.txt
│ │ │ ├── merges_nested_arrays_php_7_4_with_setters_and_from_json_array_method.txt
│ │ │ ├── merges_nested_arrays_php_7_4_with_setters_and_from_json_method.txt
│ │ │ ├── merges_nested_arrays_php_7_4_without_constructor.txt
│ │ │ ├── merges_nested_arrays_php_7_4_without_constructor_and_readonly_classes.txt
│ │ │ ├── merges_nested_arrays_php_7_4_without_constructor_and_readonly_properties.txt
│ │ │ ├── merges_nested_arrays_php_8_0_with_constructor.txt
│ │ │ ├── merges_nested_arrays_php_8_0_with_constructor_and_readonly_properties.txt
│ │ │ ├── merges_nested_arrays_php_8_0_with_constructor_promoted_properties_getters_and_setters.txt
│ │ │ ├── merges_nested_arrays_php_8_0_with_constructor_readonly_properties_and_promoted_properties.txt
│ │ │ ├── merges_nested_arrays_php_8_0_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt
│ │ │ ├── merges_nested_arrays_php_8_0_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt
│ │ │ ├── merges_nested_arrays_php_8_0_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt
│ │ │ ├── merges_nested_arrays_php_8_0_with_custom_namespace_root_class_name_and_strict_types.txt
│ │ │ ├── merges_nested_arrays_php_8_0_with_final_classes_and_all_properties_nullable.txt
│ │ │ ├── merges_nested_arrays_php_8_0_with_getters_fluent_setters_all_docblocks_extra_new_lines_for_properties_and_from_json_method.txt
│ │ │ ├── merges_nested_arrays_php_8_0_with_setters_and_from_json_array_method.txt
│ │ │ ├── merges_nested_arrays_php_8_0_with_setters_and_from_json_method.txt
│ │ │ ├── merges_nested_arrays_php_8_0_without_constructor.txt
│ │ │ ├── merges_nested_arrays_php_8_0_without_constructor_and_readonly_classes.txt
│ │ │ ├── merges_nested_arrays_php_8_0_without_constructor_and_readonly_properties.txt
│ │ │ ├── merges_nested_arrays_php_8_1_with_constructor.txt
│ │ │ ├── merges_nested_arrays_php_8_1_with_constructor_and_readonly_properties.txt
│ │ │ ├── merges_nested_arrays_php_8_1_with_constructor_promoted_properties_getters_and_setters.txt
│ │ │ ├── merges_nested_arrays_php_8_1_with_constructor_readonly_properties_and_promoted_properties.txt
│ │ │ ├── merges_nested_arrays_php_8_1_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt
│ │ │ ├── merges_nested_arrays_php_8_1_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt
│ │ │ ├── merges_nested_arrays_php_8_1_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt
│ │ │ ├── merges_nested_arrays_php_8_1_with_custom_namespace_root_class_name_and_strict_types.txt
│ │ │ ├── merges_nested_arrays_php_8_1_with_final_classes_and_all_properties_nullable.txt
│ │ │ ├── merges_nested_arrays_php_8_1_with_getters_fluent_setters_all_docblocks_extra_new_lines_for_properties_and_from_json_method.txt
│ │ │ ├── merges_nested_arrays_php_8_1_with_setters_and_from_json_array_method.txt
│ │ │ ├── merges_nested_arrays_php_8_1_with_setters_and_from_json_method.txt
│ │ │ ├── merges_nested_arrays_php_8_1_without_constructor.txt
│ │ │ ├── merges_nested_arrays_php_8_1_without_constructor_and_readonly_classes.txt
│ │ │ ├── merges_nested_arrays_php_8_1_without_constructor_and_readonly_properties.txt
│ │ │ ├── merges_nested_arrays_php_8_2_with_constructor.txt
│ │ │ ├── merges_nested_arrays_php_8_2_with_constructor_and_readonly_properties.txt
│ │ │ ├── merges_nested_arrays_php_8_2_with_constructor_promoted_properties_getters_and_setters.txt
│ │ │ ├── merges_nested_arrays_php_8_2_with_constructor_readonly_properties_and_promoted_properties.txt
│ │ │ ├── merges_nested_arrays_php_8_2_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt
│ │ │ ├── merges_nested_arrays_php_8_2_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt
│ │ │ ├── merges_nested_arrays_php_8_2_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt
│ │ │ ├── merges_nested_arrays_php_8_2_with_custom_namespace_root_class_name_and_strict_types.txt
│ │ │ ├── merges_nested_arrays_php_8_2_with_final_classes_and_all_properties_nullable.txt
│ │ │ ├── merges_nested_arrays_php_8_2_with_getters_fluent_setters_all_docblocks_extra_new_lines_for_properties_and_from_json_method.txt
│ │ │ ├── merges_nested_arrays_php_8_2_with_setters_and_from_json_array_method.txt
│ │ │ ├── merges_nested_arrays_php_8_2_with_setters_and_from_json_method.txt
│ │ │ ├── merges_nested_arrays_php_8_2_without_constructor.txt
│ │ │ ├── merges_nested_arrays_php_8_2_without_constructor_and_readonly_classes.txt
│ │ │ ├── merges_nested_arrays_php_8_2_without_constructor_and_readonly_properties.txt
│ │ │ ├── merges_nested_arrays_php_8_3_with_constructor.txt
│ │ │ ├── merges_nested_arrays_php_8_3_with_constructor_and_readonly_properties.txt
│ │ │ ├── merges_nested_arrays_php_8_3_with_constructor_promoted_properties_getters_and_setters.txt
│ │ │ ├── merges_nested_arrays_php_8_3_with_constructor_readonly_properties_and_promoted_properties.txt
│ │ │ ├── merges_nested_arrays_php_8_3_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt
│ │ │ ├── merges_nested_arrays_php_8_3_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt
│ │ │ ├── merges_nested_arrays_php_8_3_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt
│ │ │ ├── merges_nested_arrays_php_8_3_with_custom_namespace_root_class_name_and_strict_types.txt
│ │ │ ├── merges_nested_arrays_php_8_3_with_final_classes_and_all_properties_nullable.txt
│ │ │ ├── merges_nested_arrays_php_8_3_with_getters_fluent_setters_all_docblocks_extra_new_lines_for_properties_and_from_json_method.txt
│ │ │ ├── merges_nested_arrays_php_8_3_with_setters_and_from_json_array_method.txt
│ │ │ ├── merges_nested_arrays_php_8_3_with_setters_and_from_json_method.txt
│ │ │ ├── merges_nested_arrays_php_8_3_without_constructor.txt
│ │ │ ├── merges_nested_arrays_php_8_3_without_constructor_and_readonly_classes.txt
│ │ │ ├── merges_nested_arrays_php_8_3_without_constructor_and_readonly_properties.txt
│ │ │ ├── simple_json_data_php_7_3_with_constructor.txt
│ │ │ ├── simple_json_data_php_7_3_with_constructor_and_readonly_properties.txt
│ │ │ ├── simple_json_data_php_7_3_with_constructor_promoted_properties_getters_and_setters.txt
│ │ │ ├── simple_json_data_php_7_3_with_constructor_readonly_properties_and_promoted_properties.txt
│ │ │ ├── simple_json_data_php_7_3_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt
│ │ │ ├── simple_json_data_php_7_3_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt
│ │ │ ├── simple_json_data_php_7_3_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt
│ │ │ ├── simple_json_data_php_7_3_with_custom_namespace_root_class_name_and_strict_types.txt
│ │ │ ├── simple_json_data_php_7_3_with_final_classes_and_all_properties_nullable.txt
│ │ │ ├── simple_json_data_php_7_3_with_getters_fluent_setters_all_docblocks_extra_new_lines_for_properties_and_from_json_method.txt
│ │ │ ├── simple_json_data_php_7_3_with_setters_and_from_json_array_method.txt
│ │ │ ├── simple_json_data_php_7_3_with_setters_and_from_json_method.txt
│ │ │ ├── simple_json_data_php_7_3_without_constructor.txt
│ │ │ ├── simple_json_data_php_7_3_without_constructor_and_readonly_classes.txt
│ │ │ ├── simple_json_data_php_7_3_without_constructor_and_readonly_properties.txt
│ │ │ ├── simple_json_data_php_7_4_with_constructor.txt
│ │ │ ├── simple_json_data_php_7_4_with_constructor_and_readonly_properties.txt
│ │ │ ├── simple_json_data_php_7_4_with_constructor_promoted_properties_getters_and_setters.txt
│ │ │ ├── simple_json_data_php_7_4_with_constructor_readonly_properties_and_promoted_properties.txt
│ │ │ ├── simple_json_data_php_7_4_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt
│ │ │ ├── simple_json_data_php_7_4_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt
│ │ │ ├── simple_json_data_php_7_4_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt
│ │ │ ├── simple_json_data_php_7_4_with_custom_namespace_root_class_name_and_strict_types.txt
│ │ │ ├── simple_json_data_php_7_4_with_final_classes_and_all_properties_nullable.txt
│ │ │ ├── simple_json_data_php_7_4_with_getters_fluent_setters_all_docblocks_extra_new_lines_for_properties_and_from_json_method.txt
│ │ │ ├── simple_json_data_php_7_4_with_setters_and_from_json_array_method.txt
│ │ │ ├── simple_json_data_php_7_4_with_setters_and_from_json_method.txt
│ │ │ ├── simple_json_data_php_7_4_without_constructor.txt
│ │ │ ├── simple_json_data_php_7_4_without_constructor_and_readonly_classes.txt
│ │ │ ├── simple_json_data_php_7_4_without_constructor_and_readonly_properties.txt
│ │ │ ├── simple_json_data_php_8_0_with_constructor.txt
│ │ │ ├── simple_json_data_php_8_0_with_constructor_and_readonly_properties.txt
│ │ │ ├── simple_json_data_php_8_0_with_constructor_promoted_properties_getters_and_setters.txt
│ │ │ ├── simple_json_data_php_8_0_with_constructor_readonly_properties_and_promoted_properties.txt
│ │ │ ├── simple_json_data_php_8_0_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt
│ │ │ ├── simple_json_data_php_8_0_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt
│ │ │ ├── simple_json_data_php_8_0_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt
│ │ │ ├── simple_json_data_php_8_0_with_custom_namespace_root_class_name_and_strict_types.txt
│ │ │ ├── simple_json_data_php_8_0_with_final_classes_and_all_properties_nullable.txt
│ │ │ ├── simple_json_data_php_8_0_with_getters_fluent_setters_all_docblocks_extra_new_lines_for_properties_and_from_json_method.txt
│ │ │ ├── simple_json_data_php_8_0_with_setters_and_from_json_array_method.txt
│ │ │ ├── simple_json_data_php_8_0_with_setters_and_from_json_method.txt
│ │ │ ├── simple_json_data_php_8_0_without_constructor.txt
│ │ │ ├── simple_json_data_php_8_0_without_constructor_and_readonly_classes.txt
│ │ │ ├── simple_json_data_php_8_0_without_constructor_and_readonly_properties.txt
│ │ │ ├── simple_json_data_php_8_1_with_constructor.txt
│ │ │ ├── simple_json_data_php_8_1_with_constructor_and_readonly_properties.txt
│ │ │ ├── simple_json_data_php_8_1_with_constructor_promoted_properties_getters_and_setters.txt
│ │ │ ├── simple_json_data_php_8_1_with_constructor_readonly_properties_and_promoted_properties.txt
│ │ │ ├── simple_json_data_php_8_1_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt
│ │ │ ├── simple_json_data_php_8_1_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt
│ │ │ ├── simple_json_data_php_8_1_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt
│ │ │ ├── simple_json_data_php_8_1_with_custom_namespace_root_class_name_and_strict_types.txt
│ │ │ ├── simple_json_data_php_8_1_with_final_classes_and_all_properties_nullable.txt
│ │ │ ├── simple_json_data_php_8_1_with_getters_fluent_setters_all_docblocks_extra_new_lines_for_properties_and_from_json_method.txt
│ │ │ ├── simple_json_data_php_8_1_with_setters_and_from_json_array_method.txt
│ │ │ ├── simple_json_data_php_8_1_with_setters_and_from_json_method.txt
│ │ │ ├── simple_json_data_php_8_1_without_constructor.txt
│ │ │ ├── simple_json_data_php_8_1_without_constructor_and_readonly_classes.txt
│ │ │ ├── simple_json_data_php_8_1_without_constructor_and_readonly_properties.txt
│ │ │ ├── simple_json_data_php_8_2_with_constructor.txt
│ │ │ ├── simple_json_data_php_8_2_with_constructor_and_readonly_properties.txt
│ │ │ ├── simple_json_data_php_8_2_with_constructor_promoted_properties_getters_and_setters.txt
│ │ │ ├── simple_json_data_php_8_2_with_constructor_readonly_properties_and_promoted_properties.txt
│ │ │ ├── simple_json_data_php_8_2_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt
│ │ │ ├── simple_json_data_php_8_2_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt
│ │ │ ├── simple_json_data_php_8_2_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt
│ │ │ ├── simple_json_data_php_8_2_with_custom_namespace_root_class_name_and_strict_types.txt
│ │ │ ├── simple_json_data_php_8_2_with_final_classes_and_all_properties_nullable.txt
│ │ │ ├── simple_json_data_php_8_2_with_getters_fluent_setters_all_docblocks_extra_new_lines_for_properties_and_from_json_method.txt
│ │ │ ├── simple_json_data_php_8_2_with_setters_and_from_json_array_method.txt
│ │ │ ├── simple_json_data_php_8_2_with_setters_and_from_json_method.txt
│ │ │ ├── simple_json_data_php_8_2_without_constructor.txt
│ │ │ ├── simple_json_data_php_8_2_without_constructor_and_readonly_classes.txt
│ │ │ ├── simple_json_data_php_8_2_without_constructor_and_readonly_properties.txt
│ │ │ ├── simple_json_data_php_8_3_with_constructor.txt
│ │ │ ├── simple_json_data_php_8_3_with_constructor_and_readonly_properties.txt
│ │ │ ├── simple_json_data_php_8_3_with_constructor_promoted_properties_getters_and_setters.txt
│ │ │ ├── simple_json_data_php_8_3_with_constructor_readonly_properties_and_promoted_properties.txt
│ │ │ ├── simple_json_data_php_8_3_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt
│ │ │ ├── simple_json_data_php_8_3_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt
│ │ │ ├── simple_json_data_php_8_3_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt
│ │ │ ├── simple_json_data_php_8_3_with_custom_namespace_root_class_name_and_strict_types.txt
│ │ │ ├── simple_json_data_php_8_3_with_final_classes_and_all_properties_nullable.txt
│ │ │ ├── simple_json_data_php_8_3_with_getters_fluent_setters_all_docblocks_extra_new_lines_for_properties_and_from_json_method.txt
│ │ │ ├── simple_json_data_php_8_3_with_setters_and_from_json_array_method.txt
│ │ │ ├── simple_json_data_php_8_3_with_setters_and_from_json_method.txt
│ │ │ ├── simple_json_data_php_8_3_without_constructor.txt
│ │ │ ├── simple_json_data_php_8_3_without_constructor_and_readonly_classes.txt
│ │ │ └── simple_json_data_php_8_3_without_constructor_and_readonly_properties.txt
│ │ └── simple_json.txt
│ └── json-to-php-converter.spec.ts
└── test-utils.ts
├── tsconfig.json
└── vite.config.js
/.browserslistrc:
--------------------------------------------------------------------------------
1 | > 1%
2 | last 2 versions
3 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | postcss.config.js
2 | tailwind.config.js
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | env: {
4 | es2021: true
5 | },
6 | 'extends': [
7 | 'plugin:vue/vue3-recommended',
8 | 'eslint:recommended',
9 | '@vue/typescript/recommended'
10 | ],
11 | parserOptions: {
12 | ecmaVersion: 2021
13 | },
14 | rules: {
15 | 'quotes': [2, 'single', { 'avoidEscape': true }],
16 | 'vue/multi-word-component-names': 'off',
17 | }
18 | };
19 |
--------------------------------------------------------------------------------
/.github/workflows/deploy-pages.yml:
--------------------------------------------------------------------------------
1 | name: Build and Deploy
2 | on:
3 | push:
4 | branches:
5 | - master
6 | jobs:
7 | build-and-deploy:
8 | runs-on: ubuntu-latest
9 | steps:
10 | - name: Checkout 🛎️
11 | uses: actions/checkout@v2
12 | with:
13 | persist-credentials: false
14 |
15 | - name: Install and Build 🔧
16 | run: |
17 | npm install
18 | npm run build
19 |
20 | - name: Deploy 🚀
21 | uses: JamesIves/github-pages-deploy-action@releases/v3
22 | with:
23 | ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
24 | BRANCH: gh-pages
25 | FOLDER: dist
26 | CLEAN: true
--------------------------------------------------------------------------------
/.github/workflows/lint.yml:
--------------------------------------------------------------------------------
1 | name: Lint code
2 | on: [push, pull_request]
3 | jobs:
4 | lint-code:
5 | runs-on: ubuntu-latest
6 | steps:
7 | - name: Checkout 🛎️
8 | uses: actions/checkout@v2
9 | with:
10 | persist-credentials: false
11 |
12 | - name: Install 🔧
13 | run: |
14 | npm install
15 |
16 | - name: Lint code 🔎
17 | run: |
18 | npm run lint
--------------------------------------------------------------------------------
/.github/workflows/test.yml:
--------------------------------------------------------------------------------
1 | name: Test code
2 | on: [push, pull_request]
3 | jobs:
4 | test-code:
5 | runs-on: ubuntu-latest
6 | steps:
7 | - name: Checkout 🛎️
8 | uses: actions/checkout@v2
9 | with:
10 | persist-credentials: false
11 |
12 | - name: Install 🔧
13 | run: |
14 | npm install
15 |
16 | - name: Test code 🧪
17 | run: |
18 | npm run test-ci
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 | coverage
5 |
6 | # local env files
7 | .env.local
8 | .env.*.local
9 |
10 | # Log files
11 | npm-debug.log*
12 | yarn-debug.log*
13 | yarn-error.log*
14 |
15 | # Editor directories and files
16 | .idea
17 | .vscode
18 | *.suo
19 | *.ntvs*
20 | *.njsproj
21 | *.sln
22 | *.sw?
23 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 Jacob de Keizer
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # JSON to PHP class generator
2 |
3 | Generate PHP classes from json.
4 |
5 | View it [here](https://jacobdekeizer.github.io/json-to-php-generator/).
6 |
7 | 
8 |
9 | ## Project setup
10 | ```
11 | npm install
12 | ```
13 |
14 | ### Compiles and hot-reloads for development
15 | ```
16 | npm run serve
17 | ```
18 |
19 | ### Compiles and minifies for production
20 | ```
21 | npm run build
22 | ```
23 |
24 | ### Lints and fixes files
25 | ```
26 | npm run lint
27 | ```
28 |
29 | ### Test code
30 | ```
31 | npm run test
32 | ```
33 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/cli-plugin-babel/preset'
4 | ]
5 | };
6 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | JSON to PHP class converter
11 |
12 |
13 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "php-json-generator",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "vite",
7 | "build": "vite build",
8 | "serve": "vite serve",
9 | "preview": "vite preview",
10 | "lint": "eslint --ext .js,.ts,.vue --ignore-path .gitignore --fix src",
11 | "test": "vitest",
12 | "test-ci": "vitest run --coverage.enabled --coverage.reporter='text-summary'",
13 | "coverage": "vitest run --coverage"
14 | },
15 | "dependencies": {
16 | "change-case": "^5.4.3",
17 | "jszip": "^3.10.1",
18 | "prismjs": "^1.29.0",
19 | "tailwindcss": "^3.2.7",
20 | "vue": "^3.2.37",
21 | "vue-router": "^4.1.5"
22 | },
23 | "devDependencies": {
24 | "@types/node": "^20.11.25",
25 | "@types/prismjs": "^1.26.0",
26 | "@typescript-eslint/eslint-plugin": "^7.1.1",
27 | "@typescript-eslint/parser": "^7.1.1",
28 | "@vitejs/plugin-vue": "^5.0.4",
29 | "@vitest/coverage-v8": "^1.3.1",
30 | "@vue/eslint-config-typescript": "^12.0.0",
31 | "autoprefixer": "^10.4.13",
32 | "eslint": "^8.23.0",
33 | "eslint-plugin-vue": "^9.4.0",
34 | "happy-dom": "^13.6.2",
35 | "node-sass": "^9.0.0",
36 | "postcss": "^8.4.21",
37 | "postcss-import": "^16.0.1",
38 | "sass": "^1.58.3",
39 | "typescript": "^5.0.4",
40 | "vite": "^5.1.5",
41 | "vitest": "^1.3.1"
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/postcss.config.js:
--------------------------------------------------------------------------------
1 | const autoprefixer = require('autoprefixer');
2 | const tailwindcss = require('tailwindcss');
3 |
4 | module.exports = {
5 | plugins: [
6 | tailwindcss,
7 | autoprefixer,
8 | ],
9 | };
10 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacobdekeizer/json-to-php-generator/116353990cf21edf8b25814d998d30822311c4e7/public/favicon.ico
--------------------------------------------------------------------------------
/screenshots/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacobdekeizer/json-to-php-generator/116353990cf21edf8b25814d998d30822311c4e7/screenshots/screenshot.png
--------------------------------------------------------------------------------
/src/@types/shims-vue.d.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | declare module '*.vue' {
3 | import type { DefineComponent } from 'vue';
4 | const component: DefineComponent<{}, {}, any>;
5 | export default component;
6 | }
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
16 |
--------------------------------------------------------------------------------
/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jacobdekeizer/json-to-php-generator/116353990cf21edf8b25814d998d30822311c4e7/src/assets/logo.png
--------------------------------------------------------------------------------
/src/assets/scss/theme.scss:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 |
3 | @tailwind components;
4 |
5 | @tailwind utilities;
6 |
7 | @import "prism_theme";
--------------------------------------------------------------------------------
/src/components/Alert.vue:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/components/Card.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/src/components/Code.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
14 |
15 |
16 |
17 | Copied!
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
60 |
--------------------------------------------------------------------------------
/src/components/Footer.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Made by Jacob de Keizer
6 |
7 |
15 |
16 |
17 |
18 |
19 |
22 |
--------------------------------------------------------------------------------
/src/components/buttons/IconButton.vue:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
--------------------------------------------------------------------------------
/src/components/form/Checkbox.vue:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
19 |
--------------------------------------------------------------------------------
/src/components/form/FormGroup.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/components/form/Label.vue:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/src/components/form/Select.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 |
31 |
32 |
33 |
34 |
41 |
--------------------------------------------------------------------------------
/src/components/form/TextArea.vue:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
18 |
19 |
--------------------------------------------------------------------------------
/src/components/form/TextInput.vue:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
18 |
--------------------------------------------------------------------------------
/src/components/icons/CheckIcon.vue:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
--------------------------------------------------------------------------------
/src/components/icons/ClipboardIcon.vue:
--------------------------------------------------------------------------------
1 |
2 |
16 |
--------------------------------------------------------------------------------
/src/components/icons/CloudArrowDownIcon.vue:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
--------------------------------------------------------------------------------
/src/components/icons/GithubIcon.vue:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
--------------------------------------------------------------------------------
/src/components/icons/HalfFilledCircleIcon.vue:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
--------------------------------------------------------------------------------
/src/components/icons/MoonIcon.vue:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/components/icons/SunIcon.vue:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
--------------------------------------------------------------------------------
/src/components/loaders/Spinner.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
19 |
Loading...
20 |
21 |
--------------------------------------------------------------------------------
/src/components/tab-panel/TabContent.vue:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/components/tab-panel/TabNav.vue:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/src/components/tab-panel/TabNavItem.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/components/tab-panel/TabPanel.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/dto/PhpClass.ts:
--------------------------------------------------------------------------------
1 | import PhpProperty from '@/dto/PhpProperty';
2 | import ReservedKeywords from '@/php/ReservedKeywords';
3 |
4 | export default class PhpClass {
5 | private name: string;
6 | private readonly properties: PhpProperty[];
7 | private readonly children: PhpClass[];
8 |
9 | public constructor (name: string, properties: PhpProperty[], children: PhpClass[] = []) {
10 | this.name = name;
11 | this.properties = properties;
12 | this.children = children;
13 | }
14 |
15 | public getName(): string {
16 | if (ReservedKeywords.isReserved(this.name)) {
17 | return this.name + 'Object';
18 | }
19 |
20 | return this.name;
21 | }
22 |
23 | public setName(name: string): void {
24 | this.name = name;
25 | }
26 |
27 | public getProperties(): PhpProperty[] {
28 | return this.properties;
29 | }
30 |
31 | public getProperty(name: string): PhpProperty | null {
32 | return this.properties.find(property => property.getName() === name) || null;
33 | }
34 |
35 | public getChildren(): PhpClass[] {
36 | return this.children;
37 | }
38 | }
--------------------------------------------------------------------------------
/src/dto/SelectOption.ts:
--------------------------------------------------------------------------------
1 | export default class SelectOption {
2 | public text: string;
3 | public value: string;
4 |
5 | public constructor(text: string, value: string) {
6 | this.text = text;
7 | this.value = value;
8 | }
9 | }
--------------------------------------------------------------------------------
/src/enums/PhpDocblock.ts:
--------------------------------------------------------------------------------
1 | export enum PhpDocblock {
2 | None = 'None',
3 | Necessary = 'Only necessary',
4 | All = 'All',
5 | }
--------------------------------------------------------------------------------
/src/enums/PhpVersion.ts:
--------------------------------------------------------------------------------
1 | export enum PhpVersion {
2 | PHP73 = 'PHP 7.3',
3 | PHP74 = 'PHP 7.4',
4 | PHP80 = 'PHP 8.0',
5 | PHP81 = 'PHP 8.1',
6 | PHP82 = 'PHP 8.2',
7 | PHP83 = 'PHP 8.3',
8 | }
--------------------------------------------------------------------------------
/src/enums/PhpVisibility.ts:
--------------------------------------------------------------------------------
1 | export enum PhpVisibility {
2 | Private = 'private',
3 | Protected = 'protected',
4 | Public = 'public',
5 | }
--------------------------------------------------------------------------------
/src/enums/PropertyDocblockType.ts:
--------------------------------------------------------------------------------
1 | export enum PropertyDocblockType {
2 | Inline = 'Inline',
3 | Multiline = 'Multiline',
4 | }
--------------------------------------------------------------------------------
/src/enums/StringCase.ts:
--------------------------------------------------------------------------------
1 | export enum StringCase {
2 | Original = 'Original',
3 | CamelCase = 'Camel case',
4 | PascalCase = 'Pascal case',
5 | SnakeCase = 'Snake case',
6 | }
--------------------------------------------------------------------------------
/src/enums/ThemeColor.ts:
--------------------------------------------------------------------------------
1 | export enum ThemeColor {
2 | SYSTEM = 'system',
3 | DARK = 'dark',
4 | LIGHT = 'light',
5 | }
--------------------------------------------------------------------------------
/src/factories/JsonToPhpFactory.ts:
--------------------------------------------------------------------------------
1 | import PhpClassFactory from '@/factories/PhpClassFactory';
2 | import PhpClass from '@/dto/PhpClass';
3 | import Settings from '@/dto/Settings';
4 |
5 | export default class JsonToPhpFactory {
6 | public static make(content: string, settings: Settings): PhpClass {
7 | let jsonObject;
8 |
9 | try {
10 | jsonObject = JSON.parse(content);
11 | } catch (e) {
12 | throw new Error('Unable to decode json content');
13 | }
14 |
15 | return PhpClassFactory.make(jsonObject, settings.rootClassName);
16 | }
17 | }
--------------------------------------------------------------------------------
/src/factories/PhpTypeFactory.ts:
--------------------------------------------------------------------------------
1 | import PhpType from '@/php-types/PhpType';
2 | import StringType from '@/php-types/StringType';
3 | import ArrayType from '@/php-types/ArrayType';
4 | import PhpClass from '@/dto/PhpClass';
5 | import PhpClassType from '@/php-types/PhpClassType';
6 | import IntType from '@/php-types/IntType';
7 | import BooleanType from '@/php-types/BooleanType';
8 | import UnknownType from '@/php-types/UnknownType';
9 | import FloatType from '@/php-types/FloatType';
10 | import NullType from '@/php-types/NullType';
11 |
12 | export default class PhpTypeFactory {
13 | /* eslint-disable @typescript-eslint/no-explicit-any */
14 | public static make(value: any): PhpType {
15 | if (typeof value === 'string') {
16 | return new StringType();
17 | } else if (typeof value === 'number') {
18 | if (value % 1 === 0) {
19 | return new IntType();
20 | }
21 |
22 | return new FloatType();
23 | } else if (Array.isArray(value)) {
24 | const arrayType = new ArrayType();
25 |
26 | for (const v of value) {
27 | arrayType.addType(PhpTypeFactory.make(v));
28 | }
29 |
30 | return arrayType;
31 | } else if (value instanceof PhpClass) {
32 | return new PhpClassType(value);
33 | } else if (typeof value === 'boolean') {
34 | return new BooleanType();
35 | } else if (value === null) {
36 | return new NullType();
37 | }
38 |
39 | return new UnknownType();
40 | }
41 | }
--------------------------------------------------------------------------------
/src/hooks/use-file-export.ts:
--------------------------------------------------------------------------------
1 | import JSZip from 'jszip';
2 |
3 | export interface ExportFile {
4 | filename: string;
5 | contents: string;
6 | }
7 |
8 | interface UseFileExport {
9 | exportFilesZip: (zipFilename: string, files: ExportFile[]) => Promise;
10 | }
11 |
12 | export const useFileExport = (): UseFileExport => {
13 | const downloadBlob = (blob: Blob, filename: string) => {
14 | const link = document.createElement('a');
15 | link.href = URL.createObjectURL(blob);
16 | link.download = filename;
17 | link.click();
18 | URL.revokeObjectURL(link.href);
19 | };
20 |
21 | const exportFilesZip = async (zipFilename: string, files: ExportFile[]): Promise => {
22 | const zip = new JSZip();
23 |
24 | for (const file of files) {
25 | zip.file(file.filename, file.contents);
26 | }
27 |
28 | const blob = await zip.generateAsync({ type: 'blob' });
29 |
30 | downloadBlob(blob, zipFilename);
31 | }
32 |
33 | return {
34 | exportFilesZip,
35 | }
36 | }
--------------------------------------------------------------------------------
/src/hooks/use-json-converter.ts:
--------------------------------------------------------------------------------
1 | import {computed, ComputedRef, Ref, ref} from 'vue';
2 | import Settings from '@/dto/Settings';
3 | import PhpClass from '@/dto/PhpClass';
4 | import JsonToPhpFactory from '@/factories/JsonToPhpFactory';
5 |
6 | interface UseJsonConverterProps {
7 | jsonContent: Ref;
8 | settings: Ref;
9 | }
10 |
11 | interface UseJsonConverter {
12 | error: Ref;
13 | phpClass: ComputedRef;
14 | }
15 |
16 | export const useJsonConverter = ({ jsonContent, settings }: UseJsonConverterProps): UseJsonConverter => {
17 | const error = ref(null);
18 |
19 | const phpClass = computed(() => {
20 | error.value = null;
21 |
22 | if (!jsonContent.value) {
23 | return null;
24 | }
25 |
26 | try {
27 | // Make a copy of the settings value, to trigger deep reactivity
28 | return JsonToPhpFactory.make(jsonContent.value, { ...settings.value });
29 | } catch (e) {
30 | error.value = (e as Error).message;
31 | }
32 |
33 | return null;
34 | });
35 |
36 | return {
37 | error,
38 | phpClass,
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/hooks/use-php-class-export.ts:
--------------------------------------------------------------------------------
1 | import {ref, Ref} from 'vue';
2 | import PhpClass from '@/dto/PhpClass';
3 | import {ExportFile, useFileExport} from '@/hooks/use-file-export';
4 | import PhpClassPresenter from '@/presenters/PhpClassPresenter';
5 | import Settings from '@/dto/Settings';
6 |
7 | interface UsePhpClassExport {
8 | exporting: Ref
9 | exportPhpClassToZip: (phpClass: PhpClass, settings: Settings) => Promise;
10 | }
11 |
12 | export const usePhpClassExport = (): UsePhpClassExport => {
13 | const exporting = ref(false);
14 |
15 | const { exportFilesZip } = useFileExport();
16 |
17 | const generatePhpExportFilesRecursive = (phpClass: PhpClass, settings: Settings): ExportFile[] => {
18 | const result: ExportFile[] = [];
19 |
20 | const phpClassPresenter = new PhpClassPresenter(phpClass, settings);
21 |
22 | result.push({
23 | filename: phpClassPresenter.getClassName() + '.php',
24 | contents: phpClassPresenter.toString()
25 | });
26 |
27 | for (const childClass of phpClass.getChildren()) {
28 | result.push(...generatePhpExportFilesRecursive(childClass, settings));
29 | }
30 |
31 | return result;
32 | }
33 |
34 | const exportPhpClassToZip = async (phpClass: PhpClass, settings: Settings): Promise => {
35 | exporting.value = true;
36 |
37 | await exportFilesZip(
38 | `generated-php-classes-${(new Date()).toISOString()}.zip`,
39 | generatePhpExportFilesRecursive(phpClass, settings)
40 | )
41 |
42 | exporting.value = false;
43 | }
44 |
45 | return {
46 | exporting,
47 | exportPhpClassToZip,
48 | };
49 | }
--------------------------------------------------------------------------------
/src/hooks/use-php-code-presenter.ts:
--------------------------------------------------------------------------------
1 | import {computed, ComputedRef, Ref} from 'vue';
2 | import PhpClass from '@/dto/PhpClass';
3 | import PhpClassPresenter from '@/presenters/PhpClassPresenter';
4 | import Settings from '@/dto/Settings';
5 |
6 | interface UsePhpCodePresenterProps {
7 | phpClass: Ref;
8 | settings: Ref;
9 | }
10 |
11 | interface UsePhpCodePresenter {
12 | generatedCodeClasses: ComputedRef;
13 | }
14 |
15 | export const usePhpCodePresenter = ({ phpClass, settings } : UsePhpCodePresenterProps): UsePhpCodePresenter => {
16 | const generateAllCode = (phpClass: PhpClass, s: Settings): string[] => {
17 | const result: string[] = [];
18 | result.push((new PhpClassPresenter(phpClass, s)).toString());
19 |
20 | for (const childClass of phpClass.getChildren()) {
21 | result.push(...generateAllCode(childClass, s));
22 | }
23 |
24 | return result;
25 | }
26 |
27 | const generatedCodeClasses = computed(() => {
28 | if (phpClass.value === null) {
29 | return [];
30 | }
31 |
32 | return generateAllCode(phpClass.value, settings.value);
33 | });
34 |
35 | return {
36 | generatedCodeClasses,
37 | };
38 | }
--------------------------------------------------------------------------------
/src/hooks/use-settings.ts:
--------------------------------------------------------------------------------
1 | import Settings, {
2 | createDefaultSettings,
3 | supportsConstructorPropertyPromotion, supportsReadonlyClasses,
4 | supportsReadonlyProperties
5 | } from '@/dto/Settings';
6 | import { ref, Ref, watch } from 'vue';
7 |
8 | export interface UseSettings {
9 | settings: Ref
10 | }
11 |
12 | export const useSettings = (): UseSettings => {
13 | const settings = ref(createDefaultSettings());
14 |
15 | watch(settings, () => {
16 | // Constructor property promotion checks
17 | if (
18 | settings.value.constructorPropertyPromotion
19 | && !supportsConstructorPropertyPromotion(settings.value)
20 | ) {
21 | settings.value.constructorPropertyPromotion = false;
22 | }
23 |
24 | // Readonly properties checks
25 | if (settings.value.readonlyProperties && !supportsReadonlyProperties(settings.value)) {
26 | settings.value.readonlyProperties = false;
27 | }
28 |
29 | if (settings.value.readonlyProperties) {
30 | settings.value.addSetters = false;
31 | }
32 |
33 | // Readonly classes checks
34 | if (settings.value.readonlyClasses && !supportsReadonlyClasses(settings.value)) {
35 | settings.value.readonlyClasses = false;
36 | }
37 |
38 | if (settings.value.readonlyClasses) {
39 | settings.value.addSetters = false;
40 | settings.value.readonlyProperties = false;
41 | }
42 | });
43 |
44 | return {
45 | settings,
46 | }
47 | }
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue';
2 | import App from '@/App.vue';
3 | import router from '@/router';
4 |
5 | import './assets/scss/theme.scss';
6 |
7 | createApp(App)
8 | .use(router)
9 | .mount('#app');
--------------------------------------------------------------------------------
/src/php-types/BooleanType.ts:
--------------------------------------------------------------------------------
1 | import PhpType from '@/php-types/PhpType';
2 |
3 | export default class BooleanType extends PhpType {
4 | public getType(): string {
5 | return 'bool';
6 | }
7 |
8 | public getDocblockContent(): string {
9 | return 'bool';
10 | }
11 |
12 | public isDocblockRequired(): boolean {
13 | return false;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/php-types/FloatType.ts:
--------------------------------------------------------------------------------
1 | import PhpType from '@/php-types/PhpType';
2 |
3 | export default class FloatType extends PhpType {
4 | public getType(): string {
5 | return 'float';
6 | }
7 |
8 | public getDocblockContent(): string {
9 | return 'float';
10 | }
11 |
12 | public isDocblockRequired(): boolean {
13 | return false;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/php-types/IntType.ts:
--------------------------------------------------------------------------------
1 | import PhpType from '@/php-types/PhpType';
2 |
3 | export default class IntType extends PhpType {
4 | public getType(): string {
5 | return 'int';
6 | }
7 |
8 | public getDocblockContent(): string {
9 | return 'int';
10 | }
11 |
12 | public isDocblockRequired(): boolean {
13 | return false;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/php-types/NullType.ts:
--------------------------------------------------------------------------------
1 | import PhpType from '@/php-types/PhpType';
2 |
3 | export default class NullType extends PhpType {
4 | public getType(): string {
5 | return '';
6 | }
7 |
8 | public getDocblockContent(): string {
9 | return 'null';
10 | }
11 |
12 | public isDocblockRequired(): boolean {
13 | return false;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/php-types/PhpClassType.ts:
--------------------------------------------------------------------------------
1 | import PhpType from '@/php-types/PhpType';
2 | import PhpClass from '@/dto/PhpClass';
3 | import PhpClassPresenter from '@/presenters/PhpClassPresenter';
4 |
5 | export default class PhpClassType extends PhpType {
6 | private readonly phpClass: PhpClass;
7 |
8 | public constructor(phpClass: PhpClass) {
9 | super();
10 | this.phpClass = phpClass;
11 | }
12 |
13 | public getType(): string {
14 | return this.getClassName();
15 | }
16 |
17 | public getDocblockContent(): string {
18 | return this.getClassName();
19 | }
20 |
21 | public isDocblockRequired(): boolean {
22 | return false;
23 | }
24 |
25 | private getClassName(): string {
26 | return this.settings
27 | ? (new PhpClassPresenter(this.phpClass, this.settings)).getClassName()
28 | : this.phpClass.getName();
29 | }
30 | }
--------------------------------------------------------------------------------
/src/php-types/PhpType.ts:
--------------------------------------------------------------------------------
1 | import Settings from '@/dto/Settings';
2 |
3 | export default abstract class PhpType {
4 | protected settings: Settings | null = null;
5 |
6 | abstract getType(): string;
7 |
8 | abstract getDocblockContent(): string;
9 |
10 | abstract isDocblockRequired(): boolean;
11 |
12 | public setSettings(settings: Settings | null): void {
13 | this.settings = settings;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/php-types/StdClassType.ts:
--------------------------------------------------------------------------------
1 | import PhpType from '@/php-types/PhpType';
2 |
3 | export default class StdClassType extends PhpType {
4 | public getType(): string {
5 | return '\\stdClass';
6 | }
7 |
8 | public getDocblockContent(): string {
9 | return '\\stdClass';
10 | }
11 |
12 | public isDocblockRequired(): boolean {
13 | return false;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/php-types/StringType.ts:
--------------------------------------------------------------------------------
1 | import PhpType from '@/php-types/PhpType';
2 |
3 | export default class StringType extends PhpType {
4 | public getType(): string {
5 | return 'string';
6 | }
7 |
8 | public getDocblockContent(): string {
9 | return 'string';
10 | }
11 |
12 | public isDocblockRequired(): boolean {
13 | return false;
14 | }
15 | }
--------------------------------------------------------------------------------
/src/php-types/UnknownType.ts:
--------------------------------------------------------------------------------
1 | import PhpType from '@/php-types/PhpType';
2 | import {supportsMixedType} from '@/dto/Settings';
3 |
4 | export default class UnknownType extends PhpType {
5 | public getType(): string {
6 | return '';
7 | }
8 |
9 | public getDocblockContent(): string {
10 | return 'mixed';
11 | }
12 |
13 | public isDocblockRequired(): boolean {
14 | return !(this.settings !== null && supportsMixedType(this.settings));
15 | }
16 | }
--------------------------------------------------------------------------------
/src/php/ReservedKeywords.ts:
--------------------------------------------------------------------------------
1 | export default class ReservedKeywords {
2 | public static readonly RESERVED_KEYWORDS = [
3 | '__halt_compiler',
4 | 'abstract',
5 | 'and',
6 | 'array',
7 | 'as',
8 | 'break',
9 | 'callable',
10 | 'case',
11 | 'catch',
12 | 'class',
13 | 'clone',
14 | 'const',
15 | 'continue',
16 | 'declare',
17 | 'default',
18 | 'die',
19 | 'do',
20 | 'echo',
21 | 'else',
22 | 'elseif',
23 | 'empty',
24 | 'enddeclare',
25 | 'endfor',
26 | 'endforeach',
27 | 'endif',
28 | 'endswitch',
29 | 'endwhile',
30 | 'eval',
31 | 'exit',
32 | 'extends',
33 | 'final',
34 | 'for',
35 | 'foreach',
36 | 'function',
37 | 'global',
38 | 'goto',
39 | 'if',
40 | 'implements',
41 | 'include',
42 | 'include_once',
43 | 'instanceof',
44 | 'insteadof',
45 | 'interface',
46 | 'isset',
47 | 'list',
48 | 'namespace',
49 | 'new',
50 | 'or',
51 | 'parent',
52 | 'print',
53 | 'private',
54 | 'protected',
55 | 'public',
56 | 'require',
57 | 'require_once',
58 | 'return',
59 | 'self',
60 | 'static',
61 | 'switch',
62 | 'throw',
63 | 'trait',
64 | 'try',
65 | 'unset',
66 | 'use',
67 | 'var',
68 | 'while',
69 | 'xor'
70 | ];
71 |
72 | public static isReserved(keyword: string): boolean {
73 | return this.RESERVED_KEYWORDS.includes(keyword);
74 | }
75 | }
--------------------------------------------------------------------------------
/src/presenters/PhpFluentSetterPresenter.ts:
--------------------------------------------------------------------------------
1 | import PhpSetterPresenter from '@/presenters/PhpSetterPresenter';
2 | import PhpDocblockPresenter from '@/presenters/PhpDocblockPresenter';
3 | import CodeWriter from '@/writers/CodeWriter';
4 | import {PhpVisibility} from '@/enums/PhpVisibility';
5 |
6 | export default class PhpFluentSetterPresenter extends PhpSetterPresenter{
7 | public write(codeWriter: CodeWriter): void {
8 | (new PhpDocblockPresenter(this.settings, [this.propertyTypePresenter], 'self')).write(codeWriter);
9 | codeWriter.openMethod(
10 | PhpVisibility.Public,
11 | this.getMethodName(),
12 | 'self',
13 | [this.getMethodParameter()]
14 | );
15 | codeWriter.writeLine(
16 | `$this->${this.propertyTypePresenter.getPhpVarName()} = ${this.propertyTypePresenter.getPhpVar()};`
17 | );
18 | codeWriter.writeLine('return $this;');
19 | codeWriter.closeMethod();
20 | }
21 | }
--------------------------------------------------------------------------------
/src/presenters/PhpGetterPresenter.ts:
--------------------------------------------------------------------------------
1 | import Settings from '@/dto/Settings';
2 | import Str from '@/support/Str';
3 | import PhpDocblockPresenter from '@/presenters/PhpDocblockPresenter';
4 | import PhpPropertyTypePresenter from '@/presenters/PhpPropertyTypePresenter';
5 | import CodeWriter from '@/writers/CodeWriter';
6 | import {PhpVisibility} from '@/enums/PhpVisibility';
7 |
8 | export default class PhpGetterPresenter {
9 | private readonly propertyTypePresenter: PhpPropertyTypePresenter;
10 | private readonly settings: Settings;
11 |
12 | public constructor(propertyTypePresenter: PhpPropertyTypePresenter, settings: Settings) {
13 | this.propertyTypePresenter = propertyTypePresenter;
14 | this.settings = settings;
15 | }
16 |
17 | public write(codeWriter: CodeWriter): void {
18 | const docblock = new PhpDocblockPresenter(
19 | this.settings,
20 | [],
21 | this.propertyTypePresenter.getDocblockContent(),
22 | this.propertyTypePresenter.getProperty().isDocblockRequired()
23 | );
24 |
25 | const methodName = Str.changeCase('get_' + this.propertyTypePresenter.getPhpVarName(), this.settings.getterCase);
26 |
27 | docblock.write(codeWriter);
28 | codeWriter.openMethod(
29 | PhpVisibility.Public,
30 | methodName,
31 | this.propertyTypePresenter.getPhpTypeNotation(),
32 | []
33 | );
34 | codeWriter.writeLine(`return $this->${this.propertyTypePresenter.getPhpVarName()};`);
35 | codeWriter.closeMethod();
36 | }
37 | }
--------------------------------------------------------------------------------
/src/presenters/PhpPropertyTypePresenter.ts:
--------------------------------------------------------------------------------
1 | import Settings, {supportsUnionType} from '@/dto/Settings';
2 | import Str from '@/support/Str';
3 | import PhpProperty from '@/dto/PhpProperty';
4 |
5 | export default class PhpPropertyTypePresenter {
6 | private readonly property: PhpProperty;
7 | private readonly settings: Settings;
8 |
9 | public constructor(property: PhpProperty, settings: Settings) {
10 | this.property = property;
11 | this.settings = settings;
12 | }
13 |
14 | public getPhpTypeNotation(): string {
15 | if (this.property.getTypes().length === 1) {
16 | return (this.property.isNullable() ? '?' : '') + this.property.getTypes()[0].getType();
17 | }
18 |
19 | if (supportsUnionType(this.settings)) {
20 | const types = this.property.getTypes().map(t => t.getType());
21 |
22 | if (this.property.isNullable()) {
23 | types.push('null');
24 | }
25 |
26 | return types.join('|');
27 | }
28 |
29 | return '';
30 | }
31 |
32 | public getPhpVarName(): string {
33 | return Str.changeCase(this.property.getName(), this.settings.propertyCase);
34 | }
35 |
36 | public getPhpVar(): string {
37 | return '$' + this.getPhpVarName();
38 | }
39 |
40 | public getPhpVarWithType(): string {
41 | let typeNotation = this.getPhpTypeNotation();
42 |
43 | if (typeNotation !== '') {
44 | typeNotation += ' ';
45 | }
46 |
47 | return typeNotation + this.getPhpVar();
48 | }
49 |
50 | public getDocblockContent(): string {
51 | return this.property.getTypes().map(p => p.getDocblockContent()).join('|') + (this.property.isNullable() ? '|null' : '');
52 | }
53 |
54 | public getProperty(): PhpProperty {
55 | return this.property;
56 | }
57 | }
--------------------------------------------------------------------------------
/src/presenters/PhpSetterPresenter.ts:
--------------------------------------------------------------------------------
1 | import Settings from '@/dto/Settings';
2 | import Str from '@/support/Str';
3 | import PhpDocblockPresenter from '@/presenters/PhpDocblockPresenter';
4 | import PhpPropertyTypePresenter from '@/presenters/PhpPropertyTypePresenter';
5 | import CodeWriter from '@/writers/CodeWriter';
6 | import {PhpVisibility} from '@/enums/PhpVisibility';
7 |
8 | export default class PhpSetterPresenter {
9 | protected readonly propertyTypePresenter: PhpPropertyTypePresenter;
10 | protected readonly settings: Settings;
11 |
12 | public constructor(propertyTypePresenter: PhpPropertyTypePresenter, settings: Settings) {
13 | this.propertyTypePresenter = propertyTypePresenter;
14 | this.settings = settings;
15 | }
16 |
17 | public getMethodName(): string {
18 | return Str.changeCase('set_' + this.propertyTypePresenter.getPhpVarName(), this.settings.setterCase);
19 | }
20 |
21 | public write(codeWriter: CodeWriter): void {
22 | (new PhpDocblockPresenter(this.settings, [this.propertyTypePresenter], 'void')).write(codeWriter);
23 | codeWriter.openMethod(
24 | PhpVisibility.Public,
25 | this.getMethodName(),
26 | 'void',
27 | [this.getMethodParameter()]
28 | );
29 | codeWriter.writeLine(
30 | `$this->${this.propertyTypePresenter.getPhpVarName()} = ${this.propertyTypePresenter.getPhpVar()};`
31 | );
32 | codeWriter.closeMethod();
33 | }
34 |
35 | protected getMethodParameter(): string {
36 | return this.propertyTypePresenter.getPhpVarWithType();
37 | }
38 | }
--------------------------------------------------------------------------------
/src/router/index.ts:
--------------------------------------------------------------------------------
1 | import {createRouter, createWebHashHistory} from 'vue-router';
2 | import Generator from '@/views/Generator.vue';
3 |
4 | const routes = [
5 | {
6 | path: '/',
7 | name: 'Generator',
8 | component: Generator
9 | }
10 | ];
11 |
12 | const router = createRouter({
13 | history: createWebHashHistory(),
14 | routes,
15 | })
16 |
17 | export default router
18 |
--------------------------------------------------------------------------------
/src/support/EnumSelect.ts:
--------------------------------------------------------------------------------
1 | import SelectOption from '@/dto/SelectOption';
2 |
3 | export default class EnumSelect {
4 | public static getOptions(enumObject: Record): SelectOption[] {
5 | const options: SelectOption[] = [];
6 | const keys = Object.keys(enumObject);
7 |
8 | for (const key of keys) {
9 | options.push(new SelectOption(enumObject[key] as string, enumObject[key] as string));
10 | }
11 |
12 | return options;
13 | }
14 | }
--------------------------------------------------------------------------------
/src/support/Str.ts:
--------------------------------------------------------------------------------
1 | import {StringCase} from '@/enums/StringCase';
2 | import {camelCase, pascalCase, snakeCase} from 'change-case';
3 |
4 | export default class Str {
5 | public static changeCase(value: string, stringCase: StringCase): string {
6 | switch (stringCase) {
7 | case StringCase.CamelCase:
8 | return camelCase(value);
9 | case StringCase.PascalCase:
10 | return pascalCase(value);
11 | case StringCase.SnakeCase:
12 | return snakeCase(value);
13 | }
14 |
15 | return value;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/tailwind.config.js:
--------------------------------------------------------------------------------
1 | const colors = require('tailwindcss/colors')
2 |
3 | module.exports = {
4 | darkMode: 'class',
5 | content: [
6 | './public/**/*.html',
7 | './src/**/*.vue',
8 | './src/**/*.scss',
9 | ],
10 | theme: {
11 | fontFamily: {
12 | display: ['Gilroy', 'sans-serif'],
13 | body: ['Graphik', 'sans-serif'],
14 | },
15 | extend: {
16 | colors: {
17 | primary: colors.sky,
18 | dark: colors.gray,
19 | danger: colors.red,
20 | }
21 | }
22 | }
23 | };
--------------------------------------------------------------------------------
/tests/converter/fixtures/all_types_json.txt:
--------------------------------------------------------------------------------
1 | {
2 | "string_array": [
3 | "test",
4 | "test"
5 | ],
6 | "mixed_array": [
7 | "test",
8 | 1,
9 | null
10 | ],
11 | "null_array": [null],
12 | "unknown_array": [],
13 | "boolean": false,
14 | "float": 0.5,
15 | "int": 1,
16 | "null": null,
17 | "nested_class": {
18 | "var": 2
19 | },
20 | "string": "test"
21 | }
--------------------------------------------------------------------------------
/tests/converter/fixtures/merges_nested_arrays.txt:
--------------------------------------------------------------------------------
1 | {
2 | "simple_nesting": [
3 | {
4 | "always_present": 0.5,
5 | "string": "string",
6 | "object": {
7 | "test": 2
8 | }
9 | },
10 | {
11 | "always_present": 0.5,
12 | "number": 1,
13 | "object": null
14 | },
15 | {
16 | "always_present": 0.5,
17 | "number": 1,
18 | "object": {
19 | "another_test": 3
20 | }
21 | }
22 | ]
23 | }
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/all_types_json_php_7_3_with_constructor.txt:
--------------------------------------------------------------------------------
1 | stringArray = $stringArray;
35 | $this->mixedArray = $mixedArray;
36 | $this->nullArray = $nullArray;
37 | $this->unknownArray = $unknownArray;
38 | $this->boolean = $boolean;
39 | $this->float = $float;
40 | $this->int = $int;
41 | $this->null = $null;
42 | $this->nestedClass = $nestedClass;
43 | $this->string = $string;
44 | }
45 | }
46 |
47 | var = $var;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/all_types_json_php_7_3_with_constructor_and_readonly_properties.txt:
--------------------------------------------------------------------------------
1 | stringArray = $stringArray;
35 | $this->mixedArray = $mixedArray;
36 | $this->nullArray = $nullArray;
37 | $this->unknownArray = $unknownArray;
38 | $this->boolean = $boolean;
39 | $this->float = $float;
40 | $this->int = $int;
41 | $this->null = $null;
42 | $this->nestedClass = $nestedClass;
43 | $this->string = $string;
44 | }
45 | }
46 |
47 | var = $var;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/all_types_json_php_7_3_with_constructor_readonly_properties_and_promoted_properties.txt:
--------------------------------------------------------------------------------
1 | stringArray = $stringArray;
35 | $this->mixedArray = $mixedArray;
36 | $this->nullArray = $nullArray;
37 | $this->unknownArray = $unknownArray;
38 | $this->boolean = $boolean;
39 | $this->float = $float;
40 | $this->int = $int;
41 | $this->null = $null;
42 | $this->nestedClass = $nestedClass;
43 | $this->string = $string;
44 | }
45 | }
46 |
47 | var = $var;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/all_types_json_php_7_3_with_custom_namespace_root_class_name_and_strict_types.txt:
--------------------------------------------------------------------------------
1 | stringArray = $stringArray;
35 | $this->mixedArray = $mixedArray;
36 | $this->nullArray = $nullArray;
37 | $this->unknownArray = $unknownArray;
38 | $this->boolean = $boolean;
39 | $this->float = $float;
40 | $this->int = $int;
41 | $this->null = $null;
42 | $this->nestedClass = $nestedClass;
43 | $this->string = $string;
44 | }
45 | }
46 |
47 | var = $var;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/all_types_json_php_7_4_with_constructor_and_readonly_properties.txt:
--------------------------------------------------------------------------------
1 | stringArray = $stringArray;
35 | $this->mixedArray = $mixedArray;
36 | $this->nullArray = $nullArray;
37 | $this->unknownArray = $unknownArray;
38 | $this->boolean = $boolean;
39 | $this->float = $float;
40 | $this->int = $int;
41 | $this->null = $null;
42 | $this->nestedClass = $nestedClass;
43 | $this->string = $string;
44 | }
45 | }
46 |
47 | var = $var;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/all_types_json_php_7_4_with_constructor_readonly_properties_and_promoted_properties.txt:
--------------------------------------------------------------------------------
1 | stringArray = $stringArray;
35 | $this->mixedArray = $mixedArray;
36 | $this->nullArray = $nullArray;
37 | $this->unknownArray = $unknownArray;
38 | $this->boolean = $boolean;
39 | $this->float = $float;
40 | $this->int = $int;
41 | $this->null = $null;
42 | $this->nestedClass = $nestedClass;
43 | $this->string = $string;
44 | }
45 | }
46 |
47 | var = $var;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/all_types_json_php_7_4_with_custom_namespace_root_class_name_and_strict_types.txt:
--------------------------------------------------------------------------------
1 | stringArray = $stringArray;
35 | $this->mixedArray = $mixedArray;
36 | $this->nullArray = $nullArray;
37 | $this->unknownArray = $unknownArray;
38 | $this->boolean = $boolean;
39 | $this->float = $float;
40 | $this->int = $int;
41 | $this->null = $null;
42 | $this->nestedClass = $nestedClass;
43 | $this->string = $string;
44 | }
45 | }
46 |
47 | var = $var;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/all_types_json_php_8_0_with_constructor_and_readonly_properties.txt:
--------------------------------------------------------------------------------
1 | stringArray = $stringArray;
35 | $this->mixedArray = $mixedArray;
36 | $this->nullArray = $nullArray;
37 | $this->unknownArray = $unknownArray;
38 | $this->boolean = $boolean;
39 | $this->float = $float;
40 | $this->int = $int;
41 | $this->null = $null;
42 | $this->nestedClass = $nestedClass;
43 | $this->string = $string;
44 | }
45 | }
46 |
47 | var = $var;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/all_types_json_php_8_0_with_constructor_readonly_properties_and_promoted_properties.txt:
--------------------------------------------------------------------------------
1 | string_array,
27 | $data->mixed_array,
28 | $data->null_array,
29 | $data->unknown_array,
30 | $data->boolean,
31 | $data->float,
32 | $data->int,
33 | $data->null ?? null,
34 | NestedClass::fromJson($data->nested_class),
35 | $data->string
36 | );
37 | }
38 | }
39 |
40 | var
52 | );
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/all_types_json_php_8_0_with_custom_namespace_root_class_name_and_strict_types.txt:
--------------------------------------------------------------------------------
1 | stringArray = $stringArray;
35 | $this->mixedArray = $mixedArray;
36 | $this->nullArray = $nullArray;
37 | $this->unknownArray = $unknownArray;
38 | $this->boolean = $boolean;
39 | $this->float = $float;
40 | $this->int = $int;
41 | $this->null = $null;
42 | $this->nestedClass = $nestedClass;
43 | $this->string = $string;
44 | }
45 | }
46 |
47 | var = $var;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/all_types_json_php_8_1_with_constructor_and_readonly_properties.txt:
--------------------------------------------------------------------------------
1 | stringArray = $stringArray;
35 | $this->mixedArray = $mixedArray;
36 | $this->nullArray = $nullArray;
37 | $this->unknownArray = $unknownArray;
38 | $this->boolean = $boolean;
39 | $this->float = $float;
40 | $this->int = $int;
41 | $this->null = $null;
42 | $this->nestedClass = $nestedClass;
43 | $this->string = $string;
44 | }
45 | }
46 |
47 | var = $var;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/all_types_json_php_8_1_with_constructor_readonly_properties_and_promoted_properties.txt:
--------------------------------------------------------------------------------
1 | string_array,
27 | $data->mixed_array,
28 | $data->null_array,
29 | $data->unknown_array,
30 | $data->boolean,
31 | $data->float,
32 | $data->int,
33 | $data->null ?? null,
34 | NestedClass::fromJson($data->nested_class),
35 | $data->string
36 | );
37 | }
38 | }
39 |
40 | var
52 | );
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/all_types_json_php_8_1_with_custom_namespace_root_class_name_and_strict_types.txt:
--------------------------------------------------------------------------------
1 | stringArray = $stringArray;
35 | $this->mixedArray = $mixedArray;
36 | $this->nullArray = $nullArray;
37 | $this->unknownArray = $unknownArray;
38 | $this->boolean = $boolean;
39 | $this->float = $float;
40 | $this->int = $int;
41 | $this->null = $null;
42 | $this->nestedClass = $nestedClass;
43 | $this->string = $string;
44 | }
45 | }
46 |
47 | var = $var;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/all_types_json_php_8_2_with_constructor_and_readonly_properties.txt:
--------------------------------------------------------------------------------
1 | stringArray = $stringArray;
35 | $this->mixedArray = $mixedArray;
36 | $this->nullArray = $nullArray;
37 | $this->unknownArray = $unknownArray;
38 | $this->boolean = $boolean;
39 | $this->float = $float;
40 | $this->int = $int;
41 | $this->null = $null;
42 | $this->nestedClass = $nestedClass;
43 | $this->string = $string;
44 | }
45 | }
46 |
47 | var = $var;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/all_types_json_php_8_2_with_constructor_readonly_properties_and_promoted_properties.txt:
--------------------------------------------------------------------------------
1 | string_array,
27 | $data->mixed_array,
28 | $data->null_array,
29 | $data->unknown_array,
30 | $data->boolean,
31 | $data->float,
32 | $data->int,
33 | $data->null ?? null,
34 | NestedClass::fromJson($data->nested_class),
35 | $data->string
36 | );
37 | }
38 | }
39 |
40 | var
52 | );
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/all_types_json_php_8_2_with_custom_namespace_root_class_name_and_strict_types.txt:
--------------------------------------------------------------------------------
1 | stringArray = $stringArray;
35 | $this->mixedArray = $mixedArray;
36 | $this->nullArray = $nullArray;
37 | $this->unknownArray = $unknownArray;
38 | $this->boolean = $boolean;
39 | $this->float = $float;
40 | $this->int = $int;
41 | $this->null = $null;
42 | $this->nestedClass = $nestedClass;
43 | $this->string = $string;
44 | }
45 | }
46 |
47 | var = $var;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/all_types_json_php_8_3_with_constructor_and_readonly_properties.txt:
--------------------------------------------------------------------------------
1 | stringArray = $stringArray;
35 | $this->mixedArray = $mixedArray;
36 | $this->nullArray = $nullArray;
37 | $this->unknownArray = $unknownArray;
38 | $this->boolean = $boolean;
39 | $this->float = $float;
40 | $this->int = $int;
41 | $this->null = $null;
42 | $this->nestedClass = $nestedClass;
43 | $this->string = $string;
44 | }
45 | }
46 |
47 | var = $var;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/all_types_json_php_8_3_with_constructor_readonly_properties_and_promoted_properties.txt:
--------------------------------------------------------------------------------
1 | string_array,
27 | $data->mixed_array,
28 | $data->null_array,
29 | $data->unknown_array,
30 | $data->boolean,
31 | $data->float,
32 | $data->int,
33 | $data->null ?? null,
34 | NestedClass::fromJson($data->nested_class),
35 | $data->string
36 | );
37 | }
38 | }
39 |
40 | var
52 | );
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/all_types_json_php_8_3_with_custom_namespace_root_class_name_and_strict_types.txt:
--------------------------------------------------------------------------------
1 | simpleNesting = $simpleNesting;
14 | }
15 | }
16 |
17 | alwaysPresent = $alwaysPresent;
33 | $this->string = $string;
34 | $this->object = $object;
35 | $this->number = $number;
36 | }
37 | }
38 |
39 | test = $test;
49 | $this->anotherTest = $anotherTest;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_7_3_with_constructor_and_readonly_properties.txt:
--------------------------------------------------------------------------------
1 | simpleNesting = $simpleNesting;
14 | }
15 | }
16 |
17 | alwaysPresent = $alwaysPresent;
33 | $this->string = $string;
34 | $this->object = $object;
35 | $this->number = $number;
36 | }
37 | }
38 |
39 | test = $test;
49 | $this->anotherTest = $anotherTest;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_7_3_with_constructor_readonly_properties_and_promoted_properties.txt:
--------------------------------------------------------------------------------
1 | simpleNesting = $simpleNesting;
14 | }
15 | }
16 |
17 | alwaysPresent = $alwaysPresent;
33 | $this->string = $string;
34 | $this->object = $object;
35 | $this->number = $number;
36 | }
37 | }
38 |
39 | test = $test;
49 | $this->anotherTest = $anotherTest;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_7_3_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt:
--------------------------------------------------------------------------------
1 | simpleNesting = $simpleNesting;
14 | }
15 |
16 | public static function fromJson(array $data): self
17 | {
18 | return new self(
19 | array_map(static function($data) {
20 | return SimpleNesting::fromJson($data);
21 | }, $data['simple_nesting'])
22 | );
23 | }
24 | }
25 |
26 | alwaysPresent = $alwaysPresent;
42 | $this->string = $string;
43 | $this->object = $object;
44 | $this->number = $number;
45 | }
46 |
47 | public static function fromJson(array $data): self
48 | {
49 | return new self(
50 | $data['always_present'],
51 | $data['string'] ?? null,
52 | ($data['object'] ?? null) !== null ? Object::fromJson($data['object']) : null,
53 | $data['number'] ?? null
54 | );
55 | }
56 | }
57 |
58 | test = $test;
68 | $this->anotherTest = $anotherTest;
69 | }
70 |
71 | public static function fromJson(array $data): self
72 | {
73 | return new self(
74 | $data['test'] ?? null,
75 | $data['another_test'] ?? null
76 | );
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_7_3_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt:
--------------------------------------------------------------------------------
1 | simpleNesting = $simpleNesting;
14 | }
15 |
16 | public static function fromJson(\stdClass $data): self
17 | {
18 | return new self(
19 | array_map(static function($data) {
20 | return SimpleNesting::fromJson($data);
21 | }, $data->simple_nesting)
22 | );
23 | }
24 | }
25 |
26 | alwaysPresent = $alwaysPresent;
42 | $this->string = $string;
43 | $this->object = $object;
44 | $this->number = $number;
45 | }
46 |
47 | public static function fromJson(\stdClass $data): self
48 | {
49 | return new self(
50 | $data->always_present,
51 | $data->string ?? null,
52 | ($data->object ?? null) !== null ? Object::fromJson($data->object) : null,
53 | $data->number ?? null
54 | );
55 | }
56 | }
57 |
58 | test = $test;
68 | $this->anotherTest = $anotherTest;
69 | }
70 |
71 | public static function fromJson(\stdClass $data): self
72 | {
73 | return new self(
74 | $data->test ?? null,
75 | $data->another_test ?? null
76 | );
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_7_3_with_custom_namespace_root_class_name_and_strict_types.txt:
--------------------------------------------------------------------------------
1 | simpleNesting = $simpleNesting;
14 | }
15 | }
16 |
17 | alwaysPresent = $alwaysPresent;
33 | $this->string = $string;
34 | $this->object = $object;
35 | $this->number = $number;
36 | }
37 | }
38 |
39 | test = $test;
49 | $this->anotherTest = $anotherTest;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_7_4_with_constructor_and_readonly_properties.txt:
--------------------------------------------------------------------------------
1 | simpleNesting = $simpleNesting;
14 | }
15 | }
16 |
17 | alwaysPresent = $alwaysPresent;
33 | $this->string = $string;
34 | $this->object = $object;
35 | $this->number = $number;
36 | }
37 | }
38 |
39 | test = $test;
49 | $this->anotherTest = $anotherTest;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_7_4_with_constructor_readonly_properties_and_promoted_properties.txt:
--------------------------------------------------------------------------------
1 | simpleNesting = $simpleNesting;
14 | }
15 | }
16 |
17 | alwaysPresent = $alwaysPresent;
33 | $this->string = $string;
34 | $this->object = $object;
35 | $this->number = $number;
36 | }
37 | }
38 |
39 | test = $test;
49 | $this->anotherTest = $anotherTest;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_7_4_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt:
--------------------------------------------------------------------------------
1 | simpleNesting = $simpleNesting;
14 | }
15 |
16 | public static function fromJson(array $data): self
17 | {
18 | return new self(
19 | array_map(static function($data) {
20 | return SimpleNesting::fromJson($data);
21 | }, $data['simple_nesting'])
22 | );
23 | }
24 | }
25 |
26 | alwaysPresent = $alwaysPresent;
42 | $this->string = $string;
43 | $this->object = $object;
44 | $this->number = $number;
45 | }
46 |
47 | public static function fromJson(array $data): self
48 | {
49 | return new self(
50 | $data['always_present'],
51 | $data['string'] ?? null,
52 | ($data['object'] ?? null) !== null ? Object::fromJson($data['object']) : null,
53 | $data['number'] ?? null
54 | );
55 | }
56 | }
57 |
58 | test = $test;
68 | $this->anotherTest = $anotherTest;
69 | }
70 |
71 | public static function fromJson(array $data): self
72 | {
73 | return new self(
74 | $data['test'] ?? null,
75 | $data['another_test'] ?? null
76 | );
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_7_4_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt:
--------------------------------------------------------------------------------
1 | simpleNesting = $simpleNesting;
14 | }
15 |
16 | public static function fromJson(\stdClass $data): self
17 | {
18 | return new self(
19 | array_map(static function($data) {
20 | return SimpleNesting::fromJson($data);
21 | }, $data->simple_nesting)
22 | );
23 | }
24 | }
25 |
26 | alwaysPresent = $alwaysPresent;
42 | $this->string = $string;
43 | $this->object = $object;
44 | $this->number = $number;
45 | }
46 |
47 | public static function fromJson(\stdClass $data): self
48 | {
49 | return new self(
50 | $data->always_present,
51 | $data->string ?? null,
52 | ($data->object ?? null) !== null ? Object::fromJson($data->object) : null,
53 | $data->number ?? null
54 | );
55 | }
56 | }
57 |
58 | test = $test;
68 | $this->anotherTest = $anotherTest;
69 | }
70 |
71 | public static function fromJson(\stdClass $data): self
72 | {
73 | return new self(
74 | $data->test ?? null,
75 | $data->another_test ?? null
76 | );
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_7_4_with_custom_namespace_root_class_name_and_strict_types.txt:
--------------------------------------------------------------------------------
1 | simpleNesting = $simpleNesting;
14 | }
15 | }
16 |
17 | alwaysPresent = $alwaysPresent;
33 | $this->string = $string;
34 | $this->object = $object;
35 | $this->number = $number;
36 | }
37 | }
38 |
39 | test = $test;
49 | $this->anotherTest = $anotherTest;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_8_0_with_constructor_and_readonly_properties.txt:
--------------------------------------------------------------------------------
1 | simpleNesting = $simpleNesting;
14 | }
15 | }
16 |
17 | alwaysPresent = $alwaysPresent;
33 | $this->string = $string;
34 | $this->object = $object;
35 | $this->number = $number;
36 | }
37 | }
38 |
39 | test = $test;
49 | $this->anotherTest = $anotherTest;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_8_0_with_constructor_readonly_properties_and_promoted_properties.txt:
--------------------------------------------------------------------------------
1 | simple_nesting)
18 | );
19 | }
20 | }
21 |
22 | always_present,
38 | $data->string ?? null,
39 | ($data->object ?? null) !== null ? Object::fromJson($data->object) : null,
40 | $data->number ?? null
41 | );
42 | }
43 | }
44 |
45 | test ?? null,
57 | $data->another_test ?? null
58 | );
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_8_0_with_custom_namespace_root_class_name_and_strict_types.txt:
--------------------------------------------------------------------------------
1 | simpleNesting = $simpleNesting;
14 | }
15 | }
16 |
17 | alwaysPresent = $alwaysPresent;
33 | $this->string = $string;
34 | $this->object = $object;
35 | $this->number = $number;
36 | }
37 | }
38 |
39 | test = $test;
49 | $this->anotherTest = $anotherTest;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_8_1_with_constructor_and_readonly_properties.txt:
--------------------------------------------------------------------------------
1 | simpleNesting = $simpleNesting;
14 | }
15 | }
16 |
17 | alwaysPresent = $alwaysPresent;
33 | $this->string = $string;
34 | $this->object = $object;
35 | $this->number = $number;
36 | }
37 | }
38 |
39 | test = $test;
49 | $this->anotherTest = $anotherTest;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_8_1_with_constructor_readonly_properties_and_promoted_properties.txt:
--------------------------------------------------------------------------------
1 | simple_nesting)
18 | );
19 | }
20 | }
21 |
22 | always_present,
38 | $data->string ?? null,
39 | ($data->object ?? null) !== null ? Object::fromJson($data->object) : null,
40 | $data->number ?? null
41 | );
42 | }
43 | }
44 |
45 | test ?? null,
57 | $data->another_test ?? null
58 | );
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_8_1_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt:
--------------------------------------------------------------------------------
1 | simpleNesting;
18 | }
19 | }
20 |
21 | alwaysPresent;
36 | }
37 |
38 | public function getString(): ?string
39 | {
40 | return $this->string;
41 | }
42 |
43 | public function getObject(): ?Object
44 | {
45 | return $this->object;
46 | }
47 |
48 | public function getNumber(): ?int
49 | {
50 | return $this->number;
51 | }
52 | }
53 |
54 | test;
65 | }
66 |
67 | public function getAnotherTest(): ?int
68 | {
69 | return $this->anotherTest;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_8_1_with_custom_namespace_root_class_name_and_strict_types.txt:
--------------------------------------------------------------------------------
1 | simpleNesting = $simpleNesting;
14 | }
15 | }
16 |
17 | alwaysPresent = $alwaysPresent;
33 | $this->string = $string;
34 | $this->object = $object;
35 | $this->number = $number;
36 | }
37 | }
38 |
39 | test = $test;
49 | $this->anotherTest = $anotherTest;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_8_2_with_constructor_and_readonly_properties.txt:
--------------------------------------------------------------------------------
1 | simpleNesting = $simpleNesting;
14 | }
15 | }
16 |
17 | alwaysPresent = $alwaysPresent;
33 | $this->string = $string;
34 | $this->object = $object;
35 | $this->number = $number;
36 | }
37 | }
38 |
39 | test = $test;
49 | $this->anotherTest = $anotherTest;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_8_2_with_constructor_readonly_properties_and_promoted_properties.txt:
--------------------------------------------------------------------------------
1 | simple_nesting)
18 | );
19 | }
20 | }
21 |
22 | always_present,
38 | $data->string ?? null,
39 | ($data->object ?? null) !== null ? Object::fromJson($data->object) : null,
40 | $data->number ?? null
41 | );
42 | }
43 | }
44 |
45 | test ?? null,
57 | $data->another_test ?? null
58 | );
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_8_2_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt:
--------------------------------------------------------------------------------
1 | simpleNesting;
18 | }
19 | }
20 |
21 | alwaysPresent;
36 | }
37 |
38 | public function getString(): ?string
39 | {
40 | return $this->string;
41 | }
42 |
43 | public function getObject(): ?Object
44 | {
45 | return $this->object;
46 | }
47 |
48 | public function getNumber(): ?int
49 | {
50 | return $this->number;
51 | }
52 | }
53 |
54 | test;
65 | }
66 |
67 | public function getAnotherTest(): ?int
68 | {
69 | return $this->anotherTest;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_8_2_with_custom_namespace_root_class_name_and_strict_types.txt:
--------------------------------------------------------------------------------
1 | simpleNesting = $simpleNesting;
14 | }
15 | }
16 |
17 | alwaysPresent = $alwaysPresent;
33 | $this->string = $string;
34 | $this->object = $object;
35 | $this->number = $number;
36 | }
37 | }
38 |
39 | test = $test;
49 | $this->anotherTest = $anotherTest;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_8_3_with_constructor_and_readonly_properties.txt:
--------------------------------------------------------------------------------
1 | simpleNesting = $simpleNesting;
14 | }
15 | }
16 |
17 | alwaysPresent = $alwaysPresent;
33 | $this->string = $string;
34 | $this->object = $object;
35 | $this->number = $number;
36 | }
37 | }
38 |
39 | test = $test;
49 | $this->anotherTest = $anotherTest;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_8_3_with_constructor_readonly_properties_and_promoted_properties.txt:
--------------------------------------------------------------------------------
1 | simple_nesting)
18 | );
19 | }
20 | }
21 |
22 | always_present,
38 | $data->string ?? null,
39 | ($data->object ?? null) !== null ? Object::fromJson($data->object) : null,
40 | $data->number ?? null
41 | );
42 | }
43 | }
44 |
45 | test ?? null,
57 | $data->another_test ?? null
58 | );
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_8_3_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt:
--------------------------------------------------------------------------------
1 | simpleNesting;
18 | }
19 | }
20 |
21 | alwaysPresent;
36 | }
37 |
38 | public function getString(): ?string
39 | {
40 | return $this->string;
41 | }
42 |
43 | public function getObject(): ?Object
44 | {
45 | return $this->object;
46 | }
47 |
48 | public function getNumber(): ?int
49 | {
50 | return $this->number;
51 | }
52 | }
53 |
54 | test;
65 | }
66 |
67 | public function getAnotherTest(): ?int
68 | {
69 | return $this->anotherTest;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/merges_nested_arrays_php_8_3_with_custom_namespace_root_class_name_and_strict_types.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_7_3_with_constructor_and_readonly_properties.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_7_3_with_constructor_promoted_properties_getters_and_setters.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 |
12 | public function getTest(): int
13 | {
14 | return $this->test;
15 | }
16 |
17 | public function setTest(int $test): void
18 | {
19 | $this->test = $test;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_7_3_with_constructor_readonly_properties_and_promoted_properties.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_7_3_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 |
12 | public static function fromJson(array $data): self
13 | {
14 | return new self(
15 | $data['test']
16 | );
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_7_3_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 |
12 | public static function fromJson(\stdClass $data): self
13 | {
14 | return new self(
15 | $data->test
16 | );
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_7_3_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 |
12 | public function getTest(): int
13 | {
14 | return $this->test;
15 | }
16 |
17 | public function setTest(int $test): void
18 | {
19 | $this->test = $test;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_7_3_with_custom_namespace_root_class_name_and_strict_types.txt:
--------------------------------------------------------------------------------
1 | test;
16 | }
17 |
18 | /**
19 | * @param int $test
20 | * @return self
21 | */
22 | public function setTest(int $test): self
23 | {
24 | $this->test = $test;
25 | return $this;
26 | }
27 |
28 | /**
29 | * @param array $data
30 | * @return self
31 | */
32 | public static function fromJson(array $data): self
33 | {
34 | $instance = new self();
35 | $instance->setTest($data['test']);
36 | return $instance;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_7_3_with_setters_and_from_json_array_method.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 |
12 | public static function fromJson(array $data): self
13 | {
14 | $instance = new self();
15 | $instance->setTest($data['test']);
16 | return $instance;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_7_3_with_setters_and_from_json_method.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 |
12 | public static function fromJson(\stdClass $data): self
13 | {
14 | $instance = new self();
15 | $instance->setTest($data->test);
16 | return $instance;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_7_3_without_constructor.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_7_4_with_constructor_and_readonly_properties.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_7_4_with_constructor_promoted_properties_getters_and_setters.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 |
12 | public function getTest(): int
13 | {
14 | return $this->test;
15 | }
16 |
17 | public function setTest(int $test): void
18 | {
19 | $this->test = $test;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_7_4_with_constructor_readonly_properties_and_promoted_properties.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_7_4_with_constructor_readonly_properties_promoted_properties_and_from_json_array_method.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 |
12 | public static function fromJson(array $data): self
13 | {
14 | return new self(
15 | $data['test']
16 | );
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_7_4_with_constructor_readonly_properties_promoted_properties_and_from_json_method.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 |
12 | public static function fromJson(\stdClass $data): self
13 | {
14 | return new self(
15 | $data->test
16 | );
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_7_4_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 |
12 | public function getTest(): int
13 | {
14 | return $this->test;
15 | }
16 |
17 | public function setTest(int $test): void
18 | {
19 | $this->test = $test;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_7_4_with_custom_namespace_root_class_name_and_strict_types.txt:
--------------------------------------------------------------------------------
1 | test;
16 | }
17 |
18 | /**
19 | * @param int $test
20 | * @return self
21 | */
22 | public function setTest(int $test): self
23 | {
24 | $this->test = $test;
25 | return $this;
26 | }
27 |
28 | /**
29 | * @param array $data
30 | * @return self
31 | */
32 | public static function fromJson(array $data): self
33 | {
34 | $instance = new self();
35 | $instance->setTest($data['test']);
36 | return $instance;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_7_4_with_setters_and_from_json_array_method.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 |
12 | public static function fromJson(array $data): self
13 | {
14 | $instance = new self();
15 | $instance->setTest($data['test']);
16 | return $instance;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_7_4_with_setters_and_from_json_method.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 |
12 | public static function fromJson(\stdClass $data): self
13 | {
14 | $instance = new self();
15 | $instance->setTest($data->test);
16 | return $instance;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_7_4_without_constructor.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_0_with_constructor_and_readonly_properties.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_0_with_constructor_promoted_properties_getters_and_setters.txt:
--------------------------------------------------------------------------------
1 | test;
12 | }
13 |
14 | public function setTest(int $test): void
15 | {
16 | $this->test = $test;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_0_with_constructor_readonly_properties_and_promoted_properties.txt:
--------------------------------------------------------------------------------
1 | test
13 | );
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_0_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt:
--------------------------------------------------------------------------------
1 | test;
12 | }
13 |
14 | public function setTest(int $test): void
15 | {
16 | $this->test = $test;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_0_with_custom_namespace_root_class_name_and_strict_types.txt:
--------------------------------------------------------------------------------
1 | test;
16 | }
17 |
18 | /**
19 | * @param int $test
20 | * @return self
21 | */
22 | public function setTest(int $test): self
23 | {
24 | $this->test = $test;
25 | return $this;
26 | }
27 |
28 | /**
29 | * @param array $data
30 | * @return self
31 | */
32 | public static function fromJson(array $data): self
33 | {
34 | $instance = new self();
35 | $instance->setTest($data['test']);
36 | return $instance;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_0_with_setters_and_from_json_array_method.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 |
12 | public static function fromJson(array $data): self
13 | {
14 | $instance = new self();
15 | $instance->setTest($data['test']);
16 | return $instance;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_0_with_setters_and_from_json_method.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 |
12 | public static function fromJson(\stdClass $data): self
13 | {
14 | $instance = new self();
15 | $instance->setTest($data->test);
16 | return $instance;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_0_without_constructor.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_1_with_constructor_and_readonly_properties.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_1_with_constructor_promoted_properties_getters_and_setters.txt:
--------------------------------------------------------------------------------
1 | test;
12 | }
13 |
14 | public function setTest(int $test): void
15 | {
16 | $this->test = $test;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_1_with_constructor_readonly_properties_and_promoted_properties.txt:
--------------------------------------------------------------------------------
1 | test
13 | );
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_1_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt:
--------------------------------------------------------------------------------
1 | test;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_1_with_custom_namespace_root_class_name_and_strict_types.txt:
--------------------------------------------------------------------------------
1 | test;
16 | }
17 |
18 | /**
19 | * @param int $test
20 | * @return self
21 | */
22 | public function setTest(int $test): self
23 | {
24 | $this->test = $test;
25 | return $this;
26 | }
27 |
28 | /**
29 | * @param array $data
30 | * @return self
31 | */
32 | public static function fromJson(array $data): self
33 | {
34 | $instance = new self();
35 | $instance->setTest($data['test']);
36 | return $instance;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_1_with_setters_and_from_json_array_method.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 |
12 | public static function fromJson(array $data): self
13 | {
14 | $instance = new self();
15 | $instance->setTest($data['test']);
16 | return $instance;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_1_with_setters_and_from_json_method.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 |
12 | public static function fromJson(\stdClass $data): self
13 | {
14 | $instance = new self();
15 | $instance->setTest($data->test);
16 | return $instance;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_1_without_constructor.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_2_with_constructor_and_readonly_properties.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_2_with_constructor_promoted_properties_getters_and_setters.txt:
--------------------------------------------------------------------------------
1 | test;
12 | }
13 |
14 | public function setTest(int $test): void
15 | {
16 | $this->test = $test;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_2_with_constructor_readonly_properties_and_promoted_properties.txt:
--------------------------------------------------------------------------------
1 | test
13 | );
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_2_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt:
--------------------------------------------------------------------------------
1 | test;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_2_with_custom_namespace_root_class_name_and_strict_types.txt:
--------------------------------------------------------------------------------
1 | test;
16 | }
17 |
18 | /**
19 | * @param int $test
20 | * @return self
21 | */
22 | public function setTest(int $test): self
23 | {
24 | $this->test = $test;
25 | return $this;
26 | }
27 |
28 | /**
29 | * @param array $data
30 | * @return self
31 | */
32 | public static function fromJson(array $data): self
33 | {
34 | $instance = new self();
35 | $instance->setTest($data['test']);
36 | return $instance;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_2_with_setters_and_from_json_array_method.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 |
12 | public static function fromJson(array $data): self
13 | {
14 | $instance = new self();
15 | $instance->setTest($data['test']);
16 | return $instance;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_2_with_setters_and_from_json_method.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 |
12 | public static function fromJson(\stdClass $data): self
13 | {
14 | $instance = new self();
15 | $instance->setTest($data->test);
16 | return $instance;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_2_without_constructor.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_3_with_constructor_and_readonly_properties.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_3_with_constructor_promoted_properties_getters_and_setters.txt:
--------------------------------------------------------------------------------
1 | test;
12 | }
13 |
14 | public function setTest(int $test): void
15 | {
16 | $this->test = $test;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_3_with_constructor_readonly_properties_and_promoted_properties.txt:
--------------------------------------------------------------------------------
1 | test
13 | );
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_3_with_constructor_readonly_properties_promoted_properties_getters_and_setters.txt:
--------------------------------------------------------------------------------
1 | test;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_3_with_custom_namespace_root_class_name_and_strict_types.txt:
--------------------------------------------------------------------------------
1 | test;
16 | }
17 |
18 | /**
19 | * @param int $test
20 | * @return self
21 | */
22 | public function setTest(int $test): self
23 | {
24 | $this->test = $test;
25 | return $this;
26 | }
27 |
28 | /**
29 | * @param array $data
30 | * @return self
31 | */
32 | public static function fromJson(array $data): self
33 | {
34 | $instance = new self();
35 | $instance->setTest($data['test']);
36 | return $instance;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_3_with_setters_and_from_json_array_method.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 |
12 | public static function fromJson(array $data): self
13 | {
14 | $instance = new self();
15 | $instance->setTest($data['test']);
16 | return $instance;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_3_with_setters_and_from_json_method.txt:
--------------------------------------------------------------------------------
1 | test = $test;
10 | }
11 |
12 | public static function fromJson(\stdClass $data): self
13 | {
14 | $instance = new self();
15 | $instance->setTest($data->test);
16 | return $instance;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/converter/fixtures/results/simple_json_data_php_8_3_without_constructor.txt:
--------------------------------------------------------------------------------
1 | (composable: () => T): [T, App] {
4 | let result: T = {} as T;
5 | const app = createApp({
6 | setup() {
7 | result = composable()
8 | // eslint-disable-next-line @typescript-eslint/no-empty-function
9 | return () => {}
10 | }
11 | })
12 | app.mount(document.createElement('div'))
13 | // return the result and the app instance
14 | // for testing provide / unmount
15 | return [result, app]
16 | }
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ESNext",
4 | "useDefineForClassFields": true,
5 | "module": "ESNext",
6 | "moduleResolution": "Node",
7 | "strict": true,
8 | "jsx": "preserve",
9 | "resolveJsonModule": true,
10 | "isolatedModules": true,
11 | "esModuleInterop": true,
12 | "lib": ["ESNext", "DOM"],
13 | "skipLibCheck": true,
14 | "noEmit": true,
15 | "paths": {
16 | "@/*": [
17 | "./src/*"
18 | ]
19 | },
20 | "types": [
21 | "vite/client",
22 | "vitest/globals"
23 | ]
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/vite.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import vue from '@vitejs/plugin-vue'
3 | import path from 'path';
4 |
5 | export default defineConfig({
6 | plugins: [vue()],
7 | base: './',
8 | resolve: {
9 | alias: {
10 | '@': path.resolve(__dirname, './src'),
11 | },
12 | },
13 | test: {
14 | globals: true,
15 | environment: 'happy-dom',
16 | setupFiles: './tests/test-utils.ts'
17 | },
18 | })
--------------------------------------------------------------------------------