Skip to content

Commit

Permalink
Merge pull request #9 from lloc/add-di
Browse files Browse the repository at this point in the history
Add di
  • Loading branch information
lloc authored Dec 6, 2024
2 parents d9da7a9 + 5df53bb commit be922e7
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 57 deletions.
22 changes: 15 additions & 7 deletions .distignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
/.wordpress-org
.distignore
.editorconfig
.eslintrc
.gitattributes
.gitignore
.nvmrc
.phpunit.result.cache
.prettierignore
.prettierrc.js
.stylelintrc.json
.wp-env.json
/.git
/.github
/.idea
/.phpunit.cache
/.wordpress-org
/bin
/wp-nowpayments-integration
/node_modules
/reports
/src
/tests
.distignore
.gitattributes
.gitignore
.scrutinizer.yml
/wp-nowpayments-integration
Changelog.md
Diagrams.md
README.md
Expand All @@ -25,6 +32,7 @@ phpcs.xml
phpdoc.xml
phpstan.neon
phpunit.xml
plantuml_gist.puml
playwright.config.ts
setup.sh
multisite-language-switcher.zip
wp-nowpayments-integration.zip
120 changes: 70 additions & 50 deletions plantuml_gist.puml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@startuml class-diagram
class "Settings" as Settings {
{static} +init()
{static} +admin_init()
{static} +render_section(args)
{static} +render_fields(args)
Expand All @@ -12,31 +13,22 @@
}
class "Plugin" as Plugin {
-file : string
+__construct(file)
-__construct(file)
{static} +init(file)
+plugins_loaded()
{static} +wp_dashboard_setup()
+widgets_init()
+block_init()
{static} +block_render()
+plugins_url(path)
+dirname(path)
+path()
+url()
}
class "Widget" as Widget {
+__construct()
+widget(args, instance)
+update(new_instance, old_instance)
+form(instance)
+plugin_dir_url()
}
class "AdminWidget" as AdminWidget {
#status : ApiStatus
+__construct(status)
{static} +create(status)
#api_status_service : ApiStatusService
+__construct(api_status_service)
{static} +init(api_status_service)
+add_dashboard_widget()
+render()
}
class "OptionsPage" as OptionsPage {
{static} +init()
{static} +admin_menu()
{static} +render_page()
{static} +add_settings_error(arr)
Expand All @@ -54,7 +46,6 @@
}
class "AvailableCurrencies" as Integration_AvailableCurrencies {
+get()
+is_available(currency)
}
class "MinimumPaymentAmount" as Integration_MinimumPaymentAmount {
+set(currency_from, currency_to)
Expand All @@ -72,32 +63,40 @@
class "StructuredLogsFormatter" as Logs_StructuredLogsFormatter {
+format(record)
}
class "LogFactory" as Logs_LogFactory {
{static} +get_logger()
}
class "ApplicationLogs" as Logs_ApplicationLogs {
#logger : Logger
+__construct(logger)
#logger : LoggerInterface
-__construct(logger)
{static} +init(logger)
+http_api_debug(response, context, transport, parsed_args, url)
}
}
package Services as Services {
class "ApiStatusService" as Services_ApiStatusService {
-api_status : ApiStatus
+__construct(api_status)
+get_data()
}
class "AvailableCurrenciesService" as Services_AvailableCurrenciesService {
-available_currencies : AvailableCurrencies
+__construct(available_currencies)
#get_data()
+is_available(currency)
}
}
package Rest as Rest {
interface "EndpointGetInterface" as Rest_EndpointGetInterface {
+get()
}
class "Response" as Rest_Response {
#response : string[]
+__construct(response)
+get()
}
class "Service" as Rest_Service {
-environment : string
+__construct(environment)
{static} +create()
+get_service_url()
+get(method)
+info()
interface "EndpointInterface" as Rest_EndpointInterface {
+get_client()
}
interface "Result" as Rest_Result {
+get()
interface "EndpointPostInterface" as Rest_EndpointPostInterface {
+post()
}
class "Error" as Rest_Error {
#error : WP_Error
Expand All @@ -116,42 +115,52 @@
#set_body(params)
+__call(name, arguments)
}
class "Api" as Rest_Api {
-environment : string
-__construct(environment)
{static} +create()
+get_service_url()
+get(method)
+info()
}
interface "ResponseInterface" as Rest_ResponseInterface {
+get()
}
class "Client" as Rest_Client {
-service : Service
-service : Api
+__construct(service)
+get_service()
+get(endpoint, body, headers)
+post(endpoint, body, headers)
}
}
AdminWidget ..> AdminWidget
AdminWidget ..> Integration_ApiStatus
AdminWidget ..> Services_ApiStatusService
Integration_ApiStatus ..> Integration_EndpointMethods
Integration_ApiStatus ..> Rest_ResponseInterface
Integration_AvailableCurrencies ..> Integration_EndpointMethods
Integration_AvailableCurrencies ..> Rest_ResponseInterface
Integration_EstimatedPrice ..> Integration_EndpointMethods
Integration_EstimatedPrice ..> Rest_Endpoint
Integration_EstimatedPrice ..> Rest_EndpointGetInterface
Integration_EstimatedPrice ..> Rest_ResponseInterface
Integration_MinimumPaymentAmount ..> Integration_EndpointMethods
Integration_MinimumPaymentAmount ..> Rest_Endpoint
Integration_MinimumPaymentAmount ..> Rest_EndpointGetInterface
Integration_MinimumPaymentAmount ..> Rest_ResponseInterface
Integration_Payment ..> Integration_EndpointMethods
Integration_Payment ..> Rest_Endpoint
Integration_Payment ..> Rest_EndpointPostInterface
Integration_Payment ..> Rest_ResponseInterface
Integration_PaymentStatus ..> Integration_EndpointMethods
Integration_PaymentStatus ..> Rest_Endpoint
Integration_PaymentStatus ..> Rest_EndpointGetInterface
Integration_PaymentStatus ..> Rest_ResponseInterface
Logs_ApplicationLogs ..> Logs_ApplicationLogs
Logs_LogFactory ..> Logs_StructuredLogsFormatter
OptionsPage ..> Plugin
OptionsPage ..> Settings
Plugin ..> AdminWidget
Plugin ..> Integration_ApiStatus
Plugin ..> OptionsPage
Plugin ..> Plugin
Plugin ..> Rest_Client
Plugin ..> Rest_Service
Plugin ..> Settings
Plugin ..> Widget
Rest_Api ..> Rest_Api
Rest_Client ..> Rest_Api
Rest_Client ..> Rest_Error
Rest_Client ..> Rest_Response
Rest_Client ..> Rest_Result
Rest_Client ..> Rest_Service
Rest_Client ..> Rest_ResponseInterface
Rest_Endpoint ..> Option
Rest_Endpoint ..> Rest_Client
Rest_Endpoint ..> Settings
Expand All @@ -161,9 +170,20 @@
Rest_Endpoint <|-- Integration_MinimumPaymentAmount
Rest_Endpoint <|-- Integration_Payment
Rest_Endpoint <|-- Integration_PaymentStatus
Rest_Result <|-- Rest_Error
Rest_Result <|-- Rest_Response
Rest_Service ..> Rest_Service
Rest_EndpointGetInterface ..> Rest_ResponseInterface
Rest_EndpointGetInterface <|-- Integration_ApiStatus
Rest_EndpointGetInterface <|-- Integration_AvailableCurrencies
Rest_EndpointGetInterface <|-- Integration_EstimatedPrice
Rest_EndpointGetInterface <|-- Integration_MinimumPaymentAmount
Rest_EndpointGetInterface <|-- Integration_PaymentStatus
Rest_EndpointInterface ..> Rest_Client
Rest_EndpointInterface <|-- Rest_Endpoint
Rest_EndpointPostInterface ..> Rest_ResponseInterface
Rest_EndpointPostInterface <|-- Integration_Payment
Rest_ResponseInterface <|-- Rest_Error
Rest_ResponseInterface <|-- Rest_Response
Services_ApiStatusService ..> Integration_ApiStatus
Services_AvailableCurrenciesService ..> Integration_AvailableCurrencies
Settings ..> Option
Settings ..> OptionsPage
@enduml

0 comments on commit be922e7

Please sign in to comment.