From c3e4c68a41866ea372a6b35f8acf54625202682b Mon Sep 17 00:00:00 2001 From: Leonid Nikitin Date: Tue, 19 Sep 2023 14:29:01 +0600 Subject: [PATCH] Add CryptographyContract and its implementation Added a new CryptographyContract interface and CryptographyString class that implements this contract. The CryptographyContract encapsulates the encryption and decryption of strings, enforcing these operations to be standardized across the application. The CryptographyString class uses Laravel's native crypt facades to perform these actions. In the AppServiceProvider, CryptographyContract is now bound to CryptographyString class, allowing the container to automatically resolve the dependencies wherever the interface is type hinted. --- app/Contracts/CryptographyContract.php | 9 +++++++++ app/Providers/AppServiceProvider.php | 4 ++++ app/Services/CryptographyString.php | 19 +++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 app/Contracts/CryptographyContract.php create mode 100644 app/Services/CryptographyString.php diff --git a/app/Contracts/CryptographyContract.php b/app/Contracts/CryptographyContract.php new file mode 100644 index 0000000..90f5e8a --- /dev/null +++ b/app/Contracts/CryptographyContract.php @@ -0,0 +1,9 @@ +app->bind(ImageBody::class, Body::class); $this->app->bind(ImageLines::class, Lines::class); + $this->app->bind(CryptographyContract::class, CryptographyString::class); + $this->app->bind(CreateSearchInstanceCommand::class, function () { return new CreateSearchInstanceCommand(Search::class); }); diff --git a/app/Services/CryptographyString.php b/app/Services/CryptographyString.php new file mode 100644 index 0000000..b5febf6 --- /dev/null +++ b/app/Services/CryptographyString.php @@ -0,0 +1,19 @@ +