From 4d9fa7380e9b916eb716c0923ac590a951d8a926 Mon Sep 17 00:00:00 2001 From: Kedar Khaire Date: Tue, 24 Sep 2024 21:10:31 +0530 Subject: [PATCH 1/2] Changes for PHPCS fixes --- .../TestEnvironmentVariablesKeyProvider.php | 2 +- .../MonetizationFunctionalTestBase.php | 2 +- .../src/Functional/ApigeeX/NavigationTest.php | 6 ++-- .../ApigeeX/PrepaidBalanceCacheTest.php | 12 ++++---- .../ApigeeX/PurchasedProductListTest.php | 4 +-- .../ApigeeX/PurchasedProductStatusTest.php | 8 ++--- .../MonetizationFunctionalTestBase.php | 2 +- .../Functional/PrepaidBalanceCacheTest.php | 6 ++-- .../PrepaidBalanceConfigFormTest.php | 2 +- .../PricingAndPlansFunctionalTest.php | 1 - ...tsDownloadFormFunctionalJavascriptTest.php | 3 +- tests/src/Kernel/Access/AccessKernelTest.php | 2 +- .../ApigeeX/Access/AccessKernelTest.php | 8 ++--- .../BuyApisControllerKernelTest.php | 4 +-- .../RatePlanAccessControlHandlerTest.php | 1 - .../PurchasedProductConverterTest.php | 2 +- .../ParamConverter/RatePlanConverterTest.php | 2 +- .../Entity/ProductEntityKernelTest.php | 6 ++-- .../Entity/RatePlanEntityKernelTest.php | 2 +- .../Entity/Render/RatePlanRenderTest.php | 2 +- .../Entity/Storage/RatePlanStorageTest.php | 2 +- .../ApigeeX/Form/RatePlanConfigFormTest.php | 2 +- .../ApigeeX/MonetizationKernelTestBase.php | 2 +- .../ApigeeX/MonetizationServiceKernelTest.php | 2 -- ...netizationDeveloperFormatterKernelTest.php | 4 +-- .../PriceFormatterKernelTest.php | 4 +-- ...PurchaseProductFormFormatterKernelTest.php | 4 +-- .../Kernel/AutoAssignLegalNameKernelTest.php | 2 -- .../PricingAndPlansControllerKernelTest.php | 9 +++--- .../RatePlanAccessControlHandlerTest.php | 2 +- .../PurchasedPlanConverterTest.php | 2 +- .../ParamConverter/RatePlanConverterTest.php | 2 +- .../Entity/ProductBundleEntityKernelTest.php | 6 ++-- .../Entity/RatePlanEntityKernelTest.php | 2 +- .../Entity/Render/RatePlanRenderTest.php | 2 +- .../Entity/Storage/RatePlanStorageTest.php | 2 +- .../Kernel/Form/RatePlanConfigFormTest.php | 2 +- .../Kernel/Form/ReportsDownloadFormTest.php | 2 +- tests/src/Kernel/ModuleInstallKernelTest.php | 2 +- .../Kernel/MonetizationServiceKernelTest.php | 2 +- .../DateAndTextFormatterKernelTest.php | 2 +- .../DatestampFormatterKernelTest.php | 10 +++---- ...netizationDeveloperFormatterKernelTest.php | 4 +-- .../OrganizationFormatterKernelTest.php | 4 +-- .../PriceFormatterKernelTest.php | 4 +-- .../PurchasePlanFormFormatterKernelTest.php | 4 +-- .../PurchasePlanLinkFormatterKernelTest.php | 4 +-- .../RatePlanDetailsFormatterKernelTest.php | 4 +-- .../SupportedCurrencyFormatterKernelTest.php | 4 +-- .../TermsAndConditionsFormatterKernelTest.php | 4 +-- .../FieldWidget/BaseWidgetKernelTest.php | 4 +-- .../Traits/ApigeeMonetizationTestTrait.php | 11 ++----- .../ApigeeX/ApigeeMonetizationTestTrait.php | 30 ++++++++----------- tests/src/Unit/DeveloperCacheContextTest.php | 2 +- 54 files changed, 103 insertions(+), 122 deletions(-) diff --git a/tests/modules/apigee_m10n_test/src/Plugin/KeyProvider/TestEnvironmentVariablesKeyProvider.php b/tests/modules/apigee_m10n_test/src/Plugin/KeyProvider/TestEnvironmentVariablesKeyProvider.php index 3ff400a4..45c72c1b 100644 --- a/tests/modules/apigee_m10n_test/src/Plugin/KeyProvider/TestEnvironmentVariablesKeyProvider.php +++ b/tests/modules/apigee_m10n_test/src/Plugin/KeyProvider/TestEnvironmentVariablesKeyProvider.php @@ -19,9 +19,9 @@ namespace Drupal\apigee_m10n_test\Plugin\KeyProvider; -use Drupal\apigee_edge\Plugin\KeyProvider\EnvironmentVariablesKeyProvider; use Drupal\Core\Logger\LoggerChannelInterface; use Drupal\Core\State\StateInterface; +use Drupal\apigee_edge\Plugin\KeyProvider\EnvironmentVariablesKeyProvider; use Drupal\key\KeyInterface; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/tests/src/Functional/ApigeeX/MonetizationFunctionalTestBase.php b/tests/src/Functional/ApigeeX/MonetizationFunctionalTestBase.php index de60de77..a823b03b 100755 --- a/tests/src/Functional/ApigeeX/MonetizationFunctionalTestBase.php +++ b/tests/src/Functional/ApigeeX/MonetizationFunctionalTestBase.php @@ -19,8 +19,8 @@ namespace Drupal\Tests\apigee_m10n\Functional\ApigeeX; -use Drupal\Tests\apigee_m10n\Traits\ApigeeX\ApigeeMonetizationTestTrait; use Drupal\Tests\BrowserTestBase; +use Drupal\Tests\apigee_m10n\Traits\ApigeeX\ApigeeMonetizationTestTrait; /** * A base class for functional tests. diff --git a/tests/src/Functional/ApigeeX/NavigationTest.php b/tests/src/Functional/ApigeeX/NavigationTest.php index 8b8ed994..151b3227 100755 --- a/tests/src/Functional/ApigeeX/NavigationTest.php +++ b/tests/src/Functional/ApigeeX/NavigationTest.php @@ -58,7 +58,7 @@ protected function setUp(): void { public function testNavigation() { $this->developer = $this->createAccount([ 'view xproduct', - 'view own purchased_plan' + 'view own purchased_plan', ]); // Warm the ApigeeX organization. $this->warmApigeexOrganizationCache(); @@ -88,8 +88,8 @@ public function testNavigation() { ], ])->queueMockResponse([ 'get_monetization_apigeex_plans' => [ - 'plans' => [$xrate_plan] - ] + 'plans' => [$xrate_plan], + ], ]); // Check the manage Manage Subscriptions link. diff --git a/tests/src/Functional/ApigeeX/PrepaidBalanceCacheTest.php b/tests/src/Functional/ApigeeX/PrepaidBalanceCacheTest.php index 81b0e21a..ff385c0e 100755 --- a/tests/src/Functional/ApigeeX/PrepaidBalanceCacheTest.php +++ b/tests/src/Functional/ApigeeX/PrepaidBalanceCacheTest.php @@ -19,13 +19,13 @@ namespace Drupal\Tests\apigee_m10n\Functional\ApigeeX; -use Drupal\apigee_m10n\Controller\PrepaidBalanceXController; -use Drupal\apigee_m10n\Form\PrepaidBalanceConfigForm; -use Drupal\apigee_m10n\Form\PrepaidBalanceRefreshForm; use Drupal\Core\Cache\Cache; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Url; use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait; +use Drupal\apigee_m10n\Controller\PrepaidBalanceXController; +use Drupal\apigee_m10n\Form\PrepaidBalanceConfigForm; +use Drupal\apigee_m10n\Form\PrepaidBalanceRefreshForm; use Drupal\user\Entity\Role; use Drupal\user\UserInterface; @@ -93,8 +93,8 @@ public function testNoPermission() { $this->queueApigeexDeveloperResponse($this->developer); $this->stack->queueMockResponse([ - 'get-apigeex-prepaid-balances' - ]); + 'get-apigeex-prepaid-balances', + ]); $this->drupalGet(Url::fromRoute('apigee_monetization.xbilling', [ 'user' => $this->developer->id(), ])); @@ -247,7 +247,7 @@ public function testPrepaidBalanceCacheDisable() { protected function queueResponses(UserInterface $user) { $this->queueApigeexDeveloperResponse($user); $this->stack->queueMockResponse([ - 'get-apigeex-prepaid-balances' + 'get-apigeex-prepaid-balances', ]); } diff --git a/tests/src/Functional/ApigeeX/PurchasedProductListTest.php b/tests/src/Functional/ApigeeX/PurchasedProductListTest.php index ecc0b9d0..56633498 100755 --- a/tests/src/Functional/ApigeeX/PurchasedProductListTest.php +++ b/tests/src/Functional/ApigeeX/PurchasedProductListTest.php @@ -76,8 +76,8 @@ public function testPurchasedPlanListView() { ], ])->queueMockResponse([ 'get_monetization_apigeex_plans' => [ - 'plans' => [$xrate_plan] - ] + 'plans' => [$xrate_plan], + ], ]); $this->drupalGet(Url::fromRoute('entity.purchased_product.developer_product_collection', [ diff --git a/tests/src/Functional/ApigeeX/PurchasedProductStatusTest.php b/tests/src/Functional/ApigeeX/PurchasedProductStatusTest.php index 1b801550..7ebfb671 100755 --- a/tests/src/Functional/ApigeeX/PurchasedProductStatusTest.php +++ b/tests/src/Functional/ApigeeX/PurchasedProductStatusTest.php @@ -83,8 +83,8 @@ public function testPurchasedProductActiveStatus() { ], ])->queueMockResponse([ 'get_monetization_apigeex_plans' => [ - 'plans' => [$xrate_plan] - ] + 'plans' => [$xrate_plan], + ], ]); $this->drupalGet(Url::fromRoute('entity.purchased_product.developer_product_collection', [ @@ -125,8 +125,8 @@ public function testPurchasedProductEndedStatus() { ], ])->queueMockResponse([ 'get_monetization_apigeex_plans' => [ - 'plans' => [$xrate_plan] - ] + 'plans' => [$xrate_plan], + ], ]); $this->drupalGet(Url::fromRoute('entity.purchased_product.developer_product_collection', [ diff --git a/tests/src/Functional/MonetizationFunctionalTestBase.php b/tests/src/Functional/MonetizationFunctionalTestBase.php index ddcc38ea..bbdb2d7b 100644 --- a/tests/src/Functional/MonetizationFunctionalTestBase.php +++ b/tests/src/Functional/MonetizationFunctionalTestBase.php @@ -19,8 +19,8 @@ namespace Drupal\Tests\apigee_m10n\Functional; -use Drupal\Tests\apigee_m10n\Traits\ApigeeMonetizationTestTrait; use Drupal\Tests\BrowserTestBase; +use Drupal\Tests\apigee_m10n\Traits\ApigeeMonetizationTestTrait; /** * A base class for functional tests. diff --git a/tests/src/Functional/PrepaidBalanceCacheTest.php b/tests/src/Functional/PrepaidBalanceCacheTest.php index 55a57896..f1790e6e 100644 --- a/tests/src/Functional/PrepaidBalanceCacheTest.php +++ b/tests/src/Functional/PrepaidBalanceCacheTest.php @@ -19,14 +19,14 @@ namespace Drupal\Tests\apigee_m10n\Functional; -use Drupal\apigee_m10n\Controller\PrepaidBalanceController; -use Drupal\apigee_m10n\Form\PrepaidBalanceConfigForm; -use Drupal\apigee_m10n\Form\PrepaidBalanceRefreshForm; use Drupal\Core\Cache\Cache; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Url; use Drupal\Tests\apigee_m10n\Traits\PrepaidBalanceReportsDownloadFormTestTrait; use Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait; +use Drupal\apigee_m10n\Controller\PrepaidBalanceController; +use Drupal\apigee_m10n\Form\PrepaidBalanceConfigForm; +use Drupal\apigee_m10n\Form\PrepaidBalanceRefreshForm; use Drupal\user\Entity\Role; use Drupal\user\UserInterface; diff --git a/tests/src/Functional/PrepaidBalanceConfigFormTest.php b/tests/src/Functional/PrepaidBalanceConfigFormTest.php index a314edfa..6a82ac15 100644 --- a/tests/src/Functional/PrepaidBalanceConfigFormTest.php +++ b/tests/src/Functional/PrepaidBalanceConfigFormTest.php @@ -19,9 +19,9 @@ namespace Drupal\Tests\apigee_m10n\FunctionalJavascript; -use Drupal\apigee_m10n\Form\PrepaidBalanceConfigForm; use Drupal\Core\Url; use Drupal\Tests\apigee_m10n\Functional\MonetizationFunctionalTestBase; +use Drupal\apigee_m10n\Form\PrepaidBalanceConfigForm; /** * UI tests for the prepaid balance config form. diff --git a/tests/src/Functional/PricingAndPlansFunctionalTest.php b/tests/src/Functional/PricingAndPlansFunctionalTest.php index 9eebd752..32d47d04 100644 --- a/tests/src/Functional/PricingAndPlansFunctionalTest.php +++ b/tests/src/Functional/PricingAndPlansFunctionalTest.php @@ -20,7 +20,6 @@ namespace Drupal\Tests\apigee_m10n\Functional; use Drupal\Core\Url; -use Drupal\Tests\apigee_m10n\Functional\MonetizationFunctionalTestBase; /** * UI tests for the Pricing and Plans page. diff --git a/tests/src/FunctionalJavascript/PrepaidBalanceReportsDownloadFormFunctionalJavascriptTest.php b/tests/src/FunctionalJavascript/PrepaidBalanceReportsDownloadFormFunctionalJavascriptTest.php index fbf4036a..059ca1b8 100644 --- a/tests/src/FunctionalJavascript/PrepaidBalanceReportsDownloadFormFunctionalJavascriptTest.php +++ b/tests/src/FunctionalJavascript/PrepaidBalanceReportsDownloadFormFunctionalJavascriptTest.php @@ -19,10 +19,9 @@ namespace Drupal\Tests\apigee_m10n\FunctionalJavascript; -use Drupal\apigee_m10n\Form\PrepaidBalanceConfigForm; -use Drupal\Core\Render\Element\Date; use Drupal\Core\Url; use Drupal\Tests\apigee_m10n\Traits\PrepaidBalanceReportsDownloadFormTestTrait; +use Drupal\apigee_m10n\Form\PrepaidBalanceConfigForm; /** * UI tests for the prepaid balance reports download form. diff --git a/tests/src/Kernel/Access/AccessKernelTest.php b/tests/src/Kernel/Access/AccessKernelTest.php index c1b3fe7b..18699dcf 100644 --- a/tests/src/Kernel/Access/AccessKernelTest.php +++ b/tests/src/Kernel/Access/AccessKernelTest.php @@ -19,11 +19,11 @@ namespace Drupal\Tests\apigee_m10n\Kernel\Access; -use Drupal\apigee_m10n\MonetizationInterface; use Drupal\Core\Session\AnonymousUserSession; use Drupal\Core\Session\UserSession; use Drupal\Core\Url; use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; +use Drupal\apigee_m10n\MonetizationInterface; use Drupal\user\Entity\User; /** diff --git a/tests/src/Kernel/ApigeeX/Access/AccessKernelTest.php b/tests/src/Kernel/ApigeeX/Access/AccessKernelTest.php index 25639664..1c50a4ec 100755 --- a/tests/src/Kernel/ApigeeX/Access/AccessKernelTest.php +++ b/tests/src/Kernel/ApigeeX/Access/AccessKernelTest.php @@ -19,11 +19,11 @@ namespace Drupal\Tests\apigee_m10n\Kernel\ApigeeX\Access; -use Drupal\apigee_m10n\MonetizationInterface; use Drupal\Core\Session\AnonymousUserSession; use Drupal\Core\Session\UserSession; use Drupal\Core\Url; use Drupal\Tests\apigee_m10n\Kernel\ApigeeX\MonetizationKernelTestBase; +use Drupal\apigee_m10n\MonetizationInterface; use Drupal\user\Entity\User; /** @@ -151,7 +151,7 @@ public function assertPurchasedProductRoutes() { static::assertFalse($collection_url->access($this->developer)); static::assertFalse($collection_url->access($this->anonymous)); - // TODO: test the cancel page. + // @todo test the cancel page. } /** @@ -207,7 +207,7 @@ public function assertProductRoutes() { $xproduct_route = Url::fromRoute('entity.xproduct.developer', [ 'user' => $this->developer->id(), - 'xproduct' => $this->xproduct->id() + 'xproduct' => $this->xproduct->id(), ] ); static::assertTrue($xproduct_route->access($this->administrator)); @@ -218,7 +218,7 @@ public function assertProductRoutes() { $xproduct_route = Url::fromRoute('entity.xproduct.developer', [ 'user' => $this->administrator->id(), - 'xproduct' => $this->xproduct->id() + 'xproduct' => $this->xproduct->id(), ] ); static::assertTrue($xproduct_route->access($this->administrator)); diff --git a/tests/src/Kernel/ApigeeX/Controller/BuyApisControllerKernelTest.php b/tests/src/Kernel/ApigeeX/Controller/BuyApisControllerKernelTest.php index 5efd6a00..336caf0b 100755 --- a/tests/src/Kernel/ApigeeX/Controller/BuyApisControllerKernelTest.php +++ b/tests/src/Kernel/ApigeeX/Controller/BuyApisControllerKernelTest.php @@ -20,11 +20,11 @@ namespace Drupal\Tests\apigee_m10n\Kernel\ApigeeX\Controller; use Apigee\Edge\Api\ApigeeX\Entity\StandardRatePlan; -use Drupal\apigee_edge\Entity\ApiProduct; -use Drupal\apigee_m10n\Entity\RatePlanInterface; use Drupal\Core\Database\Database; use Drupal\Core\Url; use Drupal\Tests\apigee_m10n\Kernel\ApigeeX\MonetizationKernelTestBase; +use Drupal\apigee_edge\Entity\ApiProduct; +use Drupal\apigee_m10n\Entity\RatePlanInterface; use Drupal\user\Entity\User; use Drupal\user\UserInterface; use Symfony\Component\HttpFoundation\Request; diff --git a/tests/src/Kernel/ApigeeX/Entity/Access/RatePlanAccessControlHandlerTest.php b/tests/src/Kernel/ApigeeX/Entity/Access/RatePlanAccessControlHandlerTest.php index 9bad5faf..5b0adeae 100755 --- a/tests/src/Kernel/ApigeeX/Entity/Access/RatePlanAccessControlHandlerTest.php +++ b/tests/src/Kernel/ApigeeX/Entity/Access/RatePlanAccessControlHandlerTest.php @@ -19,7 +19,6 @@ namespace Drupal\Tests\apigee_m10n\Kernel\ApigeeX\Entity\Access; -use Drupal\apigee_m10n\Entity\XRatePlan; use Drupal\Tests\apigee_m10n\Kernel\ApigeeX\MonetizationKernelTestBase; /** diff --git a/tests/src/Kernel/ApigeeX/Entity/ParamConverter/PurchasedProductConverterTest.php b/tests/src/Kernel/ApigeeX/Entity/ParamConverter/PurchasedProductConverterTest.php index d31c3c7b..c33d72a7 100755 --- a/tests/src/Kernel/ApigeeX/Entity/ParamConverter/PurchasedProductConverterTest.php +++ b/tests/src/Kernel/ApigeeX/Entity/ParamConverter/PurchasedProductConverterTest.php @@ -19,8 +19,8 @@ namespace Drupal\Tests\apigee_m10n\Kernel\ApigeeX\Entity\ParamConverter; -use Drupal\apigee_m10n\Entity\ParamConverter\PurchasedProductConverter; use Drupal\Tests\apigee_m10n\Kernel\ApigeeX\MonetizationKernelTestBase; +use Drupal\apigee_m10n\Entity\ParamConverter\PurchasedProductConverter; /** * Tests the purchased plan param converter. diff --git a/tests/src/Kernel/ApigeeX/Entity/ParamConverter/RatePlanConverterTest.php b/tests/src/Kernel/ApigeeX/Entity/ParamConverter/RatePlanConverterTest.php index c8551d34..5a2525eb 100755 --- a/tests/src/Kernel/ApigeeX/Entity/ParamConverter/RatePlanConverterTest.php +++ b/tests/src/Kernel/ApigeeX/Entity/ParamConverter/RatePlanConverterTest.php @@ -19,11 +19,11 @@ namespace Drupal\Tests\apigee_m10n\Kernel\ApigeeX\Entity\ParamConverter; -use Drupal\apigee_m10n\Entity\ParamConverter\XRatePlanConverter; use Drupal\Core\Http\Exception\CacheableNotFoundHttpException; use Drupal\Core\ParamConverter\ParamNotConvertedException; use Drupal\Core\Url; use Drupal\Tests\apigee_m10n\Kernel\ApigeeX\MonetizationKernelTestBase; +use Drupal\apigee_m10n\Entity\ParamConverter\XRatePlanConverter; use Symfony\Component\HttpFoundation\Request; /** diff --git a/tests/src/Kernel/ApigeeX/Entity/ProductEntityKernelTest.php b/tests/src/Kernel/ApigeeX/Entity/ProductEntityKernelTest.php index 7eb1905b..035c44bb 100755 --- a/tests/src/Kernel/ApigeeX/Entity/ProductEntityKernelTest.php +++ b/tests/src/Kernel/ApigeeX/Entity/ProductEntityKernelTest.php @@ -19,13 +19,13 @@ namespace Drupal\Tests\apigee_m10n\Kernel\ApigeeX\Entity; +use Drupal\Core\Routing\CurrentRouteMatch; +use Drupal\Core\Url; +use Drupal\Tests\apigee_m10n\Kernel\ApigeeX\MonetizationKernelTestBase; use Drupal\apigee_edge\Entity\EdgeEntityType; use Drupal\apigee_m10n\Entity\Routing\MonetizationEntityRouteProvider; use Drupal\apigee_m10n\Entity\XProduct; use Drupal\apigee_m10n\Entity\XProductInterface; -use Drupal\Core\Routing\CurrentRouteMatch; -use Drupal\Core\Url; -use Drupal\Tests\apigee_m10n\Kernel\ApigeeX\MonetizationKernelTestBase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; diff --git a/tests/src/Kernel/ApigeeX/Entity/RatePlanEntityKernelTest.php b/tests/src/Kernel/ApigeeX/Entity/RatePlanEntityKernelTest.php index 0a22cac9..46fe29b7 100755 --- a/tests/src/Kernel/ApigeeX/Entity/RatePlanEntityKernelTest.php +++ b/tests/src/Kernel/ApigeeX/Entity/RatePlanEntityKernelTest.php @@ -20,8 +20,8 @@ namespace Drupal\Tests\apigee_m10n\Kernel\ApigeeX\Entity; use Apigee\Edge\Api\ApigeeX\Entity\RatePlanInterface; -use Drupal\apigee_m10n\Entity\XRatePlan; use Drupal\Tests\apigee_m10n\Kernel\ApigeeX\MonetizationKernelTestBase; +use Drupal\apigee_m10n\Entity\XRatePlan; /** * Test the `xrate_plan` entity. diff --git a/tests/src/Kernel/ApigeeX/Entity/Render/RatePlanRenderTest.php b/tests/src/Kernel/ApigeeX/Entity/Render/RatePlanRenderTest.php index fcf646c2..fc5f9ae1 100755 --- a/tests/src/Kernel/ApigeeX/Entity/Render/RatePlanRenderTest.php +++ b/tests/src/Kernel/ApigeeX/Entity/Render/RatePlanRenderTest.php @@ -65,7 +65,7 @@ protected function setUp(): void { $this->developer = $this->createAccount( [ - 'view rate_plan' + 'view rate_plan', ]); $this->setCurrentUser($this->developer); diff --git a/tests/src/Kernel/ApigeeX/Entity/Storage/RatePlanStorageTest.php b/tests/src/Kernel/ApigeeX/Entity/Storage/RatePlanStorageTest.php index 33bf3ed7..caa72805 100755 --- a/tests/src/Kernel/ApigeeX/Entity/Storage/RatePlanStorageTest.php +++ b/tests/src/Kernel/ApigeeX/Entity/Storage/RatePlanStorageTest.php @@ -20,8 +20,8 @@ namespace Drupal\Tests\apigee_m10n\Kernel\ApigeeX\Entity\Render; use Apigee\Edge\Api\ApigeeX\Entity\RatePlanInterface; -use Drupal\apigee_m10n\Exception\InvalidRatePlanIdException; use Drupal\Tests\apigee_m10n\Kernel\ApigeeX\MonetizationKernelTestBase; +use Drupal\apigee_m10n\Exception\InvalidRatePlanIdException; /** * Kernel test for the rate plan storage. diff --git a/tests/src/Kernel/ApigeeX/Form/RatePlanConfigFormTest.php b/tests/src/Kernel/ApigeeX/Form/RatePlanConfigFormTest.php index 1dd6f48b..5ed572a5 100755 --- a/tests/src/Kernel/ApigeeX/Form/RatePlanConfigFormTest.php +++ b/tests/src/Kernel/ApigeeX/Form/RatePlanConfigFormTest.php @@ -18,11 +18,11 @@ namespace Drupal\Tests\apigee_m10n\Kernel\ApigeeX\Form; -use Drupal\apigee_m10n\Form\RatePlanXConfigForm; use Drupal\Core\Entity\Entity\EntityViewDisplay; use Drupal\Core\Entity\Entity\EntityViewMode; use Drupal\Core\Form\FormState; use Drupal\Tests\apigee_m10n\Kernel\ApigeeX\MonetizationKernelTestBase; +use Drupal\apigee_m10n\Form\RatePlanXConfigForm; /** * Tests for `apigee_m10n.xrate_plan.config` settings. diff --git a/tests/src/Kernel/ApigeeX/MonetizationKernelTestBase.php b/tests/src/Kernel/ApigeeX/MonetizationKernelTestBase.php index 00616b15..9ba9a28c 100755 --- a/tests/src/Kernel/ApigeeX/MonetizationKernelTestBase.php +++ b/tests/src/Kernel/ApigeeX/MonetizationKernelTestBase.php @@ -19,10 +19,10 @@ namespace Drupal\Tests\apigee_m10n\Kernel\ApigeeX; -use Drupal\apigee_edge\OauthTokenFileStorage; use Drupal\KernelTests\KernelTestBase; use Drupal\Tests\apigee_m10n\Traits\ApigeeX\ApigeeMonetizationTestTrait; use Drupal\Tests\user\Traits\UserCreationTrait; +use Drupal\apigee_edge\OauthTokenFileStorage; /** * The base class for Monetization kernel tests. diff --git a/tests/src/Kernel/ApigeeX/MonetizationServiceKernelTest.php b/tests/src/Kernel/ApigeeX/MonetizationServiceKernelTest.php index 38dab360..99304c30 100755 --- a/tests/src/Kernel/ApigeeX/MonetizationServiceKernelTest.php +++ b/tests/src/Kernel/ApigeeX/MonetizationServiceKernelTest.php @@ -19,8 +19,6 @@ namespace Drupal\Tests\apigee_m10n\Kernel\ApigeeX; -use Drupal\Core\Access\AccessResultAllowed; -use Drupal\Core\Access\AccessResultForbidden; use Drupal\Core\Form\FormState; use Drupal\Core\Session\AccountInterface; use Drupal\user\Entity\Role; diff --git a/tests/src/Kernel/ApigeeX/Plugin/Field/FieldFormatter/MonetizationDeveloperFormatterKernelTest.php b/tests/src/Kernel/ApigeeX/Plugin/Field/FieldFormatter/MonetizationDeveloperFormatterKernelTest.php index 7cea8ff1..90d8a461 100644 --- a/tests/src/Kernel/ApigeeX/Plugin/Field/FieldFormatter/MonetizationDeveloperFormatterKernelTest.php +++ b/tests/src/Kernel/ApigeeX/Plugin/Field/FieldFormatter/MonetizationDeveloperFormatterKernelTest.php @@ -19,11 +19,11 @@ namespace Drupal\Tests\apigee_m10n\Kernel\ApigeeX\Plugin\Field\FieldFormatter; +use Drupal\Core\Field\FieldItemList; +use Drupal\Tests\apigee_m10n\Kernel\ApigeeX\MonetizationKernelTestBase; use Drupal\apigee_m10n\MonetizationInterface; use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\MonetizationDeveloperFormatter; use Drupal\apigee_m10n\Plugin\Field\FieldType\MonetizationDeveloperFieldItem; -use Drupal\Core\Field\FieldItemList; -use Drupal\Tests\apigee_m10n\Kernel\ApigeeX\MonetizationKernelTestBase; /** * Test the `apigee_monetization_developer` field formatter. diff --git a/tests/src/Kernel/ApigeeX/Plugin/Field/FieldFormatter/PriceFormatterKernelTest.php b/tests/src/Kernel/ApigeeX/Plugin/Field/FieldFormatter/PriceFormatterKernelTest.php index e24ceb0c..5b3bb623 100644 --- a/tests/src/Kernel/ApigeeX/Plugin/Field/FieldFormatter/PriceFormatterKernelTest.php +++ b/tests/src/Kernel/ApigeeX/Plugin/Field/FieldFormatter/PriceFormatterKernelTest.php @@ -19,9 +19,9 @@ namespace Drupal\Tests\apigee_m10n\Kernel\ApigeeX\Plugin\Field\FieldFormatter; -use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\PriceFormatter; use Drupal\Core\Field\FieldItemList; use Drupal\Tests\apigee_m10n\Kernel\ApigeeX\MonetizationKernelTestBase; +use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\PriceFormatter; /** * Test the `apigee_price` field formatter. @@ -93,7 +93,7 @@ public function testView() { $item_list = $this->ratePlan->get('setupFees'); static::assertInstanceOf(FieldItemList::class, $item_list); - /* @var \Drupal\Core\Field\BaseFieldDefinition $field_definition */ + /** @var \Drupal\Core\Field\BaseFieldDefinition $field_definition */ $field_definition = $this->fieldManager->getBaseFieldDefinitions('xrate_plan')['setupFees']; /** @var \Drupal\apigee_m10n\Plugin\Field\FieldFormatter\PriceFormatter $instance */ diff --git a/tests/src/Kernel/ApigeeX/Plugin/Field/FieldFormatter/PurchaseProductFormFormatterKernelTest.php b/tests/src/Kernel/ApigeeX/Plugin/Field/FieldFormatter/PurchaseProductFormFormatterKernelTest.php index 4b9987e5..d7e6aafd 100644 --- a/tests/src/Kernel/ApigeeX/Plugin/Field/FieldFormatter/PurchaseProductFormFormatterKernelTest.php +++ b/tests/src/Kernel/ApigeeX/Plugin/Field/FieldFormatter/PurchaseProductFormFormatterKernelTest.php @@ -19,10 +19,10 @@ namespace Drupal\Tests\apigee_m10n\Kernel\ApigeeX\Plugin\Field\FieldFormatter; -use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\PurchaseProductFormFormatter; -use Drupal\apigee_m10n\Plugin\Field\FieldType\PurchaseProductFieldItem; use Drupal\Core\Field\FieldItemList; use Drupal\Tests\apigee_m10n\Kernel\ApigeeX\MonetizationKernelTestBase; +use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\PurchaseProductFormFormatter; +use Drupal\apigee_m10n\Plugin\Field\FieldType\PurchaseProductFieldItem; /** * Test the `apigee_purchase_plan_link` field formatter. diff --git a/tests/src/Kernel/AutoAssignLegalNameKernelTest.php b/tests/src/Kernel/AutoAssignLegalNameKernelTest.php index 435e1906..974a37fa 100644 --- a/tests/src/Kernel/AutoAssignLegalNameKernelTest.php +++ b/tests/src/Kernel/AutoAssignLegalNameKernelTest.php @@ -19,8 +19,6 @@ namespace Drupal\Tests\apigee_m10n\Kernel; -use Drupal\Core\Form\FormState; - /** * AutoAssignLegalNameKernelTest tests. */ diff --git a/tests/src/Kernel/Controller/PricingAndPlansControllerKernelTest.php b/tests/src/Kernel/Controller/PricingAndPlansControllerKernelTest.php index 97f7fc2f..8594346e 100644 --- a/tests/src/Kernel/Controller/PricingAndPlansControllerKernelTest.php +++ b/tests/src/Kernel/Controller/PricingAndPlansControllerKernelTest.php @@ -22,11 +22,11 @@ use Apigee\Edge\Api\Monetization\Entity\Developer; use Apigee\Edge\Api\Monetization\Entity\DeveloperRatePlan; use Apigee\Edge\Api\Monetization\Entity\StandardRatePlan; -use Drupal\apigee_edge\Entity\ApiProduct; -use Drupal\apigee_m10n\Entity\RatePlanInterface; use Drupal\Core\Database\Database; use Drupal\Core\Url; use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; +use Drupal\apigee_edge\Entity\ApiProduct; +use Drupal\apigee_m10n\Entity\RatePlanInterface; use Drupal\user\Entity\User; use Drupal\user\UserInterface; use Symfony\Component\HttpFoundation\Request; @@ -178,7 +178,7 @@ public function testPlansFiltering() { foreach ($rate_plans as $product_bundle_id => $plans) { foreach ($plans as $plan) { if (get_class($plan->decorated()) == DeveloperRatePlan::class) { - /* @var DeveloperRatePlan $decorated */ + /** @var \Apigee\Edge\Api\Monetization\Entity\DeveloperRatePlan $decorated */ $decorated = $plan->decorated(); $this->assertSame($this->accounts['developer']->getEmail(), $decorated->getDeveloper()->getEmail(), 'Email is the same'); } @@ -202,7 +202,6 @@ public function testPlansFiltering() { } // Test the same but for a different developer context. - // Queue the product bundle response. $this->stack->queueMockResponse(['get_monetization_packages' => ['packages' => $product_bundles]]); foreach ($rate_plans as $product_bundle_id => $plans) { @@ -211,7 +210,7 @@ public function testPlansFiltering() { foreach ($rate_plans as $product_bundle_id => $plans) { foreach ($plans as $plan) { if (get_class($plan->decorated()) == DeveloperRatePlan::class) { - /* @var DeveloperRatePlan $decorated */ + /** @var \Apigee\Edge\Api\Monetization\Entity\DeveloperRatePlan $decorated */ $decorated = $plan->decorated(); $this->assertSame($this->accounts['developer']->getEmail(), $decorated->getDeveloper()->getEmail(), 'Email is the same'); } diff --git a/tests/src/Kernel/Entity/Access/RatePlanAccessControlHandlerTest.php b/tests/src/Kernel/Entity/Access/RatePlanAccessControlHandlerTest.php index 99ad3309..3b7ea161 100644 --- a/tests/src/Kernel/Entity/Access/RatePlanAccessControlHandlerTest.php +++ b/tests/src/Kernel/Entity/Access/RatePlanAccessControlHandlerTest.php @@ -23,8 +23,8 @@ use Apigee\Edge\Api\Monetization\Entity\DeveloperCategory; use Apigee\Edge\Api\Monetization\Entity\DeveloperCategoryRatePlan; use Apigee\Edge\Api\Monetization\Entity\DeveloperRatePlan; -use Drupal\apigee_m10n\Entity\RatePlan; use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; +use Drupal\apigee_m10n\Entity\RatePlan; /** * Class RatePlanAccessTest. diff --git a/tests/src/Kernel/Entity/ParamConverter/PurchasedPlanConverterTest.php b/tests/src/Kernel/Entity/ParamConverter/PurchasedPlanConverterTest.php index 652afa7b..1c5a9d5f 100644 --- a/tests/src/Kernel/Entity/ParamConverter/PurchasedPlanConverterTest.php +++ b/tests/src/Kernel/Entity/ParamConverter/PurchasedPlanConverterTest.php @@ -19,8 +19,8 @@ namespace Drupal\Tests\apigee_m10n\Kernel\Entity\ParamConverter; -use Drupal\apigee_m10n\Entity\ParamConverter\PurchasedPlanConverter; use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; +use Drupal\apigee_m10n\Entity\ParamConverter\PurchasedPlanConverter; /** * Tests the purchased plan param converter. diff --git a/tests/src/Kernel/Entity/ParamConverter/RatePlanConverterTest.php b/tests/src/Kernel/Entity/ParamConverter/RatePlanConverterTest.php index e8abb936..876b9c39 100644 --- a/tests/src/Kernel/Entity/ParamConverter/RatePlanConverterTest.php +++ b/tests/src/Kernel/Entity/ParamConverter/RatePlanConverterTest.php @@ -19,11 +19,11 @@ namespace Drupal\Tests\apigee_m10n\Kernel\Entity\ParamConverter; -use Drupal\apigee_m10n\Entity\ParamConverter\RatePlanConverter; use Drupal\Core\Http\Exception\CacheableNotFoundHttpException; use Drupal\Core\ParamConverter\ParamNotConvertedException; use Drupal\Core\Url; use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; +use Drupal\apigee_m10n\Entity\ParamConverter\RatePlanConverter; use Symfony\Component\HttpFoundation\Request; /** diff --git a/tests/src/Kernel/Entity/ProductBundleEntityKernelTest.php b/tests/src/Kernel/Entity/ProductBundleEntityKernelTest.php index 22accb6a..c22c55db 100644 --- a/tests/src/Kernel/Entity/ProductBundleEntityKernelTest.php +++ b/tests/src/Kernel/Entity/ProductBundleEntityKernelTest.php @@ -19,13 +19,13 @@ namespace Drupal\Tests\apigee_m10n\Kernel\Entity; +use Drupal\Core\Routing\CurrentRouteMatch; +use Drupal\Core\Url; +use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; use Drupal\apigee_edge\Entity\EdgeEntityType; use Drupal\apigee_m10n\Entity\ProductBundle; use Drupal\apigee_m10n\Entity\ProductBundleInterface; use Drupal\apigee_m10n\Entity\Routing\MonetizationEntityRouteProvider; -use Drupal\Core\Routing\CurrentRouteMatch; -use Drupal\Core\Url; -use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; diff --git a/tests/src/Kernel/Entity/RatePlanEntityKernelTest.php b/tests/src/Kernel/Entity/RatePlanEntityKernelTest.php index 1328aad3..c384e86b 100644 --- a/tests/src/Kernel/Entity/RatePlanEntityKernelTest.php +++ b/tests/src/Kernel/Entity/RatePlanEntityKernelTest.php @@ -20,8 +20,8 @@ namespace Drupal\Tests\apigee_m10n\Kernel\Entity; use Apigee\Edge\Api\Monetization\Entity\RatePlanInterface; -use Drupal\apigee_m10n\Entity\RatePlan; use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; +use Drupal\apigee_m10n\Entity\RatePlan; /** * Test the `rate_plan` entity. diff --git a/tests/src/Kernel/Entity/Render/RatePlanRenderTest.php b/tests/src/Kernel/Entity/Render/RatePlanRenderTest.php index b22e99a9..130e8688 100644 --- a/tests/src/Kernel/Entity/Render/RatePlanRenderTest.php +++ b/tests/src/Kernel/Entity/Render/RatePlanRenderTest.php @@ -114,7 +114,7 @@ public function testRenderRatePlan() { $details = $rate_plan->getRatePlanDetails()[0]; $this->assertRatePlanDetails($details); - // TODO: test the purchase form. + // @todo test the purchase form. } } diff --git a/tests/src/Kernel/Entity/Storage/RatePlanStorageTest.php b/tests/src/Kernel/Entity/Storage/RatePlanStorageTest.php index 19110c97..9acea88b 100644 --- a/tests/src/Kernel/Entity/Storage/RatePlanStorageTest.php +++ b/tests/src/Kernel/Entity/Storage/RatePlanStorageTest.php @@ -20,8 +20,8 @@ namespace Drupal\Tests\apigee_m10n\Kernel\Entity\Render; use Apigee\Edge\Api\Monetization\Entity\RatePlanInterface; -use Drupal\apigee_m10n\Exception\InvalidRatePlanIdException; use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; +use Drupal\apigee_m10n\Exception\InvalidRatePlanIdException; /** * Kernel test for the rate plan storage. diff --git a/tests/src/Kernel/Form/RatePlanConfigFormTest.php b/tests/src/Kernel/Form/RatePlanConfigFormTest.php index 69d64322..f71b37e5 100644 --- a/tests/src/Kernel/Form/RatePlanConfigFormTest.php +++ b/tests/src/Kernel/Form/RatePlanConfigFormTest.php @@ -18,11 +18,11 @@ namespace Drupal\Tests\apigee_m10n\Kernel\Form; -use Drupal\apigee_m10n\Form\RatePlanConfigForm; use Drupal\Core\Entity\Entity\EntityViewDisplay; use Drupal\Core\Entity\Entity\EntityViewMode; use Drupal\Core\Form\FormState; use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; +use Drupal\apigee_m10n\Form\RatePlanConfigForm; /** * Tests for `apigee_m10n.rate_plan.config` settings. diff --git a/tests/src/Kernel/Form/ReportsDownloadFormTest.php b/tests/src/Kernel/Form/ReportsDownloadFormTest.php index 60408a1e..078a8cab 100644 --- a/tests/src/Kernel/Form/ReportsDownloadFormTest.php +++ b/tests/src/Kernel/Form/ReportsDownloadFormTest.php @@ -21,9 +21,9 @@ namespace Drupal\Tests\apigee_m10n\Kernel\Form; use Apigee\Edge\Api\Monetization\Entity\SupportedCurrency; -use Drupal\apigee_m10n\Form\ReportsDownloadForm; use Drupal\Core\Form\FormState; use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; +use Drupal\apigee_m10n\Form\ReportsDownloadForm; use Symfony\Component\HttpFoundation\Response; /** diff --git a/tests/src/Kernel/ModuleInstallKernelTest.php b/tests/src/Kernel/ModuleInstallKernelTest.php index be634ba7..e9c15584 100644 --- a/tests/src/Kernel/ModuleInstallKernelTest.php +++ b/tests/src/Kernel/ModuleInstallKernelTest.php @@ -19,11 +19,11 @@ namespace Drupal\Tests\apigee_m10n\Kernel; -use Drupal\apigee_m10n\MonetizationInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Url; use Drupal\KernelTests\KernelTestBase; use Drupal\Tests\user\Traits\UserCreationTrait; +use Drupal\apigee_m10n\MonetizationInterface; use Drupal\user\Entity\Role; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; diff --git a/tests/src/Kernel/MonetizationServiceKernelTest.php b/tests/src/Kernel/MonetizationServiceKernelTest.php index acc6b577..53d36b68 100644 --- a/tests/src/Kernel/MonetizationServiceKernelTest.php +++ b/tests/src/Kernel/MonetizationServiceKernelTest.php @@ -19,11 +19,11 @@ namespace Drupal\Tests\apigee_m10n\Kernel; -use Drupal\apigee_edge\Entity\ApiProduct; use Drupal\Core\Access\AccessResultAllowed; use Drupal\Core\Access\AccessResultForbidden; use Drupal\Core\Form\FormState; use Drupal\Core\Session\AccountInterface; +use Drupal\apigee_edge\Entity\ApiProduct; use Drupal\user\Entity\Role; use Drupal\user\Form\UserPermissionsForm; use Psr\Log\LoggerInterface; diff --git a/tests/src/Kernel/Plugin/Field/FieldFormatter/DateAndTextFormatterKernelTest.php b/tests/src/Kernel/Plugin/Field/FieldFormatter/DateAndTextFormatterKernelTest.php index fbeb5ab8..8c678189 100644 --- a/tests/src/Kernel/Plugin/Field/FieldFormatter/DateAndTextFormatterKernelTest.php +++ b/tests/src/Kernel/Plugin/Field/FieldFormatter/DateAndTextFormatterKernelTest.php @@ -20,10 +20,10 @@ namespace Drupal\Tests\apigee_m10n\Kernel\Plugin\Field\FieldFormatter; use Drupal\Component\Render\FormattableMarkup; +use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; use Drupal\entity_test\Entity\EntityTest; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; -use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; /** * Test the `apigee_date_and_text_formatter` field formatter. diff --git a/tests/src/Kernel/Plugin/Field/FieldFormatter/DatestampFormatterKernelTest.php b/tests/src/Kernel/Plugin/Field/FieldFormatter/DatestampFormatterKernelTest.php index 869f6dfb..5ac2c34a 100644 --- a/tests/src/Kernel/Plugin/Field/FieldFormatter/DatestampFormatterKernelTest.php +++ b/tests/src/Kernel/Plugin/Field/FieldFormatter/DatestampFormatterKernelTest.php @@ -19,10 +19,10 @@ namespace Drupal\Tests\apigee_m10n\Kernel\Plugin\Field\FieldFormatter; -use Drupal\apigee_m10n\MonetizationInterface; -use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\DatestampFormatter; use Drupal\Core\Field\FieldItemList; use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; +use Drupal\apigee_m10n\MonetizationInterface; +use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\DatestampFormatter; /** * Test the `apigee_datestamp` field formatter. @@ -112,7 +112,7 @@ public function testView() { 'timezone' => '', 'tooltip' => [ 'date_format' => $date_format, - 'custom_date_format' => 'm/d/Y' + 'custom_date_format' => 'm/d/Y', ], 'time_diff' => [ 'enabled' => FALSE, @@ -120,7 +120,7 @@ public function testView() { 'past_format' => '@interval ago', 'granularity' => 2, 'refresh' => 60, - ] + ], ], 'label' => TRUE, 'view_mode' => 'default', @@ -128,7 +128,7 @@ public function testView() { ]); static::assertInstanceOf(DatestampFormatter::class, $instance); - /* @var \DateTimeImmutable $value */ + /** @var \DateTimeImmutable $value */ $value = $this->purchasedPlan->getStartDate(); $expected = \Drupal::service('date.formatter') ->format($value->getTimestamp(), $date_format, $custom_date_format); diff --git a/tests/src/Kernel/Plugin/Field/FieldFormatter/MonetizationDeveloperFormatterKernelTest.php b/tests/src/Kernel/Plugin/Field/FieldFormatter/MonetizationDeveloperFormatterKernelTest.php index 0d1c4584..53a2291a 100644 --- a/tests/src/Kernel/Plugin/Field/FieldFormatter/MonetizationDeveloperFormatterKernelTest.php +++ b/tests/src/Kernel/Plugin/Field/FieldFormatter/MonetizationDeveloperFormatterKernelTest.php @@ -19,11 +19,11 @@ namespace Drupal\Tests\apigee_m10n\Kernel\Plugin\Field\FieldFormatter; +use Drupal\Core\Field\FieldItemList; +use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; use Drupal\apigee_m10n\MonetizationInterface; use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\MonetizationDeveloperFormatter; use Drupal\apigee_m10n\Plugin\Field\FieldType\MonetizationDeveloperFieldItem; -use Drupal\Core\Field\FieldItemList; -use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; /** * Test the `apigee_monetization_developer` field formatter. diff --git a/tests/src/Kernel/Plugin/Field/FieldFormatter/OrganizationFormatterKernelTest.php b/tests/src/Kernel/Plugin/Field/FieldFormatter/OrganizationFormatterKernelTest.php index 1ef306f4..0286a572 100644 --- a/tests/src/Kernel/Plugin/Field/FieldFormatter/OrganizationFormatterKernelTest.php +++ b/tests/src/Kernel/Plugin/Field/FieldFormatter/OrganizationFormatterKernelTest.php @@ -19,10 +19,10 @@ namespace Drupal\Tests\apigee_m10n\Kernel\Plugin\Field\FieldFormatter; -use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\OrganizationFormatter; -use Drupal\apigee_m10n\Plugin\Field\FieldType\OrganizationFieldItem; use Drupal\Core\Field\FieldItemList; use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; +use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\OrganizationFormatter; +use Drupal\apigee_m10n\Plugin\Field\FieldType\OrganizationFieldItem; /** * Test the `apigee_organization` field formatter. diff --git a/tests/src/Kernel/Plugin/Field/FieldFormatter/PriceFormatterKernelTest.php b/tests/src/Kernel/Plugin/Field/FieldFormatter/PriceFormatterKernelTest.php index 8e3a27f9..93d3cef0 100644 --- a/tests/src/Kernel/Plugin/Field/FieldFormatter/PriceFormatterKernelTest.php +++ b/tests/src/Kernel/Plugin/Field/FieldFormatter/PriceFormatterKernelTest.php @@ -19,9 +19,9 @@ namespace Drupal\Tests\apigee_m10n\Kernel\Plugin\Field\FieldFormatter; -use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\PriceFormatter; use Drupal\Core\Field\FieldItemList; use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; +use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\PriceFormatter; /** * Test the `apigee_price` field formatter. @@ -88,7 +88,7 @@ public function testView() { $item_list = $this->ratePlan->get('earlyTerminationFee'); static::assertInstanceOf(FieldItemList::class, $item_list); - /* @var \Drupal\Core\Field\BaseFieldDefinition $field_definition */ + /** @var \Drupal\Core\Field\BaseFieldDefinition $field_definition */ $field_definition = $this->fieldManager->getBaseFieldDefinitions('rate_plan')['earlyTerminationFee']; /** @var \Drupal\apigee_m10n\Plugin\Field\FieldFormatter\PriceFormatter $instance */ diff --git a/tests/src/Kernel/Plugin/Field/FieldFormatter/PurchasePlanFormFormatterKernelTest.php b/tests/src/Kernel/Plugin/Field/FieldFormatter/PurchasePlanFormFormatterKernelTest.php index d8d95de5..c3c0cbca 100644 --- a/tests/src/Kernel/Plugin/Field/FieldFormatter/PurchasePlanFormFormatterKernelTest.php +++ b/tests/src/Kernel/Plugin/Field/FieldFormatter/PurchasePlanFormFormatterKernelTest.php @@ -19,10 +19,10 @@ namespace Drupal\Tests\apigee_m10n\Kernel\Plugin\Field\FieldFormatter; -use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\PurchasePlanFormFormatter; -use Drupal\apigee_m10n\Plugin\Field\FieldType\PurchaseFieldItem; use Drupal\Core\Field\FieldItemList; use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; +use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\PurchasePlanFormFormatter; +use Drupal\apigee_m10n\Plugin\Field\FieldType\PurchaseFieldItem; /** * Test the `apigee_purchase_plan_link` field formatter. diff --git a/tests/src/Kernel/Plugin/Field/FieldFormatter/PurchasePlanLinkFormatterKernelTest.php b/tests/src/Kernel/Plugin/Field/FieldFormatter/PurchasePlanLinkFormatterKernelTest.php index e2746828..717b232b 100644 --- a/tests/src/Kernel/Plugin/Field/FieldFormatter/PurchasePlanLinkFormatterKernelTest.php +++ b/tests/src/Kernel/Plugin/Field/FieldFormatter/PurchasePlanLinkFormatterKernelTest.php @@ -19,10 +19,10 @@ namespace Drupal\Tests\apigee_m10n\Kernel\Plugin\Field\FieldFormatter; -use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\PurchasePlanLinkFormatter; -use Drupal\apigee_m10n\Plugin\Field\FieldType\PurchaseFieldItem; use Drupal\Core\Field\FieldItemList; use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; +use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\PurchasePlanLinkFormatter; +use Drupal\apigee_m10n\Plugin\Field\FieldType\PurchaseFieldItem; /** * Test the `apigee_purchase_plan_link` field formatter. diff --git a/tests/src/Kernel/Plugin/Field/FieldFormatter/RatePlanDetailsFormatterKernelTest.php b/tests/src/Kernel/Plugin/Field/FieldFormatter/RatePlanDetailsFormatterKernelTest.php index 5932b64d..0da36a83 100644 --- a/tests/src/Kernel/Plugin/Field/FieldFormatter/RatePlanDetailsFormatterKernelTest.php +++ b/tests/src/Kernel/Plugin/Field/FieldFormatter/RatePlanDetailsFormatterKernelTest.php @@ -19,11 +19,11 @@ namespace Drupal\Tests\apigee_m10n\Kernel\Plugin\Field\FieldFormatter; -use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\RatePlanDetailsFormatter; -use Drupal\apigee_m10n\Plugin\Field\FieldType\RatePlanDetailsFieldItem; use Drupal\Core\Field\FieldItemList; use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; use Drupal\Tests\apigee_m10n\Traits\RatePlanDetailsKernelTestAssertionTrait; +use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\RatePlanDetailsFormatter; +use Drupal\apigee_m10n\Plugin\Field\FieldType\RatePlanDetailsFieldItem; /** * Test the `apigee_rate_plan_details` field formatter. diff --git a/tests/src/Kernel/Plugin/Field/FieldFormatter/SupportedCurrencyFormatterKernelTest.php b/tests/src/Kernel/Plugin/Field/FieldFormatter/SupportedCurrencyFormatterKernelTest.php index a8a92ad5..f2e7ed94 100644 --- a/tests/src/Kernel/Plugin/Field/FieldFormatter/SupportedCurrencyFormatterKernelTest.php +++ b/tests/src/Kernel/Plugin/Field/FieldFormatter/SupportedCurrencyFormatterKernelTest.php @@ -19,10 +19,10 @@ namespace Drupal\Tests\apigee_m10n\Kernel\Plugin\Field\FieldFormatter; -use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\SupportedCurrencyFormatter; -use Drupal\apigee_m10n\Plugin\Field\FieldType\SupportedCurrencylFieldItem; use Drupal\Core\Field\FieldItemList; use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; +use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\SupportedCurrencyFormatter; +use Drupal\apigee_m10n\Plugin\Field\FieldType\SupportedCurrencylFieldItem; /** * Test the `apigee_currency` field formatter. diff --git a/tests/src/Kernel/Plugin/Field/FieldFormatter/TermsAndConditionsFormatterKernelTest.php b/tests/src/Kernel/Plugin/Field/FieldFormatter/TermsAndConditionsFormatterKernelTest.php index 05a91df8..ed250f38 100644 --- a/tests/src/Kernel/Plugin/Field/FieldFormatter/TermsAndConditionsFormatterKernelTest.php +++ b/tests/src/Kernel/Plugin/Field/FieldFormatter/TermsAndConditionsFormatterKernelTest.php @@ -20,11 +20,11 @@ namespace Drupal\Tests\apigee_m10n\Kernel\Plugin\Field\FieldFormatter; use Apigee\Edge\Api\Monetization\Entity\Developer; +use Drupal\Core\Field\FieldItemList; +use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; use Drupal\apigee_m10n\Entity\PurchasedPlan; use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\TermsAndConditionsFormatter; use Drupal\apigee_m10n\Plugin\Field\FieldType\TermsAndConditionsFieldItem; -use Drupal\Core\Field\FieldItemList; -use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; /** * Test the `apigee_tnc_default` field formatter. diff --git a/tests/src/Kernel/Plugin/Field/FieldWidget/BaseWidgetKernelTest.php b/tests/src/Kernel/Plugin/Field/FieldWidget/BaseWidgetKernelTest.php index 84e6bdc9..b3f6a4ca 100644 --- a/tests/src/Kernel/Plugin/Field/FieldWidget/BaseWidgetKernelTest.php +++ b/tests/src/Kernel/Plugin/Field/FieldWidget/BaseWidgetKernelTest.php @@ -19,11 +19,11 @@ namespace Drupal\Tests\apigee_m10n\Kernel\Plugin\Field\FieldWidget; -use Drupal\field\Entity\FieldConfig; -use Drupal\field\Entity\FieldStorageConfig; use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; use Drupal\Tests\node\Traits\ContentTypeCreationTrait; use Drupal\Tests\node\Traits\NodeCreationTrait; +use Drupal\field\Entity\FieldConfig; +use Drupal\field\Entity\FieldStorageConfig; /** * Base test class for field widget tests. diff --git a/tests/src/Traits/ApigeeMonetizationTestTrait.php b/tests/src/Traits/ApigeeMonetizationTestTrait.php index f96accc4..d8e38f1b 100644 --- a/tests/src/Traits/ApigeeMonetizationTestTrait.php +++ b/tests/src/Traits/ApigeeMonetizationTestTrait.php @@ -25,17 +25,16 @@ use Apigee\Edge\Api\Monetization\Entity\ApiPackage; use Apigee\Edge\Api\Monetization\Entity\ApiProduct as MonetizationApiProduct; use Apigee\Edge\Api\Monetization\Entity\Developer; -use Apigee\Edge\Api\Monetization\Entity\DeveloperRatePlan; use Apigee\Edge\Api\Monetization\Entity\Property\FreemiumPropertiesInterface; use Apigee\Edge\Api\Monetization\Structure\RatePlanDetail; use Apigee\Edge\Api\Monetization\Structure\RatePlanRateRateCard; use Behat\Mink\Exception\UnsupportedDriverActionException; +use Drupal\Tests\apigee_edge\Traits\ApigeeEdgeFunctionalTestTrait; +use Drupal\Tests\apigee_mock_api_client\Traits\ApigeeMockApiClientHelperTrait; use Drupal\apigee_edge\Entity\ApiProduct; use Drupal\apigee_edge\Entity\Developer as EdgeDeveloper; use Drupal\apigee_edge\Plugin\EdgeKeyTypeInterface; use Drupal\apigee_edge\UserDeveloperConverterInterface; -use Drupal\apigee_m10n\Entity\Package; -use Drupal\apigee_m10n\Entity\PackageInterface; use Drupal\apigee_m10n\Entity\ProductBundle; use Drupal\apigee_m10n\Entity\ProductBundleInterface; use Drupal\apigee_m10n\Entity\PurchasedPlan; @@ -43,10 +42,6 @@ use Drupal\apigee_m10n\Entity\RatePlan; use Drupal\apigee_m10n\Entity\RatePlanInterface; use Drupal\apigee_m10n\EnvironmentVariable; -use Drupal\apigee_m10n_test\Plugin\KeyProvider\TestEnvironmentVariablesKeyProvider; -use Drupal\key\Entity\Key; -use Drupal\Tests\apigee_edge\Traits\ApigeeEdgeFunctionalTestTrait; -use Drupal\Tests\apigee_mock_api_client\Traits\ApigeeMockApiClientHelperTrait; use Drupal\user\Entity\User; use Drupal\user\UserInterface; @@ -282,7 +277,7 @@ protected function createProductBundle(): ProductBundleInterface { * * @throws \Exception */ - protected function createRatePlan(ProductBundleInterface $product_bundle, $type = RatePlanInterface::TYPE_STANDARD, string $id = NULL, array $properties = []): RatePlanInterface { + protected function createRatePlan(ProductBundleInterface $product_bundle, $type = RatePlanInterface::TYPE_STANDARD, ?string $id = NULL, array $properties = []): RatePlanInterface { $client = $this->sdk_connector->getClient(); $org_name = $this->sdk_connector->getOrganization(); diff --git a/tests/src/Traits/ApigeeX/ApigeeMonetizationTestTrait.php b/tests/src/Traits/ApigeeX/ApigeeMonetizationTestTrait.php index a4fdef80..4c914dad 100755 --- a/tests/src/Traits/ApigeeX/ApigeeMonetizationTestTrait.php +++ b/tests/src/Traits/ApigeeX/ApigeeMonetizationTestTrait.php @@ -24,25 +24,19 @@ use Apigee\Edge\Api\ApigeeX\Structure\Fee; use Apigee\Edge\Api\ApigeeX\Structure\RatePlanXFee; use Apigee\Edge\Api\ApigeeX\Structure\RevenueShareRates; -use Apigee\Edge\Api\Management\Entity\DeveloperInterface; use Apigee\Edge\Api\Monetization\Entity\Developer; use Behat\Mink\Exception\UnsupportedDriverActionException; +use Drupal\Tests\apigee_edge\Traits\ApigeeEdgeFunctionalTestTrait; +use Drupal\Tests\apigee_m10n\Traits\AccountProphecyTrait; +use Drupal\Tests\apigee_mock_api_client\Traits\ApigeeMockApiClientHelperTrait; use Drupal\apigee_edge\Entity\ApiProduct; -use Drupal\apigee_edge\Entity\Developer as EdgeDeveloper; use Drupal\apigee_edge\Plugin\EdgeKeyTypeInterface; -use Drupal\apigee_edge\UserDeveloperConverterInterface; use Drupal\apigee_m10n\Entity\PurchasedProduct; use Drupal\apigee_m10n\Entity\PurchasedProductInterface; use Drupal\apigee_m10n\Entity\XProduct; use Drupal\apigee_m10n\Entity\XProductInterface; use Drupal\apigee_m10n\Entity\XRatePlan; use Drupal\apigee_m10n\Entity\XRatePlanInterface; -use Drupal\apigee_m10n\EnvironmentVariable; -use Drupal\apigee_m10n_test\Plugin\KeyProvider\TestEnvironmentVariablesKeyProvider; -use Drupal\key\Entity\Key; -use Drupal\Tests\apigee_edge\Traits\ApigeeEdgeFunctionalTestTrait; -use Drupal\Tests\apigee_m10n\Traits\AccountProphecyTrait; -use Drupal\Tests\apigee_mock_api_client\Traits\ApigeeMockApiClientHelperTrait; use Drupal\user\Entity\User; use Drupal\user\UserInterface; @@ -199,7 +193,7 @@ protected function createProduct(): ApigeexApiProduct { 'name' => $this->randomMachineName(), 'description' => $this->getRandomGenerator()->sentences(3), 'displayName' => $this->getRandomGenerator()->word(16), - 'approvalType' => ApiProduct::APPROVAL_TYPE_AUTO + 'approvalType' => ApiProduct::APPROVAL_TYPE_AUTO, ]); // Need to queue the management api product. $this->stack->queueMockResponse(['api_apigeex_product' => ['product' => $product]]); @@ -236,7 +230,7 @@ protected function createApigeexProduct(): XProductInterface { 'id' => $product->id(), 'name' => $product->getName(), 'description' => $product->getDescription(), - 'displayName' => $product->getDisplayName() + 'displayName' => $product->getDisplayName(), ]); $this->stack->queueMockResponse(['xpackage' => ['product' => $xpackage]]); @@ -262,7 +256,7 @@ protected function createApigeexProduct(): XProductInterface { * * @throws \Exception */ - protected function createRatePlan(XProductInterface $xproduct, $type = XRatePlanInterface::TYPE_STANDARD, string $id = NULL, array $properties = []): XRatePlanInterface { + protected function createRatePlan(XProductInterface $xproduct, $type = XRatePlanInterface::TYPE_STANDARD, ?string $id = NULL, array $properties = []): XRatePlanInterface { $start_date = new \DateTimeImmutable('2018-07-26 00:00:00', new \DateTimeZone($this->org_default_timezone)); $start_time = (int) ($start_date->getTimestamp() . $start_date->format('v')); $end_date = new \DateTimeImmutable('today +1 year', new \DateTimeZone($this->org_default_timezone)); @@ -277,20 +271,20 @@ protected function createRatePlan(XProductInterface $xproduct, $type = XRatePlan 'ratePlanXFee' => new RatePlanXFee([ 'currencyCode' => 'USD', 'units' => '1', - 'nanos' => 300000000 + 'nanos' => 300000000, ]), 'consumptionPricingType' => 'FIXED_PER_UNIT', 'consumptionPricingRates' => new ConsumptionPricingRate([ 'fee' => new Fee( [ - 'currencyCode' => 'USD', - 'units' => '1', - 'nanos' => 100000000 + 'currencyCode' => 'USD', + 'units' => '1', + 'nanos' => 100000000, ]), ]), 'revenueShareType' => 'FIXED', 'revenueShareRates' => new RevenueShareRates([ - 'sharePercentage' => 17.56 + 'sharePercentage' => 17.56, ]), 'state' => 'PUBLISHED', 'startTime' => $start_time, @@ -366,7 +360,7 @@ protected function createPurchasedProduct(UserInterface $user, XRatePlanInterfac 'email' => $user->getEmail(), 'name' => $user->getDisplayName(), ]), - 'startTime' => $start_time + 'startTime' => $start_time, ]); // Warm the purchased_plan. diff --git a/tests/src/Unit/DeveloperCacheContextTest.php b/tests/src/Unit/DeveloperCacheContextTest.php index f317da62..f2ec9418 100644 --- a/tests/src/Unit/DeveloperCacheContextTest.php +++ b/tests/src/Unit/DeveloperCacheContextTest.php @@ -19,8 +19,8 @@ namespace Drupal\Tests\apigee_m10n\Kernel; -use Drupal\apigee_m10n\Cache\DeveloperCacheContext; use Drupal\Tests\UnitTestCase; +use Drupal\apigee_m10n\Cache\DeveloperCacheContext; use Drupal\user\UserInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; From 34e9ab8b9751994ff766a408baca9224607aee77 Mon Sep 17 00:00:00 2001 From: Kedar Khaire Date: Tue, 24 Sep 2024 21:13:21 +0530 Subject: [PATCH 2/2] Changes for PHPCS fixes --- apigee_m10n.api.php | 2 +- .../src/AddCreditPermissions.php | 2 +- .../src/AddCreditProductManager.php | 2 +- .../src/AddCreditService.php | 24 +++++++++---------- .../src/AddCreditServiceInterface.php | 4 ++-- .../src/Element/PriceRange.php | 6 ++--- .../src/Entity/AddCreditLogInterface.php | 2 -- .../CommerceCurrencyConfigSubscriber.php | 12 ++++------ .../src/Form/AddCreditAddToCartForm.php | 6 +---- .../src/Form/AddCreditConfigForm.php | 10 ++++---- .../src/Form/BillingTypeForm.php | 13 ++++------ .../src/Form/ConfirmUpdateForm.php | 4 +--- .../src/Form/GeneralSettingsConfigForm.php | 2 +- .../src/Job/BalanceAdjustmentJob.php | 17 +++++++------ .../src/Job/BalanceAdjustmentJobX.php | 15 ++++-------- .../Plugin/AddCreditEntityType/Developer.php | 7 +++--- .../src/Plugin/AddCreditEntityTypeManager.php | 2 +- .../AddCreditProductsSelection.php | 2 +- .../PriceRangeDefaultFormatter.php | 2 +- .../Field/FieldType/AddCreditTargetItem.php | 8 +++---- .../Plugin/Field/FieldType/PriceRangeItem.php | 4 ++-- .../Requirement/AddCreditProductType.php | 4 ++-- .../Requirement/AddCreditProducts.php | 6 ++--- .../Requirement/Requirement/CommerceStore.php | 4 ++-- .../OrderItemAddToCartFormDisplay.php | 2 +- .../Requirement/PaymentGateway.php | 2 +- ...geDefaultOutOfRangeConstraintValidator.php | 4 +--- ...eMinimumTopUpAmountConstraintValidator.php | 2 +- .../Functional/AddCreditConfigFormTest.php | 4 ++-- .../AddCreditFunctionalTestBase.php | 6 ++--- .../Functional/AddCreditPermissionsTest.php | 2 +- .../AddCreditPrepaidBalancePageTest.php | 2 +- .../ApigeeX/AddCreditConfigFormTest.php | 4 ++-- .../ApigeeX/AddCreditFunctionalTestBase.php | 7 ++---- .../ApigeeX/AddCreditPermissionsTest.php | 8 +++---- .../AddCreditPrepaidBalancePageTest.php | 8 +++---- .../ApigeeX/GeneralSettingsConfigFormTest.php | 2 +- .../AddCreditCustomAmountTest.php | 8 +++---- .../AddCreditPrepaidBalanceButtonTest.php | 2 +- ...CreditPrepaidBalanceToAnyDeveloperTest.php | 2 +- .../ApigeeX/AddCreditCustomAmountTest.php | 8 +++---- .../AddCreditPrepaidBalanceButtonTest.php | 4 ++-- ...CreditPrepaidBalanceToAnyDeveloperTest.php | 2 +- .../ApigeeX/SetBillingType.php | 12 +++++----- .../ApigeeX/UpdateBillingTypeTest.php | 10 ++++---- .../AddCreditConfigStatusKernelTest.php | 4 ++-- .../AddCreditConfigStatusKernelTest.php | 3 +-- .../Kernel/BalanceAdjustmentJobKernelTest.php | 2 +- .../Plugin/AddCreditEntityTypeManagerTest.php | 4 ++-- .../AddCreditProductsSelectionTest.php | 2 +- .../Traits/AddCreditFunctionalTestTrait.php | 12 +++++----- .../ApigeeX/AddCreditFunctionalTestTrait.php | 15 ++++++------ ...faultOutOfRangeConstraintValidatorTest.php | 3 +-- ...mGreaterMaximumConstraintValidatorTest.php | 2 +- ...imumTopUpAmountConstraintValidatorTest.php | 2 +- ...eRangeUnitPriceConstraintValidatorTest.php | 2 +- .../src/Access/TeamPermissionAccessCheck.php | 6 ++--- .../Access/TeamPermissionAccessInterface.php | 2 +- .../src/ApigeeM10nTeamsServiceProvider.php | 4 ++-- .../src/Cache/TeamCacheContext.php | 2 +- .../TeamPrepaidBalanceController.php | 7 +++--- .../TeamPricingAndPlansController.php | 2 +- .../TeamRatePlanAccessControlHandler.php | 8 +++---- .../TeamRatePlanSubscriptionAccessHandler.php | 4 ++-- .../TeamPurchaseRatePlanController.php | 2 +- .../src/Entity/Form/TeamPurchasedPlanForm.php | 4 ++-- .../TeamPurchasedPlanListBuilder.php | 4 ++-- .../MonetizationTeamPermissionsProvider.php | 2 +- .../MonetizationTeamsEntityRouteProvider.php | 2 +- .../Storage/TeamProductBundleStorage.php | 2 +- .../Storage/TeamPurchasedPlanStorage.php | 2 +- .../src/Entity/TeamsPurchasedPlan.php | 4 ++-- .../src/Form/BillingDetailsForm.php | 6 ++--- .../TeamPrepaidBalanceReportsDownloadForm.php | 2 +- .../src/Form/TeamReportsDownloadForm.php | 4 ++-- .../src/MonetizationTeams.php | 14 +++++------ .../src/MonetizationTeamsInterface.php | 7 +++--- .../src/Plugin/AddCreditEntityType/Team.php | 5 ++-- .../TeamPurchasePlanFormFormatter.php | 2 +- .../TeamPurchasePlanLinkFormatter.php | 2 +- .../CompanyTermsAndConditionsWidget.php | 6 ++--- .../ApigeeM10nTeamsServiceProviderTest.php | 2 +- .../tests/src/Kernel/BillingDetailsTest.php | 1 - ...eamPricingAndPlansControllerKernelTest.php | 2 +- .../TeamRatePlanAccessControlHandlerTest.php | 2 +- .../Entity/ProductBundleEntityKernelTest.php | 4 ++-- .../PurchasedRatePlanEntityKernelTest.php | 2 +- .../Entity/RatePlanEntityKernelTest.php | 6 ++--- .../Kernel/Entity/TeamsEntityOverrideTest.php | 4 ++-- .../MonetizationTeamsKernelTestBase.php | 4 ++-- .../src/Kernel/MonetizationTeamsTest.php | 8 +++---- .../ApigeeMonetizationTeamsTestTrait.php | 1 - .../tests/src/Unit/TeamCacheContextTest.php | 2 +- .../TeamPermissionAccessCheckUnitTest.php | 8 +++---- src/Controller/BillingTypeController.php | 3 +-- src/Controller/BuyApiController.php | 13 ++++------ .../PrepaidBalanceControllerBase.php | 10 ++++---- src/Controller/PrepaidBalanceXController.php | 1 - .../PrepaidBalanceXControllerBase.php | 8 +++---- src/Controller/PricingAndPlansController.php | 13 ++++------ .../RatePlanSubscriptionAccessHandler.php | 2 +- .../XRatePlanSubscriptionAccessHandler.php | 2 +- .../Controller/PurchaseRatePlanController.php | 6 ++--- .../PurchaseRatePlanXController.php | 7 +++--- src/Entity/Form/CancelPurchaseConfirmForm.php | 4 ++-- .../CancelPurchasedProductConfirmForm.php | 4 ++-- .../Form/FieldableMonetizationEntityForm.php | 2 +- ...eldableMonetizationEntityFormInterface.php | 2 +- src/Entity/Form/PurchasedPlanForm.php | 16 ++++++------- src/Entity/Form/PurchasedProductForm.php | 19 ++++++--------- .../ListBuilder/PurchasedPlanListBuilder.php | 8 +++---- .../PurchasedPlanListBuilderForDeveloper.php | 6 ++--- .../PurchasedProductListBuilder.php | 7 +++--- ...urchasedProductListBuilderForDeveloper.php | 8 +++---- .../ListBuilder/XProductListBuilder.php | 2 -- src/Entity/ProductBundle.php | 2 +- src/Entity/PurchasedPlan.php | 6 ++--- src/Entity/PurchasedProduct.php | 11 ++++----- src/Entity/RatePlan.php | 4 ++-- .../MonetizationEntityRouteProvider.php | 2 +- ...operAcceptedRatePlanSdkControllerProxy.php | 2 +- ...perAcceptedRatePlanXSdkControllerProxy.php | 3 +-- .../Controller/RatePlanSdkControllerProxy.php | 2 +- .../XRatePlanSdkControllerProxy.php | 2 +- src/Entity/Storage/ProductBundleStorage.php | 10 ++++---- src/Entity/Storage/PurchasedPlanStorage.php | 10 ++++---- .../Storage/PurchasedProductStorage.php | 9 ++++--- src/Entity/Storage/RatePlanStorage.php | 9 ++++--- src/Entity/Storage/XProductStorage.php | 10 ++++---- src/Entity/Storage/XRatePlanStorage.php | 9 ++++--- src/Entity/XProduct.php | 2 +- src/Entity/XRatePlan.php | 5 ++-- .../ValidateMonetizationEnabledSubscriber.php | 2 +- src/Form/BillingDetailsForm.php | 4 ++-- src/Form/PrepaidBalanceConfigForm.php | 2 +- .../PrepaidBalanceReportsDownloadForm.php | 4 ++-- src/Form/ReportsDownloadForm.php | 2 +- src/Form/ReportsDownloadFormBase.php | 6 ++--- src/Monetization.php | 19 +++++++-------- src/MonetizationInterface.php | 4 ++-- .../ConsumptionPricingRatesFormatter.php | 3 +-- .../FixedRecurringFeeFormatter.php | 2 +- .../PurchasePlanFormFormatter.php | 6 ++--- .../PurchasePlanLinkFormatter.php | 2 +- .../PurchaseProductFormFormatter.php | 6 ++--- .../RatePlanDetailsFormatter.php | 2 +- .../FieldFormatter/RatePlanXFeeFormatter.php | 2 +- .../RevenueShareRatesFormatter.php | 2 +- .../TermsAndConditionsFormatter.php | 2 +- .../ConsumptionPricingRatesFieldItem.php | 2 +- .../FieldWidget/TermsAndConditionsWidget.php | 4 ++-- src/Plugin/Menu/PlansPluginClass.php | 1 - 152 files changed, 356 insertions(+), 425 deletions(-) diff --git a/apigee_m10n.api.php b/apigee_m10n.api.php index d8db51b4..69b360de 100644 --- a/apigee_m10n.api.php +++ b/apigee_m10n.api.php @@ -19,9 +19,9 @@ * MA 02110-1301, USA. */ -use Drupal\apigee_m10n\Entity\PurchasedPlanInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; +use Drupal\apigee_m10n\Entity\PurchasedPlanInterface; /** * @file diff --git a/modules/apigee_m10n_add_credit/src/AddCreditPermissions.php b/modules/apigee_m10n_add_credit/src/AddCreditPermissions.php index 4de37022..2e46d8ac 100644 --- a/modules/apigee_m10n_add_credit/src/AddCreditPermissions.php +++ b/modules/apigee_m10n_add_credit/src/AddCreditPermissions.php @@ -19,8 +19,8 @@ namespace Drupal\apigee_m10n_add_credit; -use Drupal\apigee_m10n_add_credit\Plugin\AddCreditEntityTypeManagerInterface; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; +use Drupal\apigee_m10n_add_credit\Plugin\AddCreditEntityTypeManagerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/modules/apigee_m10n_add_credit/src/AddCreditProductManager.php b/modules/apigee_m10n_add_credit/src/AddCreditProductManager.php index 979db89c..a151a8d7 100644 --- a/modules/apigee_m10n_add_credit/src/AddCreditProductManager.php +++ b/modules/apigee_m10n_add_credit/src/AddCreditProductManager.php @@ -19,9 +19,9 @@ namespace Drupal\apigee_m10n_add_credit; -use Drupal\commerce_product\Entity\ProductInterface; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; +use Drupal\commerce_product\Entity\ProductInterface; /** * Defines a service for managing add credit products. diff --git a/modules/apigee_m10n_add_credit/src/AddCreditService.php b/modules/apigee_m10n_add_credit/src/AddCreditService.php index e455fd5e..00f5694b 100755 --- a/modules/apigee_m10n_add_credit/src/AddCreditService.php +++ b/modules/apigee_m10n_add_credit/src/AddCreditService.php @@ -19,16 +19,6 @@ namespace Drupal\apigee_m10n_add_credit; -use Drupal\apigee_m10n\Entity\Form\PurchasedPlanForm; -use Drupal\apigee_m10n\Entity\Form\PurchasedProductForm; -use Drupal\apigee_m10n\Entity\PurchasedPlanInterface; -use Drupal\apigee_m10n\Entity\PurchasedProductInterface; -use Drupal\apigee_m10n_add_credit\Form\AddCreditAddToCartForm; -use Drupal\apigee_m10n_add_credit\Plugin\AddCreditEntityTypeManagerInterface; -use Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowBase; -use Drupal\commerce_order\Entity\OrderItemInterface; -use Drupal\commerce_product\Entity\ProductType; -use Drupal\commerce_product\Entity\ProductVariationInterface; use Drupal\Component\Utility\NestedArray; use Drupal\Core\Access\AccessResult; use Drupal\Core\Cache\Cache; @@ -44,6 +34,16 @@ use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\Url; +use Drupal\apigee_m10n\Entity\Form\PurchasedPlanForm; +use Drupal\apigee_m10n\Entity\Form\PurchasedProductForm; +use Drupal\apigee_m10n\Entity\PurchasedPlanInterface; +use Drupal\apigee_m10n\Entity\PurchasedProductInterface; +use Drupal\apigee_m10n_add_credit\Form\AddCreditAddToCartForm; +use Drupal\apigee_m10n_add_credit\Plugin\AddCreditEntityTypeManagerInterface; +use Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowBase; +use Drupal\commerce_order\Entity\OrderItemInterface; +use Drupal\commerce_product\Entity\ProductType; +use Drupal\commerce_product\Entity\ProductVariationInterface; /** * Helper service to handle basic module tasks. @@ -403,7 +403,7 @@ public function apigeeM10nPrepaidBalanceListAlter(array &$build, EntityInterface } } - // TODO: This can be move to entity operations when/if prepaid balance are + // @todo This can be move to entity operations when/if prepaid balance are // made into entities. if ((count($build['table']['#rows']))) { $has_operations = FALSE; @@ -593,7 +593,7 @@ public static function checkoutFormReviewValidate(array $form, FormStateInterfac foreach ($add_credit_items as $add_credit_item) { $price = $add_credit_item->getTotalPrice(); $currency_code = strtolower($price->getCurrencyCode()); - // TODO: Fail validation if the currency does not exist. + // @todo Fail validation if the currency does not exist. if (isset($supported_currencies[$currency_code]) && ($supported_currency = $supported_currencies[$currency_code]) && ($minimum_top_up_amount = $supported_currency->getMinimumTopUpAmount()) diff --git a/modules/apigee_m10n_add_credit/src/AddCreditServiceInterface.php b/modules/apigee_m10n_add_credit/src/AddCreditServiceInterface.php index f5f4e211..ef024f64 100644 --- a/modules/apigee_m10n_add_credit/src/AddCreditServiceInterface.php +++ b/modules/apigee_m10n_add_credit/src/AddCreditServiceInterface.php @@ -19,13 +19,13 @@ namespace Drupal\apigee_m10n_add_credit; -use Drupal\apigee_m10n\Entity\PurchasedPlanInterface; -use Drupal\apigee_m10n\Entity\PurchasedProductInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; +use Drupal\apigee_m10n\Entity\PurchasedPlanInterface; +use Drupal\apigee_m10n\Entity\PurchasedProductInterface; /** * The interface for the add credit service.. diff --git a/modules/apigee_m10n_add_credit/src/Element/PriceRange.php b/modules/apigee_m10n_add_credit/src/Element/PriceRange.php index b1c0fff6..94562e9c 100644 --- a/modules/apigee_m10n_add_credit/src/Element/PriceRange.php +++ b/modules/apigee_m10n_add_credit/src/Element/PriceRange.php @@ -119,12 +119,12 @@ public static function processElement(array $element, FormStateInterface $form_s ], '#attached' => [ 'library' => [ - 'apigee_m10n_add_credit/price_range' + 'apigee_m10n_add_credit/price_range', ], ], 'fields' => [ '#type' => 'container', - ] + ], ]; // Add the help text if specified. @@ -153,7 +153,7 @@ public static function processElement(array $element, FormStateInterface $form_s $element['price_range']['fields']['minimum']['#required'] = TRUE; if (isset($element['#ajax'])) { - // TODO: Explain why we have are copying ajax over to number fields. + // @todo Explain why we have are copying ajax over to number fields. $element['price_range']['fields'][$name]['#ajax'] = $element['#ajax']; } } diff --git a/modules/apigee_m10n_add_credit/src/Entity/AddCreditLogInterface.php b/modules/apigee_m10n_add_credit/src/Entity/AddCreditLogInterface.php index 1aeca95f..c53de2e7 100644 --- a/modules/apigee_m10n_add_credit/src/Entity/AddCreditLogInterface.php +++ b/modules/apigee_m10n_add_credit/src/Entity/AddCreditLogInterface.php @@ -20,8 +20,6 @@ namespace Drupal\apigee_m10n_add_credit\Entity; use Drupal\Core\Entity\ContentEntityInterface; -use Drupal\Core\Entity\EntityChangedInterface; -use Drupal\Core\Entity\EntityPublishedInterface; use Drupal\user\EntityOwnerInterface; /** diff --git a/modules/apigee_m10n_add_credit/src/EventSubscriber/CommerceCurrencyConfigSubscriber.php b/modules/apigee_m10n_add_credit/src/EventSubscriber/CommerceCurrencyConfigSubscriber.php index 819611ad..613953b4 100755 --- a/modules/apigee_m10n_add_credit/src/EventSubscriber/CommerceCurrencyConfigSubscriber.php +++ b/modules/apigee_m10n_add_credit/src/EventSubscriber/CommerceCurrencyConfigSubscriber.php @@ -7,15 +7,13 @@ namespace Drupal\apigee_m10n_add_credit\EventSubscriber; -use Drupal\apigee_m10n\MonetizationInterface; -use Drupal\apigee_m10n_add_credit\AddCreditConfig; -use Drupal\commerce_price\Price; use Drupal\Core\Config\ConfigCrudEvent; use Drupal\Core\Config\ConfigEvents; use Drupal\Core\Config\ConfigFactoryInterface; -use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Plugin\ContainerFactoryPluginInterface; +use Drupal\apigee_m10n\MonetizationInterface; +use Drupal\apigee_m10n_add_credit\AddCreditConfig; +use Drupal\commerce_price\Price; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** @@ -162,8 +160,8 @@ public function onCurrencyDelete(ConfigCrudEvent $event) { $original_data = $config->getOriginal(); $currencyCode = $original_data['currencyCode']; $addCreditProducts = $this->entityTypeManager->getStorage('commerce_product')->loadByProperties([ - 'apigee_add_credit_enabled' => '1' - ] + 'apigee_add_credit_enabled' => '1', + ] ); foreach ($addCreditProducts as $product) { if ($product_variation = $product->getDefaultVariation()) { diff --git a/modules/apigee_m10n_add_credit/src/Form/AddCreditAddToCartForm.php b/modules/apigee_m10n_add_credit/src/Form/AddCreditAddToCartForm.php index 0e851e67..fef7f7b0 100644 --- a/modules/apigee_m10n_add_credit/src/Form/AddCreditAddToCartForm.php +++ b/modules/apigee_m10n_add_credit/src/Form/AddCreditAddToCartForm.php @@ -19,14 +19,10 @@ namespace Drupal\apigee_m10n_add_credit\Form; +use Drupal\Core\Form\FormStateInterface; use Drupal\apigee_m10n_add_credit\AddCreditConfig; -use Drupal\apigee_m10n_add_credit\Plugin\AddCreditEntityTypeManagerInterface; use Drupal\commerce_cart\Form\AddToCartForm; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Routing\RouteMatchInterface; -use Drupal\Core\Session\AccountInterface; use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpFoundation\RequestStack; /** * Class AddCreditAddToCartForm. diff --git a/modules/apigee_m10n_add_credit/src/Form/AddCreditConfigForm.php b/modules/apigee_m10n_add_credit/src/Form/AddCreditConfigForm.php index 8bca2672..d7f33bc0 100755 --- a/modules/apigee_m10n_add_credit/src/Form/AddCreditConfigForm.php +++ b/modules/apigee_m10n_add_credit/src/Form/AddCreditConfigForm.php @@ -19,15 +19,15 @@ namespace Drupal\apigee_m10n_add_credit\Form; -use Drupal\apigee_m10n\MonetizationInterface; -use Drupal\apigee_m10n_add_credit\AddCreditConfig; -use Drupal\commerce_price\Entity\Currency; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Link; use Drupal\Core\Url; +use Drupal\apigee_m10n\MonetizationInterface; +use Drupal\apigee_m10n_add_credit\AddCreditConfig; +use Drupal\commerce_price\Entity\Currency; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -120,8 +120,8 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#type' => 'container', '#attributes' => [ 'class' => [ - 'container-inline' - ] + 'container-inline', + ], ], 'text' => [ '#type' => 'html_tag', diff --git a/modules/apigee_m10n_add_credit/src/Form/BillingTypeForm.php b/modules/apigee_m10n_add_credit/src/Form/BillingTypeForm.php index 727d2555..106dab60 100644 --- a/modules/apigee_m10n_add_credit/src/Form/BillingTypeForm.php +++ b/modules/apigee_m10n_add_credit/src/Form/BillingTypeForm.php @@ -19,10 +19,6 @@ namespace Drupal\apigee_m10n_add_credit\Form; -use Apigee\Edge\Api\ApigeeX\Controller\DeveloperBillingTypeController; -use Drupal\apigee_edge\Entity\Developer; -use Drupal\apigee_m10n\MonetizationInterface; -use Drupal\apigee_m10n_add_credit\Form\GeneralSettingsConfigForm; use Drupal\Core\Access\AccessResult; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; @@ -30,6 +26,7 @@ use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\apigee_m10n\MonetizationInterface; use Drupal\user\UserInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -146,7 +143,7 @@ public function getFormId() { /** * {@inheritdoc} */ - public function buildForm(array $form, FormStateInterface $form_state, UserInterface $user = NULL) { + public function buildForm(array $form, FormStateInterface $form_state, ?UserInterface $user = NULL) { $billingType = ['postpaid' => 'Postpaid' , 'prepaid' => 'Prepaid']; $developer_billingtype = $this->monetization->getBillingtype($user); $form['billingtype'] = [ @@ -168,8 +165,8 @@ public function buildForm(array $form, FormStateInterface $form_state, UserInter '#states' => [ 'disabled' => [ ':input[name="billingtype"]' => ['value' => strtolower($developer_billingtype)], - ] - ] + ], + ], ]; return $form; } @@ -177,7 +174,7 @@ public function buildForm(array $form, FormStateInterface $form_state, UserInter /** * {@inheritdoc} */ - public function submitForm(array &$form, FormStateInterface $form_state, UserInterface $user = NULL) { + public function submitForm(array &$form, FormStateInterface $form_state, ?UserInterface $user = NULL) { $user = $this->routeMatch->getParameter('user'); $billingtype_selected = $form_state->getValue('billingtype'); $form_state->setRedirect('apigee_m10n_add_credit.userbillingtype.confirm', ['user' => $user->id(), 'billingtype' => $billingtype_selected]); diff --git a/modules/apigee_m10n_add_credit/src/Form/ConfirmUpdateForm.php b/modules/apigee_m10n_add_credit/src/Form/ConfirmUpdateForm.php index 395d9373..76ef87dc 100644 --- a/modules/apigee_m10n_add_credit/src/Form/ConfirmUpdateForm.php +++ b/modules/apigee_m10n_add_credit/src/Form/ConfirmUpdateForm.php @@ -20,9 +20,6 @@ namespace Drupal\apigee_m10n_add_credit\Form; -use Apigee\Edge\Api\ApigeeX\Controller\DeveloperBillingTypeController; -use Drupal\apigee_edge\Entity\Developer; -use Drupal\apigee_m10n\MonetizationInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Form\ConfirmFormBase; use Drupal\Core\Form\FormStateInterface; @@ -30,6 +27,7 @@ use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Url; +use Drupal\apigee_m10n\MonetizationInterface; use Drupal\user\Entity\User; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/modules/apigee_m10n_add_credit/src/Form/GeneralSettingsConfigForm.php b/modules/apigee_m10n_add_credit/src/Form/GeneralSettingsConfigForm.php index cf5e5ec7..c76b7f82 100644 --- a/modules/apigee_m10n_add_credit/src/Form/GeneralSettingsConfigForm.php +++ b/modules/apigee_m10n_add_credit/src/Form/GeneralSettingsConfigForm.php @@ -18,11 +18,11 @@ namespace Drupal\apigee_m10n_add_credit\Form; -use Drupal\apigee_m10n\MonetizationInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; +use Drupal\apigee_m10n\MonetizationInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/modules/apigee_m10n_add_credit/src/Job/BalanceAdjustmentJob.php b/modules/apigee_m10n_add_credit/src/Job/BalanceAdjustmentJob.php index 955aab91..1a4bb2d4 100644 --- a/modules/apigee_m10n_add_credit/src/Job/BalanceAdjustmentJob.php +++ b/modules/apigee_m10n_add_credit/src/Job/BalanceAdjustmentJob.php @@ -21,6 +21,10 @@ use Apigee\Edge\Api\Management\Entity\CompanyInterface; use Apigee\Edge\Api\Monetization\Controller\PrepaidBalanceControllerInterface; +use Drupal\Core\Cache\Cache; +use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Language\Language; +use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\apigee_edge\Entity\DeveloperInterface; use Drupal\apigee_edge\Job\EdgeJob; use Drupal\apigee_m10n\Controller\PrepaidBalanceController; @@ -28,10 +32,6 @@ use Drupal\commerce_order\Adjustment; use Drupal\commerce_order\Entity\OrderInterface; use Drupal\commerce_price\Price; -use Drupal\Core\Cache\Cache; -use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Language\Language; -use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\user\UserInterface; /** @@ -44,7 +44,7 @@ * error will let the job runner know that the request was unsuccessful and will * trigger a retry. * - * @todo: Handle refunds when the monetization API supports it. + * @todo Handle refunds when the monetization API supports it. */ class BalanceAdjustmentJob extends EdgeJob { @@ -100,7 +100,7 @@ class BalanceAdjustmentJob extends EdgeJob { * @param \Drupal\commerce_order\Entity\OrderInterface $order * The drupal commerce order. */ - public function __construct(EntityInterface $company_or_user, Adjustment $adjustment, OrderInterface $order = NULL) { + public function __construct(EntityInterface $company_or_user, Adjustment $adjustment, ?OrderInterface $order = NULL) { parent::__construct(); // Either a developer or a company can be passed. @@ -236,7 +236,6 @@ public function shouldRetry(\Exception $exception): bool { // wasn't applied, we could return true here and the top-up would be // retried. // @todo Return true once we can determine the payment wasn't applied. - return FALSE; } @@ -427,10 +426,10 @@ protected function logTransaction($currency_code, \DateTimeImmutable $transactio $csv = array_map('str_getcsv', explode("\r\n", $report)); // This assumes the last transaction is the one we just performed. - // @todo: Find a better way to retrieve the transaction ID. + // @todo Find a better way to retrieve the transaction ID. $transaction = end($csv); - /* @var \Drupal\apigee_m10n_add_credit\Entity\AddCreditLogInterface $log */ + /** @var \Drupal\apigee_m10n_add_credit\Entity\AddCreditLogInterface $log */ $log = \Drupal::entityTypeManager()->getStorage('add_credit_log')->create([ 'commerce_order' => $this->order ? $this->order->id() : NULL, 'apigee_transaction' => isset($transaction[6]) ?: NULL, diff --git a/modules/apigee_m10n_add_credit/src/Job/BalanceAdjustmentJobX.php b/modules/apigee_m10n_add_credit/src/Job/BalanceAdjustmentJobX.php index d39518cc..18f57ad9 100644 --- a/modules/apigee_m10n_add_credit/src/Job/BalanceAdjustmentJobX.php +++ b/modules/apigee_m10n_add_credit/src/Job/BalanceAdjustmentJobX.php @@ -20,18 +20,14 @@ namespace Drupal\apigee_m10n_add_credit\Job; use Apigee\Edge\Api\ApigeeX\Controller\PrepaidBalanceControllerInterface; -use Drupal\apigee_edge\Entity\DeveloperInterface; +use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Language\Language; +use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\apigee_edge\Job\EdgeJob; -use Drupal\apigee_m10n\Controller\PrepaidBalanceXController; use Drupal\apigee_m10n_add_credit\AddCreditConfig; use Drupal\commerce_order\Adjustment; use Drupal\commerce_order\Entity\OrderInterface; use Drupal\commerce_price\Price; -use Drupal\Core\Cache\Cache; -use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Language\Language; -use Drupal\Core\StringTranslation\StringTranslationTrait; -use Drupal\user\UserInterface; /** * An apigee job that will apply a balance adjustment. @@ -43,7 +39,7 @@ * error will let the job runner know that the request was unsuccessful and will * trigger a retry. * - * @todo: Handle refunds when the monetization API supports it. + * @todo Handle refunds when the monetization API supports it. */ class BalanceAdjustmentJobX extends EdgeJob { @@ -92,7 +88,7 @@ class BalanceAdjustmentJobX extends EdgeJob { * @param \Drupal\commerce_order\Entity\OrderInterface $order * The drupal commerce order. */ - public function __construct(EntityInterface $developer, Adjustment $adjustment, OrderInterface $order = NULL) { + public function __construct(EntityInterface $developer, Adjustment $adjustment, ?OrderInterface $order = NULL) { parent::__construct(); $this->developer = $developer->getOwner(); @@ -220,7 +216,6 @@ public function shouldRetry(\Exception $exception): bool { // wasn't applied, we could return true here and the top-up would be // retried. // @todo Return true once we can determine the payment wasn't applied. - return FALSE; } diff --git a/modules/apigee_m10n_add_credit/src/Plugin/AddCreditEntityType/Developer.php b/modules/apigee_m10n_add_credit/src/Plugin/AddCreditEntityType/Developer.php index 4354cd73..78ef8b6e 100644 --- a/modules/apigee_m10n_add_credit/src/Plugin/AddCreditEntityType/Developer.php +++ b/modules/apigee_m10n_add_credit/src/Plugin/AddCreditEntityType/Developer.php @@ -19,13 +19,12 @@ namespace Drupal\apigee_m10n_add_credit\Plugin\AddCreditEntityType; -use Drupal\apigee_edge\Entity\DeveloperInterface; -use Drupal\apigee_m10n_add_credit\AddCreditConfig; -use Drupal\apigee_m10n_add_credit\Annotation\AddCreditEntityType; -use Drupal\apigee_m10n_add_credit\Plugin\AddCreditEntityTypeBase; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\apigee_edge\Entity\DeveloperInterface; +use Drupal\apigee_m10n_add_credit\AddCreditConfig; +use Drupal\apigee_m10n_add_credit\Plugin\AddCreditEntityTypeBase; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RequestStack; diff --git a/modules/apigee_m10n_add_credit/src/Plugin/AddCreditEntityTypeManager.php b/modules/apigee_m10n_add_credit/src/Plugin/AddCreditEntityTypeManager.php index 2ee26014..086fe4ff 100644 --- a/modules/apigee_m10n_add_credit/src/Plugin/AddCreditEntityTypeManager.php +++ b/modules/apigee_m10n_add_credit/src/Plugin/AddCreditEntityTypeManager.php @@ -19,11 +19,11 @@ namespace Drupal\apigee_m10n_add_credit\Plugin; -use Drupal\apigee_m10n_add_credit\Annotation\AddCreditEntityType; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Plugin\DefaultPluginManager; use Drupal\Core\Session\AccountInterface; +use Drupal\apigee_m10n_add_credit\Annotation\AddCreditEntityType; /** * Defines a manager for add credit entity type plugins. diff --git a/modules/apigee_m10n_add_credit/src/Plugin/EntityReferenceSelection/AddCreditProductsSelection.php b/modules/apigee_m10n_add_credit/src/Plugin/EntityReferenceSelection/AddCreditProductsSelection.php index 55cd1bc2..ce534e72 100644 --- a/modules/apigee_m10n_add_credit/src/Plugin/EntityReferenceSelection/AddCreditProductsSelection.php +++ b/modules/apigee_m10n_add_credit/src/Plugin/EntityReferenceSelection/AddCreditProductsSelection.php @@ -20,8 +20,8 @@ namespace Drupal\apigee_m10n_add_credit\Plugin\EntityReferenceSelection; -use Drupal\apigee_m10n_add_credit\AddCreditConfig; use Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection; +use Drupal\apigee_m10n_add_credit\AddCreditConfig; /** * Provides a entity selection plugin for add credit products. diff --git a/modules/apigee_m10n_add_credit/src/Plugin/Field/FieldFormatter/PriceRangeDefaultFormatter.php b/modules/apigee_m10n_add_credit/src/Plugin/Field/FieldFormatter/PriceRangeDefaultFormatter.php index 59a66a9a..08d60c53 100644 --- a/modules/apigee_m10n_add_credit/src/Plugin/Field/FieldFormatter/PriceRangeDefaultFormatter.php +++ b/modules/apigee_m10n_add_credit/src/Plugin/Field/FieldFormatter/PriceRangeDefaultFormatter.php @@ -19,9 +19,9 @@ namespace Drupal\apigee_m10n_add_credit\Plugin\Field\FieldFormatter; -use Drupal\commerce_price\Plugin\Field\FieldFormatter\PriceDefaultFormatter; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Language\LanguageInterface; +use Drupal\commerce_price\Plugin\Field\FieldFormatter\PriceDefaultFormatter; /** * Plugin implementation of the 'price_range_default' formatter. diff --git a/modules/apigee_m10n_add_credit/src/Plugin/Field/FieldType/AddCreditTargetItem.php b/modules/apigee_m10n_add_credit/src/Plugin/Field/FieldType/AddCreditTargetItem.php index 319ecf49..176994e9 100644 --- a/modules/apigee_m10n_add_credit/src/Plugin/Field/FieldType/AddCreditTargetItem.php +++ b/modules/apigee_m10n_add_credit/src/Plugin/Field/FieldType/AddCreditTargetItem.php @@ -103,21 +103,21 @@ public static function mainPropertyName() { /** * {@inheritdoc} */ - public function getPossibleValues(AccountInterface $account = NULL) { + public function getPossibleValues(?AccountInterface $account = NULL) { return $this->getSettableValues($account); } /** * {@inheritdoc} */ - public function getPossibleOptions(AccountInterface $account = NULL) { + public function getPossibleOptions(?AccountInterface $account = NULL) { return $this->getSettableOptions($account); } /** * {@inheritdoc} */ - public function getSettableValues(AccountInterface $account = NULL) { + public function getSettableValues(?AccountInterface $account = NULL) { $flatten_options = OptGroup::flattenOptions($this->getSettableOptions($account)); return array_keys($flatten_options); } @@ -125,7 +125,7 @@ public function getSettableValues(AccountInterface $account = NULL) { /** * {@inheritdoc} */ - public function getSettableOptions(AccountInterface $account = NULL) { + public function getSettableOptions(?AccountInterface $account = NULL) { $entity_bundle_info = \Drupal::service('entity_type.bundle.info'); $options = []; foreach (\Drupal::service('plugin.manager.apigee_add_credit_entity_type')->getEntities($account) as $entity_type => $entities) { diff --git a/modules/apigee_m10n_add_credit/src/Plugin/Field/FieldType/PriceRangeItem.php b/modules/apigee_m10n_add_credit/src/Plugin/Field/FieldType/PriceRangeItem.php index 7801b6f9..03501486 100644 --- a/modules/apigee_m10n_add_credit/src/Plugin/Field/FieldType/PriceRangeItem.php +++ b/modules/apigee_m10n_add_credit/src/Plugin/Field/FieldType/PriceRangeItem.php @@ -19,12 +19,12 @@ namespace Drupal\apigee_m10n_add_credit\Plugin\Field\FieldType; -use Drupal\apigee_m10n_add_credit\Element\PriceRange; -use Drupal\commerce_price\Price; use Drupal\Core\Field\FieldItemBase; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\TypedData\DataDefinition; +use Drupal\apigee_m10n_add_credit\Element\PriceRange; +use Drupal\commerce_price\Price; /** * Plugin implementation of the 'apigee_price_range' field type. diff --git a/modules/apigee_m10n_add_credit/src/Plugin/Requirement/Requirement/AddCreditProductType.php b/modules/apigee_m10n_add_credit/src/Plugin/Requirement/Requirement/AddCreditProductType.php index ff77122f..5eb1432b 100644 --- a/modules/apigee_m10n_add_credit/src/Plugin/Requirement/Requirement/AddCreditProductType.php +++ b/modules/apigee_m10n_add_credit/src/Plugin/Requirement/Requirement/AddCreditProductType.php @@ -56,7 +56,7 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta * {@inheritdoc} */ public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { - /* @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface $display_repository */ + /** @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface $display_repository */ $display_repository = \Drupal::service('entity_display.repository'); $order_type_id = ''; @@ -72,7 +72,7 @@ public function submitConfigurationForm(array &$form, FormStateInterface $form_s 'id' => 'add_credit', 'label' => 'Add credit', 'targetEntityType' => 'commerce_order', - 'configuration' => ['pattern' => '[commerce_order:uuid]-[pattern:number]'] + 'configuration' => ['pattern' => '[commerce_order:uuid]-[pattern:number]'], ]); $number_pattern->save(); } diff --git a/modules/apigee_m10n_add_credit/src/Plugin/Requirement/Requirement/AddCreditProducts.php b/modules/apigee_m10n_add_credit/src/Plugin/Requirement/Requirement/AddCreditProducts.php index cadad481..0a777916 100644 --- a/modules/apigee_m10n_add_credit/src/Plugin/Requirement/Requirement/AddCreditProducts.php +++ b/modules/apigee_m10n_add_credit/src/Plugin/Requirement/Requirement/AddCreditProducts.php @@ -23,12 +23,12 @@ use Apigee\Edge\Api\Monetization\Controller\SupportedCurrencyController; use Apigee\Edge\Api\Monetization\Entity\SupportedCurrencyInterface; use CommerceGuys\Intl\Currency\CurrencyRepository; -use Drupal\apigee_m10n\ApigeeEdgeSdkConnectorTrait; -use Drupal\apigee_m10n_add_credit\AddCreditConfig; -use Drupal\commerce_price\Price; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Language\LanguageManagerInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; +use Drupal\apigee_m10n\ApigeeEdgeSdkConnectorTrait; +use Drupal\apigee_m10n_add_credit\AddCreditConfig; +use Drupal\commerce_price\Price; use Drupal\requirement\Plugin\RequirementBase; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/modules/apigee_m10n_add_credit/src/Plugin/Requirement/Requirement/CommerceStore.php b/modules/apigee_m10n_add_credit/src/Plugin/Requirement/Requirement/CommerceStore.php index 6cf8ec83..98558648 100644 --- a/modules/apigee_m10n_add_credit/src/Plugin/Requirement/Requirement/CommerceStore.php +++ b/modules/apigee_m10n_add_credit/src/Plugin/Requirement/Requirement/CommerceStore.php @@ -23,11 +23,11 @@ use Apigee\Edge\Api\Monetization\Controller\OrganizationProfileController; use CommerceGuys\Addressing\AddressFormat\AddressField; use CommerceGuys\Addressing\Subdivision\SubdivisionRepositoryInterface; +use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\address\FieldHelper; use Drupal\address\LabelHelper; use Drupal\apigee_edge\SDKConnectorInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\requirement\Plugin\RequirementBase; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/modules/apigee_m10n_add_credit/src/Plugin/Requirement/Requirement/OrderItemAddToCartFormDisplay.php b/modules/apigee_m10n_add_credit/src/Plugin/Requirement/Requirement/OrderItemAddToCartFormDisplay.php index 0aaa25bb..daf2b91d 100644 --- a/modules/apigee_m10n_add_credit/src/Plugin/Requirement/Requirement/OrderItemAddToCartFormDisplay.php +++ b/modules/apigee_m10n_add_credit/src/Plugin/Requirement/Requirement/OrderItemAddToCartFormDisplay.php @@ -19,11 +19,11 @@ namespace Drupal\apigee_m10n_add_credit\Plugin\Requirement\Requirement; -use Drupal\apigee_m10n_add_credit\AddCreditConfig; use Drupal\Core\Entity\Display\EntityFormDisplayInterface; use Drupal\Core\Entity\EntityDisplayRepositoryInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; +use Drupal\apigee_m10n_add_credit\AddCreditConfig; use Drupal\requirement\Plugin\RequirementBase; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/modules/apigee_m10n_add_credit/src/Plugin/Requirement/Requirement/PaymentGateway.php b/modules/apigee_m10n_add_credit/src/Plugin/Requirement/Requirement/PaymentGateway.php index d1c628d0..adbd65bc 100644 --- a/modules/apigee_m10n_add_credit/src/Plugin/Requirement/Requirement/PaymentGateway.php +++ b/modules/apigee_m10n_add_credit/src/Plugin/Requirement/Requirement/PaymentGateway.php @@ -19,10 +19,10 @@ namespace Drupal\apigee_m10n_add_credit\Plugin\Requirement\Requirement; -use Drupal\commerce_payment\PaymentGatewayManager; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Url; +use Drupal\commerce_payment\PaymentGatewayManager; use Drupal\requirement\Plugin\RequirementBase; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/modules/apigee_m10n_add_credit/src/Plugin/Validation/Constraint/PriceRangeDefaultOutOfRangeConstraintValidator.php b/modules/apigee_m10n_add_credit/src/Plugin/Validation/Constraint/PriceRangeDefaultOutOfRangeConstraintValidator.php index 2243cfe8..c0a8094d 100644 --- a/modules/apigee_m10n_add_credit/src/Plugin/Validation/Constraint/PriceRangeDefaultOutOfRangeConstraintValidator.php +++ b/modules/apigee_m10n_add_credit/src/Plugin/Validation/Constraint/PriceRangeDefaultOutOfRangeConstraintValidator.php @@ -20,10 +20,8 @@ namespace Drupal\apigee_m10n_add_credit\Plugin\Validation\Constraint; use CommerceGuys\Intl\Formatter\CurrencyFormatterInterface; -use Drupal\apigee_m10n_add_credit\Element\PriceRange; -use Drupal\apigee_m10n_add_credit\Plugin\Field\FieldType\PriceRangeItem; -use Drupal\commerce_price\Calculator; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; +use Drupal\apigee_m10n_add_credit\Plugin\Field\FieldType\PriceRangeItem; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; diff --git a/modules/apigee_m10n_add_credit/src/Plugin/Validation/Constraint/PriceRangeMinimumTopUpAmountConstraintValidator.php b/modules/apigee_m10n_add_credit/src/Plugin/Validation/Constraint/PriceRangeMinimumTopUpAmountConstraintValidator.php index fdf6cb8d..1391ff3b 100644 --- a/modules/apigee_m10n_add_credit/src/Plugin/Validation/Constraint/PriceRangeMinimumTopUpAmountConstraintValidator.php +++ b/modules/apigee_m10n_add_credit/src/Plugin/Validation/Constraint/PriceRangeMinimumTopUpAmountConstraintValidator.php @@ -20,9 +20,9 @@ namespace Drupal\apigee_m10n_add_credit\Plugin\Validation\Constraint; use CommerceGuys\Intl\Formatter\CurrencyFormatterInterface; +use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\apigee_m10n\MonetizationInterface; use Drupal\apigee_m10n_add_credit\Plugin\Field\FieldType\PriceRangeItem; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; diff --git a/modules/apigee_m10n_add_credit/tests/src/Functional/AddCreditConfigFormTest.php b/modules/apigee_m10n_add_credit/tests/src/Functional/AddCreditConfigFormTest.php index 157c67ff..7276c04e 100644 --- a/modules/apigee_m10n_add_credit/tests/src/Functional/AddCreditConfigFormTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/Functional/AddCreditConfigFormTest.php @@ -19,9 +19,9 @@ namespace Drupal\Tests\apigee_m10n_add_credit\Functional; +use Drupal\Core\Url; use Drupal\apigee_m10n_add_credit\AddCreditConfig; use Drupal\commerce_product\Entity\ProductType; -use Drupal\Core\Url; /** * Tests the add credit config form. @@ -103,7 +103,7 @@ public function testConfigFormUi() { $this->assertCssElementContains('div.apigee-add-credit-notification-note', 'See Drupal commerce documentation.'); // Test form config. - // TODO: cache supported currencies. + // @todo cache supported currencies. $this->queueMockResponses(['get-supported-currencies', 'get-supported-currencies']); $this->submitForm([ 'use_modal' => FALSE, diff --git a/modules/apigee_m10n_add_credit/tests/src/Functional/AddCreditFunctionalTestBase.php b/modules/apigee_m10n_add_credit/tests/src/Functional/AddCreditFunctionalTestBase.php index 2f33f89e..7bf22695 100644 --- a/modules/apigee_m10n_add_credit/tests/src/Functional/AddCreditFunctionalTestBase.php +++ b/modules/apigee_m10n_add_credit/tests/src/Functional/AddCreditFunctionalTestBase.php @@ -21,10 +21,10 @@ use Apigee\Edge\Api\Monetization\Entity\Developer; use Apigee\Edge\Api\Monetization\Entity\SupportedCurrency; -use Drupal\apigee_edge\Job\Job; -use Drupal\commerce_product\Entity\ProductInterface; use Drupal\Tests\apigee_m10n\Functional\MonetizationFunctionalTestBase; use Drupal\Tests\apigee_m10n_add_credit\Traits\AddCreditFunctionalTestTrait; +use Drupal\apigee_edge\Job\Job; +use Drupal\commerce_product\Entity\ProductInterface; use Drupal\user\UserInterface; /** @@ -57,7 +57,7 @@ class AddCreditFunctionalTestBase extends MonetizationFunctionalTestBase { 'commerce', 'user', 'field_ui', - 'jquery_ui_dialog' + 'jquery_ui_dialog', ]; /** diff --git a/modules/apigee_m10n_add_credit/tests/src/Functional/AddCreditPermissionsTest.php b/modules/apigee_m10n_add_credit/tests/src/Functional/AddCreditPermissionsTest.php index fa9a76b1..626889ca 100644 --- a/modules/apigee_m10n_add_credit/tests/src/Functional/AddCreditPermissionsTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/Functional/AddCreditPermissionsTest.php @@ -19,8 +19,8 @@ namespace Drupal\Tests\apigee_m10n_add_credit\Functional; -use Drupal\commerce_product\Entity\ProductType; use Drupal\Core\Url; +use Drupal\commerce_product\Entity\ProductType; use Drupal\user\RoleInterface; /** diff --git a/modules/apigee_m10n_add_credit/tests/src/Functional/AddCreditPrepaidBalancePageTest.php b/modules/apigee_m10n_add_credit/tests/src/Functional/AddCreditPrepaidBalancePageTest.php index 9eb9f69d..e4831963 100644 --- a/modules/apigee_m10n_add_credit/tests/src/Functional/AddCreditPrepaidBalancePageTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/Functional/AddCreditPrepaidBalancePageTest.php @@ -19,9 +19,9 @@ namespace Drupal\Tests\apigee_m10n_add_credit\Functional; +use Drupal\Core\Url; use Drupal\apigee_m10n_add_credit\AddCreditConfig; use Drupal\commerce_product\Entity\ProductType; -use Drupal\Core\Url; /** * Tests the add credit button on prepaid balance page. diff --git a/modules/apigee_m10n_add_credit/tests/src/Functional/ApigeeX/AddCreditConfigFormTest.php b/modules/apigee_m10n_add_credit/tests/src/Functional/ApigeeX/AddCreditConfigFormTest.php index b413513a..d7f94365 100644 --- a/modules/apigee_m10n_add_credit/tests/src/Functional/ApigeeX/AddCreditConfigFormTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/Functional/ApigeeX/AddCreditConfigFormTest.php @@ -19,9 +19,9 @@ namespace Drupal\Tests\apigee_m10n_add_credit\Functional\ApigeeX; +use Drupal\Core\Url; use Drupal\apigee_m10n_add_credit\AddCreditConfig; use Drupal\commerce_product\Entity\ProductType; -use Drupal\Core\Url; /** * Tests the add credit config form. @@ -106,7 +106,7 @@ public function testConfigFormUi() { $this->assertCssElementContains('div.apigee-add-credit-notification-note', 'See Drupal commerce documentation.'); // Test form config. - // TODO: cache supported currencies. + // @todo cache supported currencies. $this->submitForm([ 'use_modal' => FALSE, 'notify_on' => AddCreditConfig::NOTIFY_ALWAYS, diff --git a/modules/apigee_m10n_add_credit/tests/src/Functional/ApigeeX/AddCreditFunctionalTestBase.php b/modules/apigee_m10n_add_credit/tests/src/Functional/ApigeeX/AddCreditFunctionalTestBase.php index 439dce9e..83e29d17 100644 --- a/modules/apigee_m10n_add_credit/tests/src/Functional/ApigeeX/AddCreditFunctionalTestBase.php +++ b/modules/apigee_m10n_add_credit/tests/src/Functional/ApigeeX/AddCreditFunctionalTestBase.php @@ -19,12 +19,10 @@ namespace Drupal\Tests\apigee_m10n_add_credit\Functional\ApigeeX; -use Apigee\Edge\Api\Monetization\Entity\Developer; use Apigee\Edge\Api\Monetization\Entity\SupportedCurrency; -use Drupal\apigee_edge\Job\Job; -use Drupal\commerce_product\Entity\ProductInterface; use Drupal\Tests\apigee_m10n\Functional\ApigeeX\MonetizationFunctionalTestBase; use Drupal\Tests\apigee_m10n_add_credit\Traits\ApigeeX\AddCreditFunctionalTestTrait; +use Drupal\commerce_product\Entity\ProductInterface; use Drupal\user\UserInterface; /** @@ -57,7 +55,7 @@ class AddCreditFunctionalTestBase extends MonetizationFunctionalTestBase { 'commerce', 'user', 'field_ui', - 'jquery_ui_dialog' + 'jquery_ui_dialog', ]; /** @@ -97,7 +95,6 @@ protected function checkout(UserInterface $developer, ProductInterface $product, // Before finalizing the payment, we have to add a couple of responses to // the queue. - $this->warmApigeexOrganizationCache(); $this->stack diff --git a/modules/apigee_m10n_add_credit/tests/src/Functional/ApigeeX/AddCreditPermissionsTest.php b/modules/apigee_m10n_add_credit/tests/src/Functional/ApigeeX/AddCreditPermissionsTest.php index 807ef9e7..89fb6c3b 100644 --- a/modules/apigee_m10n_add_credit/tests/src/Functional/ApigeeX/AddCreditPermissionsTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/Functional/ApigeeX/AddCreditPermissionsTest.php @@ -19,8 +19,8 @@ namespace Drupal\Tests\apigee_m10n_add_credit\Functional\ApigeeX; -use Drupal\commerce_product\Entity\ProductType; use Drupal\Core\Url; +use Drupal\commerce_product\Entity\ProductType; use Drupal\user\RoleInterface; /** @@ -131,9 +131,9 @@ public function testAddCreditButtonPermissionsOnPrepaidBalancePage() { // Create and sign in a user with add credit permissions. $this->stack->queueMockResponse(['post-apigeex-billing-type']); $this->developer = $this->signIn([ - 'view own prepaid balance', - 'add credit to own developer prepaid balance' - ], 'Prepaid'); + 'view own prepaid balance', + 'add credit to own developer prepaid balance', + ], 'Prepaid'); $this->queueApigeexDeveloperResponse($this->developer); $this->stack->queueMockResponse(['get-apigeex-billing-type']); diff --git a/modules/apigee_m10n_add_credit/tests/src/Functional/ApigeeX/AddCreditPrepaidBalancePageTest.php b/modules/apigee_m10n_add_credit/tests/src/Functional/ApigeeX/AddCreditPrepaidBalancePageTest.php index 50269a45..fc69c820 100644 --- a/modules/apigee_m10n_add_credit/tests/src/Functional/ApigeeX/AddCreditPrepaidBalancePageTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/Functional/ApigeeX/AddCreditPrepaidBalancePageTest.php @@ -19,9 +19,9 @@ namespace Drupal\Tests\apigee_m10n_add_credit\Functional\ApigeeX; +use Drupal\Core\Url; use Drupal\apigee_m10n_add_credit\AddCreditConfig; use Drupal\commerce_product\Entity\ProductType; -use Drupal\Core\Url; /** * Tests the add credit button on prepaid balance page. @@ -56,9 +56,9 @@ protected function setUp(): void { $this->stack->queueMockResponse(['post-apigeex-billing-type']); $this->developer = $this->signIn([ - 'view own prepaid balance', - 'add credit to own developer prepaid balance' - ], 'prepaid'); + 'view own prepaid balance', + 'add credit to own developer prepaid balance', + ], 'prepaid'); // Enable add credit for the product type. $product_type = ProductType::load('default'); diff --git a/modules/apigee_m10n_add_credit/tests/src/Functional/ApigeeX/GeneralSettingsConfigFormTest.php b/modules/apigee_m10n_add_credit/tests/src/Functional/ApigeeX/GeneralSettingsConfigFormTest.php index 071d5011..3868d850 100644 --- a/modules/apigee_m10n_add_credit/tests/src/Functional/ApigeeX/GeneralSettingsConfigFormTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/Functional/ApigeeX/GeneralSettingsConfigFormTest.php @@ -19,8 +19,8 @@ namespace Drupal\Tests\apigee_m10n_add_credit\Functional\ApigeeX; -use Drupal\apigee_m10n_add_credit\Form\GeneralSettingsConfigForm; use Drupal\Core\Url; +use Drupal\apigee_m10n_add_credit\Form\GeneralSettingsConfigForm; /** * Tests the general settings config form. diff --git a/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/AddCreditCustomAmountTest.php b/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/AddCreditCustomAmountTest.php index f7e2af66..79542478 100644 --- a/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/AddCreditCustomAmountTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/AddCreditCustomAmountTest.php @@ -25,7 +25,7 @@ /** * Tests custom amount for an apigee add credit product. * - * TODO: These tests take a lof of time to run with the dataProviders. Figure out + * @todo These tests take a lof of time to run with the dataProviders. Figure out * a way to make this more efficient. * * @group apigee_m10n @@ -106,7 +106,7 @@ public function testPriceRangeField() { * * @dataProvider providerPriceRange */ - public function testPriceRangeFieldValidation(string $minimum = NULL, string $maximum = NULL, string $default = NULL, string $message = NULL) { + public function testPriceRangeFieldValidation(?string $minimum = NULL, ?string $maximum = NULL, ?string $default = NULL, ?string $message = NULL) { $this->setupApigeeAddCreditProduct(); // Add a product. @@ -144,7 +144,7 @@ public function testPriceRangeFieldValidation(string $minimum = NULL, string $ma * * @dataProvider providerUnitPrice */ - public function testUnitPriceValidation(string $minimum = NULL, string $maximum = NULL, string $default = NULL, string $amount = NULL, string $message = NULL) { + public function testUnitPriceValidation(?string $minimum = NULL, ?string $maximum = NULL, ?string $default = NULL, ?string $amount = NULL, ?string $message = NULL) { $this->setupApigeeAddCreditProduct(); // Add a product. @@ -367,7 +367,7 @@ public function providerUnitPrice() { */ public function providerPriceField() { return [ - // TODO: Commerce throws an error when a string is entered for price. + // @todo Commerce throws an error when a string is entered for price. [ '10.00', 'The product @title has been successfully saved.', diff --git a/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/AddCreditPrepaidBalanceButtonTest.php b/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/AddCreditPrepaidBalanceButtonTest.php index fe7c70d2..69ed6323 100644 --- a/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/AddCreditPrepaidBalanceButtonTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/AddCreditPrepaidBalanceButtonTest.php @@ -19,9 +19,9 @@ namespace Drupal\Tests\apigee_m10n_add_credit\FunctionalJavascript; +use Drupal\Core\Url; use Drupal\apigee_m10n_add_credit\AddCreditConfig; use Drupal\commerce_product\Entity\ProductType; -use Drupal\Core\Url; /** * Tests the add credit button on the prepaid balance page. diff --git a/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/AddCreditPrepaidBalanceToAnyDeveloperTest.php b/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/AddCreditPrepaidBalanceToAnyDeveloperTest.php index 658cf5ee..db8f4b60 100644 --- a/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/AddCreditPrepaidBalanceToAnyDeveloperTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/AddCreditPrepaidBalanceToAnyDeveloperTest.php @@ -19,9 +19,9 @@ namespace Drupal\Tests\apigee_m10n_add_credit\FunctionalJavascript; +use Drupal\Core\Url; use Drupal\apigee_m10n_add_credit\AddCreditConfig; use Drupal\commerce_product\Entity\ProductType; -use Drupal\Core\Url; /** * Tests the add credit button on the prepaid balance page. diff --git a/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/ApigeeX/AddCreditCustomAmountTest.php b/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/ApigeeX/AddCreditCustomAmountTest.php index 39f99739..8ae27b13 100755 --- a/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/ApigeeX/AddCreditCustomAmountTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/ApigeeX/AddCreditCustomAmountTest.php @@ -26,7 +26,7 @@ /** * Tests custom amount for an apigee add credit product. * - * TODO: These tests take a lof of time to run with the dataProviders. Figure out + * @todo These tests take a lof of time to run with the dataProviders. Figure out * a way to make this more efficient. * * @group apigee_m10n @@ -112,7 +112,7 @@ public function testPriceRangeField() { * * @dataProvider providerPriceRange */ - public function testPriceRangeFieldValidation(string $minimum = NULL, string $maximum = NULL, string $default = NULL, string $message = NULL) { + public function testPriceRangeFieldValidation(?string $minimum = NULL, ?string $maximum = NULL, ?string $default = NULL, ?string $message = NULL) { $this->setupApigeeAddCreditProduct(); // Add a product. @@ -150,7 +150,7 @@ public function testPriceRangeFieldValidation(string $minimum = NULL, string $ma * * @dataProvider providerUnitPrice */ - public function testUnitPriceValidation(string $minimum = NULL, string $maximum = NULL, string $default = NULL, string $amount = NULL, string $message = NULL) { + public function testUnitPriceValidation(?string $minimum = NULL, ?string $maximum = NULL, ?string $default = NULL, ?string $amount = NULL, ?string $message = NULL) { $this->setupApigeeAddCreditProduct(); // Add a product. @@ -357,7 +357,7 @@ public function providerUnitPrice() { */ public function providerPriceField() { return [ - // TODO: Commerce throws an error when a string is entered for price. + // @todo Commerce throws an error when a string is entered for price. [ '10.00', 'The product @title has been successfully saved.', diff --git a/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/ApigeeX/AddCreditPrepaidBalanceButtonTest.php b/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/ApigeeX/AddCreditPrepaidBalanceButtonTest.php index 3e609f32..f2f0a86e 100755 --- a/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/ApigeeX/AddCreditPrepaidBalanceButtonTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/ApigeeX/AddCreditPrepaidBalanceButtonTest.php @@ -19,9 +19,9 @@ namespace Drupal\Tests\apigee_m10n_add_credit\FunctionalJavascript\ApigeeX; +use Drupal\Core\Url; use Drupal\apigee_m10n_add_credit\AddCreditConfig; use Drupal\commerce_product\Entity\ProductType; -use Drupal\Core\Url; /** * Tests the add credit button on the prepaid balance page. @@ -94,7 +94,7 @@ public function testAddCreditButton() { $this->queueApigeexDeveloperResponse($this->developer); $this->stack->queueMockResponse([ - 'get-apigeex-prepaid-balances' + 'get-apigeex-prepaid-balances', ]); $this->drupalGet(Url::fromRoute('apigee_monetization.xbilling', [ diff --git a/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/ApigeeX/AddCreditPrepaidBalanceToAnyDeveloperTest.php b/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/ApigeeX/AddCreditPrepaidBalanceToAnyDeveloperTest.php index 4cf8a12d..831f1dd9 100755 --- a/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/ApigeeX/AddCreditPrepaidBalanceToAnyDeveloperTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/ApigeeX/AddCreditPrepaidBalanceToAnyDeveloperTest.php @@ -19,9 +19,9 @@ namespace Drupal\Tests\apigee_m10n_add_credit\FunctionalJavascript\ApigeeX; +use Drupal\Core\Url; use Drupal\apigee_m10n_add_credit\AddCreditConfig; use Drupal\commerce_product\Entity\ProductType; -use Drupal\Core\Url; /** * Tests the add credit button on the prepaid balance page. diff --git a/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/ApigeeX/SetBillingType.php b/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/ApigeeX/SetBillingType.php index c4a6eb19..0d5b5fb6 100644 --- a/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/ApigeeX/SetBillingType.php +++ b/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/ApigeeX/SetBillingType.php @@ -55,18 +55,18 @@ public function testUpdateBillingType() { // Create and sign in a user with view own billing details permissions // and billing type as Prepaid. $this->stack->queueMockResponse([ - 'post-apigeex-billing-type' + 'post-apigeex-billing-type', ]); $this->developer1 = $this->signIn(['view own billing details'], 'Prepaid'); $this->queueApigeexDeveloperResponse($this->developer1); $this->stack->queueMockResponse([ - 'post-apigeex-billing-type' + 'post-apigeex-billing-type', ]); $this->queueApigeexDeveloperResponse($this->developer1); $this->stack->queueMockResponse([ - 'get-apigeex-billing-type' + 'get-apigeex-billing-type', ]); $this->drupalGet(Url::fromRoute('apigee_monetization.xprofile', [ @@ -78,7 +78,7 @@ public function testUpdateBillingType() { $this->assertSession()->responseContains('Prepaid'); $this->stack->queueMockResponse([ - 'post-apigeex-billing-type' => ['billingType' => 'Postpaid'] + 'post-apigeex-billing-type' => ['billingType' => 'Postpaid'], ]); // Create and sign in a user with view own billing details permissions @@ -87,12 +87,12 @@ public function testUpdateBillingType() { $this->queueApigeexDeveloperResponse($this->developer); $this->stack->queueMockResponse([ - 'post-apigeex-billing-type' => ['billingType' => 'Postpaid'] + 'post-apigeex-billing-type' => ['billingType' => 'Postpaid'], ]); $this->queueApigeexDeveloperResponse($this->developer); $this->stack->queueMockResponse([ - 'get-apigeex-billing-type' => ['billingType' => 'Postpaid'] + 'get-apigeex-billing-type' => ['billingType' => 'Postpaid'], ]); $this->drupalGet(Url::fromRoute('apigee_monetization.xprofile', [ diff --git a/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/ApigeeX/UpdateBillingTypeTest.php b/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/ApigeeX/UpdateBillingTypeTest.php index 399aa59a..384b9e3e 100644 --- a/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/ApigeeX/UpdateBillingTypeTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/FunctionalJavascript/ApigeeX/UpdateBillingTypeTest.php @@ -64,7 +64,7 @@ public function testUpdateBillingType() { // Create and sign in a user with no update any billing type permissions. $this->stack->queueMockResponse([ - 'post-apigeex-billing-type' + 'post-apigeex-billing-type', ]); $this->developeruser = $this->signIn([], 'Prepaid'); @@ -76,7 +76,7 @@ public function testUpdateBillingType() { $this->assertSession()->responseContains('Access denied'); $this->stack->queueMockResponse([ - 'get-apigeex-billing-type' + 'get-apigeex-billing-type', ]); // Create and sign in a user with update any billing type permissions. @@ -84,12 +84,12 @@ public function testUpdateBillingType() { $this->queueApigeexDeveloperResponse($this->developeruser); $this->stack->queueMockResponse([ - 'post-apigeex-billing-type' + 'post-apigeex-billing-type', ]); $this->queueApigeexDeveloperResponse($this->developeruser); $this->stack->queueMockResponse([ - 'get-apigeex-billing-type' + 'get-apigeex-billing-type', ]); $this->drupalGet(Url::fromRoute('apigee_m10n_add_credit.userbillingtype', [ @@ -129,7 +129,7 @@ public function testUpdateBillingType() { // Test form config. $this->submitForm([ - 'billingtype' => 'postpaid' + 'billingtype' => 'postpaid', ], 'Save changes'); $this->queueApigeexDeveloperResponse($this->developeruser); diff --git a/modules/apigee_m10n_add_credit/tests/src/Kernel/AddCreditConfigStatusKernelTest.php b/modules/apigee_m10n_add_credit/tests/src/Kernel/AddCreditConfigStatusKernelTest.php index 8e652767..9b15bd82 100644 --- a/modules/apigee_m10n_add_credit/tests/src/Kernel/AddCreditConfigStatusKernelTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/Kernel/AddCreditConfigStatusKernelTest.php @@ -20,10 +20,10 @@ namespace Drupal\Tests\apigee_m10n_add_credit\Kernel; use Apigee\Edge\Api\Monetization\Entity\SupportedCurrency; +use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; use Drupal\apigee_m10n_add_credit\AddCreditConfig; use Drupal\commerce_product\Entity\Product; use Drupal\commerce_store\StoreCreationTrait; -use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; /** * Tests the status page for add credit. @@ -94,7 +94,7 @@ protected function setUp(): void { public function testStatusReport() { $this->warmOrganizationCache(); - // TODO: Figure out why this line is needed otherwise monetization fails. + // @todo Figure out why this line is needed otherwise monetization fails. \Drupal::service('apigee_m10n.monetization')->isMonetizationEnabled(); $requirements = $this->checkAddCreditRequirements(); diff --git a/modules/apigee_m10n_add_credit/tests/src/Kernel/ApigeeX/AddCreditConfigStatusKernelTest.php b/modules/apigee_m10n_add_credit/tests/src/Kernel/ApigeeX/AddCreditConfigStatusKernelTest.php index d6e1aaa0..af406dfb 100644 --- a/modules/apigee_m10n_add_credit/tests/src/Kernel/ApigeeX/AddCreditConfigStatusKernelTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/Kernel/ApigeeX/AddCreditConfigStatusKernelTest.php @@ -19,11 +19,10 @@ namespace Drupal\Tests\apigee_m10n_add_credit\Kernel\ApigeeX; -use Apigee\Edge\Api\Monetization\Entity\SupportedCurrency; +use Drupal\Tests\apigee_m10n\Kernel\ApigeeX\MonetizationKernelTestBase; use Drupal\apigee_m10n_add_credit\AddCreditConfig; use Drupal\commerce_product\Entity\Product; use Drupal\commerce_store\StoreCreationTrait; -use Drupal\Tests\apigee_m10n\Kernel\ApigeeX\MonetizationKernelTestBase; /** * Tests the status page for add credit. diff --git a/modules/apigee_m10n_add_credit/tests/src/Kernel/BalanceAdjustmentJobKernelTest.php b/modules/apigee_m10n_add_credit/tests/src/Kernel/BalanceAdjustmentJobKernelTest.php index 62f55f01..cb9b9690 100644 --- a/modules/apigee_m10n_add_credit/tests/src/Kernel/BalanceAdjustmentJobKernelTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/Kernel/BalanceAdjustmentJobKernelTest.php @@ -20,13 +20,13 @@ namespace Drupal\Tests\apigee_m10n_add_credit\Kernel; use Apigee\Edge\Api\Monetization\Entity\Developer; +use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; use Drupal\apigee_edge\Job\Job; use Drupal\apigee_edge\Job\JobCreatorTrait; use Drupal\apigee_m10n_add_credit\AddCreditConfig; use Drupal\apigee_m10n_add_credit\Job\BalanceAdjustmentJob; use Drupal\commerce_order\Adjustment; use Drupal\commerce_price\Price; -use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; use GuzzleHttp\Psr7\Response; /** diff --git a/modules/apigee_m10n_add_credit/tests/src/Kernel/Plugin/AddCreditEntityTypeManagerTest.php b/modules/apigee_m10n_add_credit/tests/src/Kernel/Plugin/AddCreditEntityTypeManagerTest.php index 70835a3f..9d8e2f3f 100644 --- a/modules/apigee_m10n_add_credit/tests/src/Kernel/Plugin/AddCreditEntityTypeManagerTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/Kernel/Plugin/AddCreditEntityTypeManagerTest.php @@ -19,8 +19,8 @@ namespace Drupal\Tests\apigee_m10n_add_credit\Kernel\Plugin; -use Drupal\apigee_m10n_add_credit\Plugin\AddCreditEntityTypeInterface; use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; +use Drupal\apigee_m10n_add_credit\Plugin\AddCreditEntityTypeInterface; /** * Tests the AddCreditEntityTypeManager plugin. @@ -118,7 +118,7 @@ public function testAddCreditDeveloperPlugin() { 'get-developers' => [ 'developers' => [$this->currentUser], 'org_name' => $this->sdk_connector->getOrganization(), - ] + ], ]); $this->assertCount(1, $this->manager->getEntities($this->currentUser)['developer']); } diff --git a/modules/apigee_m10n_add_credit/tests/src/Kernel/Plugin/EntityReferenceSelection/AddCreditProductsSelectionTest.php b/modules/apigee_m10n_add_credit/tests/src/Kernel/Plugin/EntityReferenceSelection/AddCreditProductsSelectionTest.php index 7cbcd49c..e3d6aff2 100644 --- a/modules/apigee_m10n_add_credit/tests/src/Kernel/Plugin/EntityReferenceSelection/AddCreditProductsSelectionTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/Kernel/Plugin/EntityReferenceSelection/AddCreditProductsSelectionTest.php @@ -19,10 +19,10 @@ namespace Drupal\Tests\apigee_m10n_add_credit\Kernel\Plugin\EntityReferenceSelection; +use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; use Drupal\apigee_m10n_add_credit\AddCreditConfig; use Drupal\apigee_m10n_add_credit\Plugin\EntityReferenceSelection\AddCreditProductsSelection; use Drupal\commerce_product\Entity\Product; -use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; /** * Tests the AddCreditProductsSelection plugin. diff --git a/modules/apigee_m10n_add_credit/tests/src/Traits/AddCreditFunctionalTestTrait.php b/modules/apigee_m10n_add_credit/tests/src/Traits/AddCreditFunctionalTestTrait.php index 5bff2f01..36e5f6a8 100644 --- a/modules/apigee_m10n_add_credit/tests/src/Traits/AddCreditFunctionalTestTrait.php +++ b/modules/apigee_m10n_add_credit/tests/src/Traits/AddCreditFunctionalTestTrait.php @@ -80,7 +80,7 @@ protected function signInAsAdmin(): UserInterface { * * @throws \Drupal\Core\Entity\EntityStorageException */ - protected function createCommerceStore(string $mail = NULL): StoreInterface { + protected function createCommerceStore(?string $mail = NULL): StoreInterface { $store = $this->createStore(NULL, $mail ?? $this->config('system.site') ->get('mail')); $store->save(); @@ -102,7 +102,7 @@ protected function createCommerceStore(string $mail = NULL): StoreInterface { * * @throws \Drupal\Core\Entity\EntityStorageException */ - protected function createCommerceProduct(StoreInterface $store, ProductVariationInterface $variation, string $title = NULL): ProductInterface { + protected function createCommerceProduct(StoreInterface $store, ProductVariationInterface $variation, ?string $title = NULL): ProductInterface { $product = Product::create([ 'title' => $title ?? $this->randomMachineName(), 'type' => 'default', @@ -131,7 +131,7 @@ protected function createCommerceProduct(StoreInterface $store, ProductVariation * * @throws \Drupal\Core\Entity\EntityStorageException */ - protected function createCommerceProductVariation(string $title = NULL, string $sku = NULL, Price $price = NULL): ProductVariationInterface { + protected function createCommerceProductVariation(?string $title = NULL, ?string $sku = NULL, ?Price $price = NULL): ProductVariationInterface { $variation = ProductVariation::create([ 'type' => 'default', 'sku' => $sku ?? $this->randomMachineName(), @@ -160,7 +160,7 @@ protected function createCommerceProductVariation(string $title = NULL, string $ * * @throws \Drupal\Core\Entity\EntityStorageException */ - protected function createCommercePaymentGateway(string $id = NULL, string $label = NULL, array $configuration = NULL): PaymentGatewayInterface { + protected function createCommercePaymentGateway(?string $id = NULL, ?string $label = NULL, ?array $configuration = NULL): PaymentGatewayInterface { $gateway = PaymentGateway::create([ 'id' => $id ?? 'onsite', 'label' => $label ?? 'On-site', @@ -194,7 +194,7 @@ protected function setAddCreditProductForCurrencyId(ProductInterface $product, s /** * Helper to mock responses. * - * TODO: Move this to \Drupal\Tests\apigee_m10n\Functional\MonetizationFunctionalTestBase. + * @todo Move this to \Drupal\Tests\apigee_m10n\Functional\MonetizationFunctionalTestBase. * * @param array $response_ids * An array of response ids. @@ -215,7 +215,7 @@ protected function queueMockResponses(array $response_ids) { /** * Returns an array of mock responses. * - * TODO: Move this to \Drupal\Tests\apigee_m10n\Functional\MonetizationFunctionalTestBase. + * @todo Move this to \Drupal\Tests\apigee_m10n\Functional\MonetizationFunctionalTestBase. * * @return array * An array of mock responses. diff --git a/modules/apigee_m10n_add_credit/tests/src/Traits/ApigeeX/AddCreditFunctionalTestTrait.php b/modules/apigee_m10n_add_credit/tests/src/Traits/ApigeeX/AddCreditFunctionalTestTrait.php index 907d1c8f..fe230b2e 100644 --- a/modules/apigee_m10n_add_credit/tests/src/Traits/ApigeeX/AddCreditFunctionalTestTrait.php +++ b/modules/apigee_m10n_add_credit/tests/src/Traits/ApigeeX/AddCreditFunctionalTestTrait.php @@ -19,7 +19,6 @@ namespace Drupal\Tests\apigee_m10n_add_credit\Traits\ApigeeX; -use Apigee\Edge\Api\Monetization\Entity\SupportedCurrency; use Drupal\apigee_m10n_add_credit\AddCreditConfig; use Drupal\apigee_m10n_add_credit\Form\GeneralSettingsConfigForm; use Drupal\commerce_payment\Entity\PaymentGateway; @@ -89,7 +88,7 @@ protected function signInAsAdmin($billingType = 'postpaid'): UserInterface { * * @throws \Drupal\Core\Entity\EntityStorageException */ - protected function createCommerceStore(string $mail = NULL): StoreInterface { + protected function createCommerceStore(?string $mail = NULL): StoreInterface { $store = $this->createStore(NULL, $mail ?? $this->config('system.site') ->get('mail')); $store->save(); @@ -111,7 +110,7 @@ protected function createCommerceStore(string $mail = NULL): StoreInterface { * * @throws \Drupal\Core\Entity\EntityStorageException */ - protected function createCommerceProduct(StoreInterface $store, ProductVariationInterface $variation, string $title = NULL): ProductInterface { + protected function createCommerceProduct(StoreInterface $store, ProductVariationInterface $variation, ?string $title = NULL): ProductInterface { $product = Product::create([ 'title' => $title ?? $this->randomMachineName(), 'type' => 'default', @@ -140,7 +139,7 @@ protected function createCommerceProduct(StoreInterface $store, ProductVariation * * @throws \Drupal\Core\Entity\EntityStorageException */ - protected function createCommerceProductVariation(string $title = NULL, string $sku = NULL, Price $price = NULL): ProductVariationInterface { + protected function createCommerceProductVariation(?string $title = NULL, ?string $sku = NULL, ?Price $price = NULL): ProductVariationInterface { $variation = ProductVariation::create([ 'type' => 'default', 'sku' => $sku ?? $this->randomMachineName(), @@ -169,7 +168,7 @@ protected function createCommerceProductVariation(string $title = NULL, string $ * * @throws \Drupal\Core\Entity\EntityStorageException */ - protected function createCommercePaymentGateway(string $id = NULL, string $label = NULL, array $configuration = NULL): PaymentGatewayInterface { + protected function createCommercePaymentGateway(?string $id = NULL, ?string $label = NULL, ?array $configuration = NULL): PaymentGatewayInterface { $gateway = PaymentGateway::create([ 'id' => $id ?? 'onsite', 'label' => $label ?? 'On-site', @@ -205,7 +204,7 @@ protected function setAddCreditProductForCurrencyId(ProductInterface $product, s /** * Helper to mock responses. * - * TODO: Move this to \Drupal\Tests\apigee_m10n\Functional\MonetizationFunctionalTestBase. + * @todo Move this to \Drupal\Tests\apigee_m10n\Functional\MonetizationFunctionalTestBase. * * @param array $response_ids * An array of response ids. @@ -226,7 +225,7 @@ protected function queueMockResponses(array $response_ids) { /** * Returns an array of mock responses. * - * TODO: Move this to \Drupal\Tests\apigee_m10n\Functional\MonetizationFunctionalTestBase. + * @todo Move this to \Drupal\Tests\apigee_m10n\Functional\MonetizationFunctionalTestBase. * * @return array * An array of mock responses. @@ -234,7 +233,7 @@ protected function queueMockResponses(array $response_ids) { public function getMockResponses() { return [ 'get-apigeex-prepaid-balances', - 'get-supported-currencies' + 'get-supported-currencies', ]; } diff --git a/modules/apigee_m10n_add_credit/tests/src/Unit/Plugin/Validation/Constraint/PriceRangeDefaultOutOfRangeConstraintValidatorTest.php b/modules/apigee_m10n_add_credit/tests/src/Unit/Plugin/Validation/Constraint/PriceRangeDefaultOutOfRangeConstraintValidatorTest.php index 39e8a165..39ff992b 100644 --- a/modules/apigee_m10n_add_credit/tests/src/Unit/Plugin/Validation/Constraint/PriceRangeDefaultOutOfRangeConstraintValidatorTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/Unit/Plugin/Validation/Constraint/PriceRangeDefaultOutOfRangeConstraintValidatorTest.php @@ -20,12 +20,11 @@ namespace Drupal\Tests\apigee_m10n_add_credit\Unit\Plugin\Validation\Constraint; use CommerceGuys\Intl\Formatter\CurrencyFormatterInterface; -use Drupal\apigee_m10n_add_credit\Element\PriceRange; +use Drupal\Tests\UnitTestCase; use Drupal\apigee_m10n_add_credit\Plugin\Field\FieldType\PriceRangeItem; use Drupal\apigee_m10n_add_credit\Plugin\Validation\Constraint\PriceRangeDefaultOutOfRangeConstraint; use Drupal\apigee_m10n_add_credit\Plugin\Validation\Constraint\PriceRangeDefaultOutOfRangeConstraintValidator; use Drupal\commerce_price\CurrencyFormatter; -use Drupal\Tests\UnitTestCase; use Symfony\Component\Validator\Context\ExecutionContextInterface; /** diff --git a/modules/apigee_m10n_add_credit/tests/src/Unit/Plugin/Validation/Constraint/PriceRangeMinimumGreaterMaximumConstraintValidatorTest.php b/modules/apigee_m10n_add_credit/tests/src/Unit/Plugin/Validation/Constraint/PriceRangeMinimumGreaterMaximumConstraintValidatorTest.php index 82884f65..95cf2538 100644 --- a/modules/apigee_m10n_add_credit/tests/src/Unit/Plugin/Validation/Constraint/PriceRangeMinimumGreaterMaximumConstraintValidatorTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/Unit/Plugin/Validation/Constraint/PriceRangeMinimumGreaterMaximumConstraintValidatorTest.php @@ -19,10 +19,10 @@ namespace Drupal\Tests\apigee_m10n_add_credit\Unit\Plugin\Validation\Constraint; +use Drupal\Tests\UnitTestCase; use Drupal\apigee_m10n_add_credit\Plugin\Field\FieldType\PriceRangeItem; use Drupal\apigee_m10n_add_credit\Plugin\Validation\Constraint\PriceRangeMinimumGreaterMaximumConstraint; use Drupal\apigee_m10n_add_credit\Plugin\Validation\Constraint\PriceRangeMinimumGreaterMaximumConstraintValidator; -use Drupal\Tests\UnitTestCase; use Symfony\Component\Validator\Context\ExecutionContextInterface; /** diff --git a/modules/apigee_m10n_add_credit/tests/src/Unit/Plugin/Validation/Constraint/PriceRangeMinimumTopUpAmountConstraintValidatorTest.php b/modules/apigee_m10n_add_credit/tests/src/Unit/Plugin/Validation/Constraint/PriceRangeMinimumTopUpAmountConstraintValidatorTest.php index b8f11325..2dc0bacb 100644 --- a/modules/apigee_m10n_add_credit/tests/src/Unit/Plugin/Validation/Constraint/PriceRangeMinimumTopUpAmountConstraintValidatorTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/Unit/Plugin/Validation/Constraint/PriceRangeMinimumTopUpAmountConstraintValidatorTest.php @@ -21,13 +21,13 @@ use Apigee\Edge\Api\Monetization\Entity\SupportedCurrency; use CommerceGuys\Intl\Formatter\CurrencyFormatterInterface; +use Drupal\Tests\UnitTestCase; use Drupal\apigee_m10n\Monetization; use Drupal\apigee_m10n\MonetizationInterface; use Drupal\apigee_m10n_add_credit\Plugin\Field\FieldType\PriceRangeItem; use Drupal\apigee_m10n_add_credit\Plugin\Validation\Constraint\PriceRangeMinimumTopUpAmountConstraint; use Drupal\apigee_m10n_add_credit\Plugin\Validation\Constraint\PriceRangeMinimumTopUpAmountConstraintValidator; use Drupal\commerce_price\CurrencyFormatter; -use Drupal\Tests\UnitTestCase; use Symfony\Component\Validator\Context\ExecutionContextInterface; /** diff --git a/modules/apigee_m10n_add_credit/tests/src/Unit/Plugin/Validation/Constraint/PriceRangeUnitPriceConstraintValidatorTest.php b/modules/apigee_m10n_add_credit/tests/src/Unit/Plugin/Validation/Constraint/PriceRangeUnitPriceConstraintValidatorTest.php index 19a5c4c2..36c1cf04 100644 --- a/modules/apigee_m10n_add_credit/tests/src/Unit/Plugin/Validation/Constraint/PriceRangeUnitPriceConstraintValidatorTest.php +++ b/modules/apigee_m10n_add_credit/tests/src/Unit/Plugin/Validation/Constraint/PriceRangeUnitPriceConstraintValidatorTest.php @@ -20,6 +20,7 @@ namespace Drupal\Tests\apigee_m10n_add_credit\Unit\Plugin\Validation\Constraint; use CommerceGuys\Intl\Formatter\CurrencyFormatterInterface; +use Drupal\Core\Field\FieldItemListInterface; use Drupal\apigee_m10n_add_credit\Plugin\Validation\Constraint\PriceRangeDefaultOutOfRangeConstraint; use Drupal\apigee_m10n_add_credit\Plugin\Validation\Constraint\PriceRangeUnitPriceConstraint; use Drupal\apigee_m10n_add_credit\Plugin\Validation\Constraint\PriceRangeUnitPriceConstraintValidator; @@ -27,7 +28,6 @@ use Drupal\commerce_price\CurrencyFormatter; use Drupal\commerce_price\Plugin\Field\FieldType\PriceItem; use Drupal\commerce_product\Entity\ProductVariation; -use Drupal\Core\Field\FieldItemListInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface; /** diff --git a/modules/apigee_m10n_teams/src/Access/TeamPermissionAccessCheck.php b/modules/apigee_m10n_teams/src/Access/TeamPermissionAccessCheck.php index 82b14fdb..43b021a0 100644 --- a/modules/apigee_m10n_teams/src/Access/TeamPermissionAccessCheck.php +++ b/modules/apigee_m10n_teams/src/Access/TeamPermissionAccessCheck.php @@ -19,11 +19,11 @@ namespace Drupal\apigee_m10n_teams\Access; -use Drupal\apigee_edge_teams\Entity\TeamInterface; -use Drupal\apigee_edge_teams\TeamPermissionHandlerInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Access\AccessResultReasonInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\apigee_edge_teams\Entity\TeamInterface; +use Drupal\apigee_edge_teams\TeamPermissionHandlerInterface; use Symfony\Component\Routing\Route; /** @@ -108,7 +108,7 @@ public function allowedIfHasTeamPermissions(TeamInterface $team, AccountInterfac } } - // TODO: Add a `team.permissions` cache context. + // @todo Add a `team.permissions` cache context. // See: `\Drupal\Core\Cache\Context\AccountPermissionsCacheContext`. $access_result = AccessResult::allowedIf($access) ->addCacheableDependency($team) diff --git a/modules/apigee_m10n_teams/src/Access/TeamPermissionAccessInterface.php b/modules/apigee_m10n_teams/src/Access/TeamPermissionAccessInterface.php index 3348d8d7..b9cf3015 100644 --- a/modules/apigee_m10n_teams/src/Access/TeamPermissionAccessInterface.php +++ b/modules/apigee_m10n_teams/src/Access/TeamPermissionAccessInterface.php @@ -19,9 +19,9 @@ namespace Drupal\apigee_m10n_teams\Access; -use Drupal\apigee_edge_teams\Entity\TeamInterface; use Drupal\Core\Routing\Access\AccessInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\apigee_edge_teams\Entity\TeamInterface; use Symfony\Component\Routing\Route; /** diff --git a/modules/apigee_m10n_teams/src/ApigeeM10nTeamsServiceProvider.php b/modules/apigee_m10n_teams/src/ApigeeM10nTeamsServiceProvider.php index 0e84babd..d2f2d7de 100644 --- a/modules/apigee_m10n_teams/src/ApigeeM10nTeamsServiceProvider.php +++ b/modules/apigee_m10n_teams/src/ApigeeM10nTeamsServiceProvider.php @@ -2,10 +2,10 @@ namespace Drupal\apigee_m10n_teams; -use Drupal\apigee_m10n_teams\Entity\ParamConverter\TeamPurchasedPlanConverter; -use Drupal\apigee_m10n_teams\Entity\Storage\Controller\TeamAcceptedRatePlanSdkControllerProxy; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\DependencyInjection\ServiceModifierInterface; +use Drupal\apigee_m10n_teams\Entity\ParamConverter\TeamPurchasedPlanConverter; +use Drupal\apigee_m10n_teams\Entity\Storage\Controller\TeamAcceptedRatePlanSdkControllerProxy; /** * Responsible for overriding `apigee_m10n` services. diff --git a/modules/apigee_m10n_teams/src/Cache/TeamCacheContext.php b/modules/apigee_m10n_teams/src/Cache/TeamCacheContext.php index 71e1b355..e0576cdd 100644 --- a/modules/apigee_m10n_teams/src/Cache/TeamCacheContext.php +++ b/modules/apigee_m10n_teams/src/Cache/TeamCacheContext.php @@ -19,10 +19,10 @@ namespace Drupal\apigee_m10n_teams\Cache; -use Drupal\apigee_edge_teams\Entity\TeamInterface; use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Cache\Context\CacheContextInterface; use Drupal\Core\Cache\Context\RequestStackCacheContextBase; +use Drupal\apigee_edge_teams\Entity\TeamInterface; /** * Defines the TeamCacheContext service, for "per URL team" caching. diff --git a/modules/apigee_m10n_teams/src/Controller/TeamPrepaidBalanceController.php b/modules/apigee_m10n_teams/src/Controller/TeamPrepaidBalanceController.php index 607285e9..7cf71d98 100644 --- a/modules/apigee_m10n_teams/src/Controller/TeamPrepaidBalanceController.php +++ b/modules/apigee_m10n_teams/src/Controller/TeamPrepaidBalanceController.php @@ -19,6 +19,9 @@ namespace Drupal\apigee_m10n_teams\Controller; +use Drupal\Core\Extension\ModuleHandlerInterface; +use Drupal\Core\Form\FormBuilderInterface; +use Drupal\Core\Session\AccountInterface; use Drupal\apigee_edge\SDKConnectorInterface; use Drupal\apigee_edge_teams\Entity\TeamInterface; use Drupal\apigee_m10n\Controller\PrepaidBalanceControllerBase; @@ -26,10 +29,6 @@ use Drupal\apigee_m10n_teams\Access\TeamPermissionAccessInterface; use Drupal\apigee_m10n_teams\Form\TeamPrepaidBalanceReportsDownloadForm; use Drupal\apigee_m10n_teams\TeamSdkControllerFactoryAwareTrait; -use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Form\FormBuilderInterface; -use Drupal\Core\Session\AccountInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/modules/apigee_m10n_teams/src/Controller/TeamPricingAndPlansController.php b/modules/apigee_m10n_teams/src/Controller/TeamPricingAndPlansController.php index 44eae328..fe08df5c 100644 --- a/modules/apigee_m10n_teams/src/Controller/TeamPricingAndPlansController.php +++ b/modules/apigee_m10n_teams/src/Controller/TeamPricingAndPlansController.php @@ -19,10 +19,10 @@ namespace Drupal\apigee_m10n_teams\Controller; +use Drupal\Core\Access\AccessResult; use Drupal\apigee_edge_teams\Entity\TeamInterface; use Drupal\apigee_m10n\Controller\PricingAndPlansController; use Drupal\apigee_m10n_teams\Entity\TeamProductBundle; -use Drupal\Core\Access\AccessResult; /** * Generates the pricing and plans page. diff --git a/modules/apigee_m10n_teams/src/Entity/Access/TeamRatePlanAccessControlHandler.php b/modules/apigee_m10n_teams/src/Entity/Access/TeamRatePlanAccessControlHandler.php index fe67b478..16e7ab9e 100644 --- a/modules/apigee_m10n_teams/src/Entity/Access/TeamRatePlanAccessControlHandler.php +++ b/modules/apigee_m10n_teams/src/Entity/Access/TeamRatePlanAccessControlHandler.php @@ -23,15 +23,15 @@ use Apigee\Edge\Api\Monetization\Entity\CompanyRatePlanInterface; use Apigee\Edge\Api\Monetization\Entity\DeveloperCategoryRatePlanInterface; use Apigee\Edge\Api\Monetization\Entity\StandardRatePlanInterface; -use Drupal\apigee_edge_teams\Entity\Team; -use Drupal\apigee_m10n\Entity\Access\RatePlanAccessControlHandler; -use Drupal\apigee_m10n_teams\Access\TeamPermissionAccessInterface; -use Drupal\apigee_m10n_teams\MonetizationTeamsInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\apigee_edge_teams\Entity\Team; +use Drupal\apigee_m10n\Entity\Access\RatePlanAccessControlHandler; +use Drupal\apigee_m10n_teams\Access\TeamPermissionAccessInterface; +use Drupal\apigee_m10n_teams\MonetizationTeamsInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/modules/apigee_m10n_teams/src/Entity/Access/TeamRatePlanSubscriptionAccessHandler.php b/modules/apigee_m10n_teams/src/Entity/Access/TeamRatePlanSubscriptionAccessHandler.php index 95ec6856..2211e7e6 100644 --- a/modules/apigee_m10n_teams/src/Entity/Access/TeamRatePlanSubscriptionAccessHandler.php +++ b/modules/apigee_m10n_teams/src/Entity/Access/TeamRatePlanSubscriptionAccessHandler.php @@ -23,11 +23,11 @@ use Apigee\Edge\Api\Monetization\Entity\CompanyRatePlanInterface; use Apigee\Edge\Api\Monetization\Entity\DeveloperCategoryRatePlanInterface; use Apigee\Edge\Api\Monetization\Entity\DeveloperRatePlanInterface; +use Drupal\Core\Access\AccessResult; +use Drupal\Core\Access\AccessResultInterface; use Drupal\apigee_edge_teams\Entity\TeamInterface; use Drupal\apigee_m10n\Entity\Access\RatePlanSubscriptionAccessHandler; use Drupal\apigee_m10n\Entity\RatePlanInterface; -use Drupal\Core\Access\AccessResult; -use Drupal\Core\Access\AccessResultInterface; /** * Access check for subscribing an account to a rate plan, checking teams. diff --git a/modules/apigee_m10n_teams/src/Entity/Controller/TeamPurchaseRatePlanController.php b/modules/apigee_m10n_teams/src/Entity/Controller/TeamPurchaseRatePlanController.php index e0361d2e..bf7346c6 100644 --- a/modules/apigee_m10n_teams/src/Entity/Controller/TeamPurchaseRatePlanController.php +++ b/modules/apigee_m10n_teams/src/Entity/Controller/TeamPurchaseRatePlanController.php @@ -20,11 +20,11 @@ namespace Drupal\apigee_m10n_teams\Entity\Controller; use Apigee\Edge\Api\Monetization\Entity\Company; +use Drupal\Core\Routing\RouteMatchInterface; use Drupal\apigee_edge_teams\Entity\TeamInterface; use Drupal\apigee_m10n\Entity\Controller\PurchaseRatePlanController; use Drupal\apigee_m10n\Entity\PurchasedPlan; use Drupal\apigee_m10n\Entity\RatePlanInterface; -use Drupal\Core\Routing\RouteMatchInterface; /** * Controller for subscribing to rate plans. diff --git a/modules/apigee_m10n_teams/src/Entity/Form/TeamPurchasedPlanForm.php b/modules/apigee_m10n_teams/src/Entity/Form/TeamPurchasedPlanForm.php index 15d67f91..239268d9 100644 --- a/modules/apigee_m10n_teams/src/Entity/Form/TeamPurchasedPlanForm.php +++ b/modules/apigee_m10n_teams/src/Entity/Form/TeamPurchasedPlanForm.php @@ -19,12 +19,12 @@ namespace Drupal\apigee_m10n_teams\Entity\Form; +use Drupal\Core\Cache\Cache; +use Drupal\Core\Form\FormStateInterface; use Drupal\apigee_edge\Entity\Form\FieldableEdgeEntityForm; use Drupal\apigee_edge_teams\Entity\Team; use Drupal\apigee_m10n\Entity\Form\PurchasedPlanForm; use Drupal\apigee_m10n_teams\Entity\TeamsPurchasedPlanInterface; -use Drupal\Core\Cache\Cache; -use Drupal\Core\Form\FormStateInterface; /** * Team purchased plan entity form. diff --git a/modules/apigee_m10n_teams/src/Entity/ListBuilder/TeamPurchasedPlanListBuilder.php b/modules/apigee_m10n_teams/src/Entity/ListBuilder/TeamPurchasedPlanListBuilder.php index 60f6754b..480e13f2 100644 --- a/modules/apigee_m10n_teams/src/Entity/ListBuilder/TeamPurchasedPlanListBuilder.php +++ b/modules/apigee_m10n_teams/src/Entity/ListBuilder/TeamPurchasedPlanListBuilder.php @@ -19,11 +19,11 @@ namespace Drupal\apigee_m10n_teams\Entity\ListBuilder; +use Drupal\Core\Url; use Drupal\apigee_edge_teams\Entity\TeamInterface; use Drupal\apigee_m10n\Entity\ListBuilder\PurchasedPlanListBuilder; use Drupal\apigee_m10n\Entity\PurchasedPlanInterface; use Drupal\apigee_m10n_teams\Entity\TeamsPurchasedPlan; -use Drupal\Core\Url; /** * Entity list builder for team purchased plans. @@ -40,7 +40,7 @@ class TeamPurchasedPlanListBuilder extends PurchasedPlanListBuilder { /** * {@inheritdoc} */ - public function render(TeamInterface $team = NULL) { + public function render(?TeamInterface $team = NULL) { // From this point forward `$this->user` is a safe assumption. $this->team = $team; diff --git a/modules/apigee_m10n_teams/src/Entity/Permissions/MonetizationTeamPermissionsProvider.php b/modules/apigee_m10n_teams/src/Entity/Permissions/MonetizationTeamPermissionsProvider.php index a5bb279a..662fa5b0 100644 --- a/modules/apigee_m10n_teams/src/Entity/Permissions/MonetizationTeamPermissionsProvider.php +++ b/modules/apigee_m10n_teams/src/Entity/Permissions/MonetizationTeamPermissionsProvider.php @@ -20,9 +20,9 @@ namespace Drupal\apigee_m10n_teams\Entity\Permissions; +use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\apigee_edge_teams\DynamicTeamPermissionProviderInterface; use Drupal\apigee_edge_teams\Structure\TeamPermission; -use Drupal\Core\StringTranslation\StringTranslationTrait; /** * Provides the default team permissions. diff --git a/modules/apigee_m10n_teams/src/Entity/Routing/MonetizationTeamsEntityRouteProvider.php b/modules/apigee_m10n_teams/src/Entity/Routing/MonetizationTeamsEntityRouteProvider.php index 913247c8..94c99be1 100644 --- a/modules/apigee_m10n_teams/src/Entity/Routing/MonetizationTeamsEntityRouteProvider.php +++ b/modules/apigee_m10n_teams/src/Entity/Routing/MonetizationTeamsEntityRouteProvider.php @@ -19,8 +19,8 @@ namespace Drupal\apigee_m10n_teams\Entity\Routing; -use Drupal\apigee_m10n\Entity\Routing\MonetizationEntityRouteProvider; use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\apigee_m10n\Entity\Routing\MonetizationEntityRouteProvider; use Symfony\Component\Routing\Route; /** diff --git a/modules/apigee_m10n_teams/src/Entity/Storage/TeamProductBundleStorage.php b/modules/apigee_m10n_teams/src/Entity/Storage/TeamProductBundleStorage.php index 089595a4..deea5581 100644 --- a/modules/apigee_m10n_teams/src/Entity/Storage/TeamProductBundleStorage.php +++ b/modules/apigee_m10n_teams/src/Entity/Storage/TeamProductBundleStorage.php @@ -57,7 +57,7 @@ public function getAvailableProductBundlesByTeam($team_id) { $this->invokeStorageLoadHook($entities); $this->setPersistentCache($entities); - // TODO: Consider caching this list in the DB. + // @todo Consider caching this list in the DB. // Set static cache. $this->product_bundles_by_team[$team_id] = array_map(function ($entity) { return $entity->id(); diff --git a/modules/apigee_m10n_teams/src/Entity/Storage/TeamPurchasedPlanStorage.php b/modules/apigee_m10n_teams/src/Entity/Storage/TeamPurchasedPlanStorage.php index 6f99963b..0fa354dc 100644 --- a/modules/apigee_m10n_teams/src/Entity/Storage/TeamPurchasedPlanStorage.php +++ b/modules/apigee_m10n_teams/src/Entity/Storage/TeamPurchasedPlanStorage.php @@ -20,10 +20,10 @@ namespace Drupal\apigee_m10n_teams\Entity\Storage; use Apigee\Edge\Api\Monetization\Entity\CompanyAcceptedRatePlanInterface; +use Drupal\Core\Entity\EntityInterface; use Drupal\apigee_m10n\Entity\Storage\PurchasedPlanStorage; use Drupal\apigee_m10n_teams\Entity\Storage\Controller\TeamAcceptedRatePlanSdkControllerProxyInterface; use Drupal\apigee_m10n_teams\Entity\TeamsPurchasedPlanInterface; -use Drupal\Core\Entity\EntityInterface; /** * Overridden storage controller for the `purchased_plan` entity for teams. diff --git a/modules/apigee_m10n_teams/src/Entity/TeamsPurchasedPlan.php b/modules/apigee_m10n_teams/src/Entity/TeamsPurchasedPlan.php index d6fc52f1..ee563b02 100644 --- a/modules/apigee_m10n_teams/src/Entity/TeamsPurchasedPlan.php +++ b/modules/apigee_m10n_teams/src/Entity/TeamsPurchasedPlan.php @@ -23,11 +23,11 @@ use Apigee\Edge\Api\Monetization\Entity\CompanyAcceptedRatePlanInterface; use Apigee\Edge\Api\Monetization\Entity\DeveloperInterface; use Apigee\Edge\Entity\EntityInterface as EdgeEntityInterface; +use Drupal\Core\Entity\EntityBase; +use Drupal\Core\Entity\EntityTypeInterface; use Drupal\apigee_edge_teams\Entity\TeamInterface; use Drupal\apigee_m10n\Entity\PurchasedPlan; use Drupal\apigee_m10n\Entity\RatePlanInterface; -use Drupal\Core\Entity\EntityBase; -use Drupal\Core\Entity\EntityTypeInterface; /** * Overrides the `purchased_plan` entity class. diff --git a/modules/apigee_m10n_teams/src/Form/BillingDetailsForm.php b/modules/apigee_m10n_teams/src/Form/BillingDetailsForm.php index 95892399..bd375444 100644 --- a/modules/apigee_m10n_teams/src/Form/BillingDetailsForm.php +++ b/modules/apigee_m10n_teams/src/Form/BillingDetailsForm.php @@ -19,13 +19,13 @@ namespace Drupal\apigee_m10n_teams\Form; -use Drupal\apigee_edge_teams\Entity\Team; -use Drupal\apigee_edge_teams\Entity\TeamInterface; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Logger\LoggerChannelFactory; use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Routing\RouteMatchInterface; +use Drupal\apigee_edge_teams\Entity\Team; +use Drupal\apigee_edge_teams\Entity\TeamInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -108,7 +108,7 @@ public function getFormId() { /** * {@inheritdoc} */ - public function buildForm(array $form, FormStateInterface $form_state, TeamInterface $team = NULL) { + public function buildForm(array $form, FormStateInterface $form_state, ?TeamInterface $team = NULL) { $this->team = Team::load($team->id()); $form['company'] = [ diff --git a/modules/apigee_m10n_teams/src/Form/TeamPrepaidBalanceReportsDownloadForm.php b/modules/apigee_m10n_teams/src/Form/TeamPrepaidBalanceReportsDownloadForm.php index 39163ad6..b95fe2b3 100644 --- a/modules/apigee_m10n_teams/src/Form/TeamPrepaidBalanceReportsDownloadForm.php +++ b/modules/apigee_m10n_teams/src/Form/TeamPrepaidBalanceReportsDownloadForm.php @@ -19,8 +19,8 @@ namespace Drupal\apigee_m10n_teams\Form; -use Drupal\apigee_m10n\Form\PrepaidBalanceReportsDownloadForm; use Drupal\Core\Entity\EntityInterface; +use Drupal\apigee_m10n\Form\PrepaidBalanceReportsDownloadForm; /** * Provides a form to to download prepaid balances. diff --git a/modules/apigee_m10n_teams/src/Form/TeamReportsDownloadForm.php b/modules/apigee_m10n_teams/src/Form/TeamReportsDownloadForm.php index 699daae1..e0d3121b 100644 --- a/modules/apigee_m10n_teams/src/Form/TeamReportsDownloadForm.php +++ b/modules/apigee_m10n_teams/src/Form/TeamReportsDownloadForm.php @@ -20,9 +20,9 @@ namespace Drupal\apigee_m10n_teams\Form; +use Drupal\Core\Form\FormStateInterface; use Drupal\apigee_edge_teams\Entity\TeamInterface; use Drupal\apigee_m10n\Form\ReportsDownloadFormBase; -use Drupal\Core\Form\FormStateInterface; /** * Defines the reports download form for team. @@ -32,7 +32,7 @@ class TeamReportsDownloadForm extends ReportsDownloadFormBase { /** * {@inheritdoc} */ - public function buildForm(array $form, FormStateInterface $form_state, TeamInterface $team = NULL) { + public function buildForm(array $form, FormStateInterface $form_state, ?TeamInterface $team = NULL) { return $this->getForm($form, $form_state, $team); } diff --git a/modules/apigee_m10n_teams/src/MonetizationTeams.php b/modules/apigee_m10n_teams/src/MonetizationTeams.php index 270c6f8e..e0999e89 100644 --- a/modules/apigee_m10n_teams/src/MonetizationTeams.php +++ b/modules/apigee_m10n_teams/src/MonetizationTeams.php @@ -22,6 +22,11 @@ namespace Drupal\apigee_m10n_teams; use Apigee\Edge\Api\Monetization\Structure\LegalEntityTermsAndConditionsHistoryItem; +use Drupal\Core\Access\AccessResult; +use Drupal\Core\Access\AccessResultInterface; +use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Routing\RouteMatchInterface; +use Drupal\Core\Session\AccountInterface; use Drupal\apigee_edge\Entity\ApiProductInterface; use Drupal\apigee_edge_teams\Entity\TeamInterface; use Drupal\apigee_m10n\Exception\SdkEntityLoadException; @@ -39,11 +44,6 @@ use Drupal\apigee_m10n_teams\Plugin\Field\FieldFormatter\TeamPurchasePlanFormFormatter; use Drupal\apigee_m10n_teams\Plugin\Field\FieldFormatter\TeamPurchasePlanLinkFormatter; use Drupal\apigee_m10n_teams\Plugin\Field\FieldWidget\CompanyTermsAndConditionsWidget; -use Drupal\Core\Access\AccessResult; -use Drupal\Core\Access\AccessResultInterface; -use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Routing\RouteMatchInterface; -use Drupal\Core\Session\AccountInterface; use Psr\Log\LoggerInterface; /** @@ -221,7 +221,7 @@ public function entityAccess(EntityInterface $entity, $operation, AccountInterfa * {@inheritdoc} */ public function currentTeam(): ?TeamInterface { - // TODO: This call could be much smarter. + // @todo This call could be much smarter. // All team routes have the team as the first parameter and we could be // checking a route list to make sure the team is part of a team route // similar to the `_apigee_monetization_route` route option. @@ -251,7 +251,7 @@ public function isLatestTermsAndConditionAccepted(string $company_id): ?bool { if (!($latest_tnc = $this->monetization->getLatestTermsAndConditions())) { // If there isn't a latest TnC, and there was no error, there shouldn't be // anything to accept. - // TODO: Add a test for an org with no TnC defined. + // @todo Add a test for an org with no TnC defined. return TRUE; } // Check the cache table. diff --git a/modules/apigee_m10n_teams/src/MonetizationTeamsInterface.php b/modules/apigee_m10n_teams/src/MonetizationTeamsInterface.php index 2156fae0..44854f8e 100755 --- a/modules/apigee_m10n_teams/src/MonetizationTeamsInterface.php +++ b/modules/apigee_m10n_teams/src/MonetizationTeamsInterface.php @@ -21,14 +21,13 @@ namespace Drupal\apigee_m10n_teams; -use Apigee\Edge\Api\Monetization\Entity\TermsAndConditionsInterface; use Apigee\Edge\Api\Monetization\Structure\LegalEntityTermsAndConditionsHistoryItem; -use Drupal\apigee_edge\Entity\ApiProductInterface; -use Drupal\apigee_edge_teams\Entity\TeamInterface; -use Drupal\apigee_m10n_teams\Entity\TeamsRatePlan; use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\apigee_edge\Entity\ApiProductInterface; +use Drupal\apigee_edge_teams\Entity\TeamInterface; +use Drupal\apigee_m10n_teams\Entity\TeamsRatePlan; /** * Interface for the `apigee_m10n.teams` service. diff --git a/modules/apigee_m10n_teams/src/Plugin/AddCreditEntityType/Team.php b/modules/apigee_m10n_teams/src/Plugin/AddCreditEntityType/Team.php index d8f98cea..d5f8b87f 100644 --- a/modules/apigee_m10n_teams/src/Plugin/AddCreditEntityType/Team.php +++ b/modules/apigee_m10n_teams/src/Plugin/AddCreditEntityType/Team.php @@ -19,15 +19,14 @@ namespace Drupal\apigee_m10n_teams\Plugin\AddCreditEntityType; -use Drupal\apigee_edge_teams\TeamMembershipManagerInterface; -use Drupal\apigee_m10n_add_credit\Annotation\AddCreditEntityType; -use Drupal\apigee_m10n_add_credit\Plugin\AddCreditEntityTypeBase; use Drupal\Core\Access\AccessResult; use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\apigee_edge_teams\TeamMembershipManagerInterface; +use Drupal\apigee_m10n_add_credit\Plugin\AddCreditEntityTypeBase; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/modules/apigee_m10n_teams/src/Plugin/Field/FieldFormatter/TeamPurchasePlanFormFormatter.php b/modules/apigee_m10n_teams/src/Plugin/Field/FieldFormatter/TeamPurchasePlanFormFormatter.php index af3a9477..84ce5fa3 100644 --- a/modules/apigee_m10n_teams/src/Plugin/Field/FieldFormatter/TeamPurchasePlanFormFormatter.php +++ b/modules/apigee_m10n_teams/src/Plugin/Field/FieldFormatter/TeamPurchasePlanFormFormatter.php @@ -20,10 +20,10 @@ namespace Drupal\apigee_m10n_teams\Plugin\Field\FieldFormatter; use Apigee\Edge\Api\Monetization\Entity\Company; +use Drupal\Core\Field\FieldItemInterface; use Drupal\apigee_edge_teams\Entity\TeamInterface; use Drupal\apigee_m10n\Entity\PurchasedPlan; use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\PurchasePlanFormFormatter; -use Drupal\Core\Field\FieldItemInterface; /** * Override class for the `apigee_purchase_plan_form` field formatter. diff --git a/modules/apigee_m10n_teams/src/Plugin/Field/FieldFormatter/TeamPurchasePlanLinkFormatter.php b/modules/apigee_m10n_teams/src/Plugin/Field/FieldFormatter/TeamPurchasePlanLinkFormatter.php index e3df57f3..21ffdc22 100644 --- a/modules/apigee_m10n_teams/src/Plugin/Field/FieldFormatter/TeamPurchasePlanLinkFormatter.php +++ b/modules/apigee_m10n_teams/src/Plugin/Field/FieldFormatter/TeamPurchasePlanLinkFormatter.php @@ -19,9 +19,9 @@ namespace Drupal\apigee_m10n_teams\Plugin\Field\FieldFormatter; -use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\PurchasePlanLinkFormatter; use Drupal\Core\Field\FieldItemInterface; use Drupal\Core\Link; +use Drupal\apigee_m10n\Plugin\Field\FieldFormatter\PurchasePlanLinkFormatter; /** * Class override for the `apigee_purchase_plan_link` field formatter. diff --git a/modules/apigee_m10n_teams/src/Plugin/Field/FieldWidget/CompanyTermsAndConditionsWidget.php b/modules/apigee_m10n_teams/src/Plugin/Field/FieldWidget/CompanyTermsAndConditionsWidget.php index e48cd8ae..63721cbf 100644 --- a/modules/apigee_m10n_teams/src/Plugin/Field/FieldWidget/CompanyTermsAndConditionsWidget.php +++ b/modules/apigee_m10n_teams/src/Plugin/Field/FieldWidget/CompanyTermsAndConditionsWidget.php @@ -20,12 +20,12 @@ namespace Drupal\apigee_m10n_teams\Plugin\Field\FieldWidget; use Apigee\Edge\Api\Monetization\Entity\CompanyAcceptedRatePlan; -use Drupal\apigee_m10n\MonetizationInterface; -use Drupal\apigee_m10n\Plugin\Field\FieldWidget\TermsAndConditionsWidget; -use Drupal\apigee_m10n_teams\MonetizationTeamsInterface; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; +use Drupal\apigee_m10n\MonetizationInterface; +use Drupal\apigee_m10n\Plugin\Field\FieldWidget\TermsAndConditionsWidget; +use Drupal\apigee_m10n_teams\MonetizationTeamsInterface; use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/modules/apigee_m10n_teams/tests/src/Kernel/ApigeeM10nTeamsServiceProviderTest.php b/modules/apigee_m10n_teams/tests/src/Kernel/ApigeeM10nTeamsServiceProviderTest.php index de48af33..b4557048 100644 --- a/modules/apigee_m10n_teams/tests/src/Kernel/ApigeeM10nTeamsServiceProviderTest.php +++ b/modules/apigee_m10n_teams/tests/src/Kernel/ApigeeM10nTeamsServiceProviderTest.php @@ -19,10 +19,10 @@ namespace Drupal\Tests\apigee_m10n_teams\Kernel; +use Drupal\KernelTests\KernelTestBase; use Drupal\apigee_m10n_teams\Entity\ParamConverter\TeamPurchasedPlanConverter; use Drupal\apigee_m10n_teams\Entity\Storage\Controller\TeamAcceptedRatePlanSdkControllerProxy; use Drupal\apigee_m10n_teams\TeamSdkControllerFactory; -use Drupal\KernelTests\KernelTestBase; /** * Tests the module affected overrides are overridden properly. diff --git a/modules/apigee_m10n_teams/tests/src/Kernel/BillingDetailsTest.php b/modules/apigee_m10n_teams/tests/src/Kernel/BillingDetailsTest.php index f79fcc61..8bb60d0b 100644 --- a/modules/apigee_m10n_teams/tests/src/Kernel/BillingDetailsTest.php +++ b/modules/apigee_m10n_teams/tests/src/Kernel/BillingDetailsTest.php @@ -19,7 +19,6 @@ namespace Drupal\Tests\apigee_m10n_teams\Kernel; -use Drupal\Core\Session\UserSession; use Drupal\Core\Url; /** diff --git a/modules/apigee_m10n_teams/tests/src/Kernel/Controller/TeamPricingAndPlansControllerKernelTest.php b/modules/apigee_m10n_teams/tests/src/Kernel/Controller/TeamPricingAndPlansControllerKernelTest.php index d17f6ae6..a9d1b837 100644 --- a/modules/apigee_m10n_teams/tests/src/Kernel/Controller/TeamPricingAndPlansControllerKernelTest.php +++ b/modules/apigee_m10n_teams/tests/src/Kernel/Controller/TeamPricingAndPlansControllerKernelTest.php @@ -19,9 +19,9 @@ namespace Drupal\Tests\apigee_m10n_teams\Kernel\Controller; -use Drupal\apigee_edge\Entity\ApiProduct; use Drupal\Core\Url; use Drupal\Tests\apigee_m10n_teams\Kernel\MonetizationTeamsKernelTestBase; +use Drupal\apigee_edge\Entity\ApiProduct; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; diff --git a/modules/apigee_m10n_teams/tests/src/Kernel/Entity/Access/TeamRatePlanAccessControlHandlerTest.php b/modules/apigee_m10n_teams/tests/src/Kernel/Entity/Access/TeamRatePlanAccessControlHandlerTest.php index a7241c5b..d67bc49f 100644 --- a/modules/apigee_m10n_teams/tests/src/Kernel/Entity/Access/TeamRatePlanAccessControlHandlerTest.php +++ b/modules/apigee_m10n_teams/tests/src/Kernel/Entity/Access/TeamRatePlanAccessControlHandlerTest.php @@ -25,9 +25,9 @@ use Apigee\Edge\Api\Monetization\Entity\DeveloperCategory; use Apigee\Edge\Api\Monetization\Entity\DeveloperCategoryRatePlan; use Apigee\Edge\Api\Monetization\Entity\DeveloperRatePlan; -use Drupal\apigee_m10n\Entity\RatePlan; use Drupal\Tests\apigee_m10n_teams\Kernel\MonetizationTeamsKernelTestBase; use Drupal\Tests\apigee_m10n_teams\Traits\TeamProphecyTrait; +use Drupal\apigee_m10n\Entity\RatePlan; /** * Class TeamRatePlanAccessTest. diff --git a/modules/apigee_m10n_teams/tests/src/Kernel/Entity/ProductBundleEntityKernelTest.php b/modules/apigee_m10n_teams/tests/src/Kernel/Entity/ProductBundleEntityKernelTest.php index 5fd95fb3..5701325f 100644 --- a/modules/apigee_m10n_teams/tests/src/Kernel/Entity/ProductBundleEntityKernelTest.php +++ b/modules/apigee_m10n_teams/tests/src/Kernel/Entity/ProductBundleEntityKernelTest.php @@ -19,11 +19,11 @@ namespace Drupal\Tests\apigee_m10n_teams\Kernel\Entity; -use Drupal\apigee_m10n\Entity\ProductBundle; -use Drupal\apigee_m10n_teams\Entity\TeamProductBundleInterface; use Drupal\Tests\apigee_m10n\Traits\RatePlansPropertyEnablerTrait; use Drupal\Tests\apigee_m10n_teams\Kernel\MonetizationTeamsKernelTestBase; use Drupal\Tests\apigee_m10n_teams\Traits\TeamProphecyTrait; +use Drupal\apigee_m10n\Entity\ProductBundle; +use Drupal\apigee_m10n_teams\Entity\TeamProductBundleInterface; /** * Tests the team product bundle entity. diff --git a/modules/apigee_m10n_teams/tests/src/Kernel/Entity/PurchasedRatePlanEntityKernelTest.php b/modules/apigee_m10n_teams/tests/src/Kernel/Entity/PurchasedRatePlanEntityKernelTest.php index 285490fb..93cf7eb8 100644 --- a/modules/apigee_m10n_teams/tests/src/Kernel/Entity/PurchasedRatePlanEntityKernelTest.php +++ b/modules/apigee_m10n_teams/tests/src/Kernel/Entity/PurchasedRatePlanEntityKernelTest.php @@ -19,11 +19,11 @@ namespace Drupal\Tests\apigee_m10n_teams\Kernel\Entity; -use Drupal\apigee_edge_teams\Entity\TeamRoleInterface; use Drupal\Core\Url; use Drupal\Tests\apigee_m10n_teams\Kernel\MonetizationTeamsKernelTestBase; use Drupal\Tests\apigee_m10n_teams\Traits\ApigeeMonetizationTeamsTestTrait; use Drupal\Tests\apigee_m10n_teams\Traits\TeamProphecyTrait; +use Drupal\apigee_edge_teams\Entity\TeamRoleInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; diff --git a/modules/apigee_m10n_teams/tests/src/Kernel/Entity/RatePlanEntityKernelTest.php b/modules/apigee_m10n_teams/tests/src/Kernel/Entity/RatePlanEntityKernelTest.php index 8afb2f9d..006dadb3 100644 --- a/modules/apigee_m10n_teams/tests/src/Kernel/Entity/RatePlanEntityKernelTest.php +++ b/modules/apigee_m10n_teams/tests/src/Kernel/Entity/RatePlanEntityKernelTest.php @@ -19,11 +19,11 @@ namespace Drupal\Tests\apigee_m10n_teams\Kernel\Entity; -use Drupal\apigee_m10n\Entity\RatePlan; -use Drupal\apigee_m10n_teams\Entity\TeamsRatePlan; use Drupal\Tests\apigee_m10n\Traits\RatePlanDetailsKernelTestAssertionTrait; use Drupal\Tests\apigee_m10n_teams\Kernel\MonetizationTeamsKernelTestBase; use Drupal\Tests\apigee_m10n_teams\Traits\TeamProphecyTrait; +use Drupal\apigee_m10n\Entity\RatePlan; +use Drupal\apigee_m10n_teams\Entity\TeamsRatePlan; /** * Tests the team rate plan entity. @@ -158,7 +158,7 @@ public function testRatePlanEntity() { $this->assertRatePlanDetails($details); // Test rate plan rate card. - // TODO: Test the rate plan render form. + // @todo Test the rate plan render form. } } diff --git a/modules/apigee_m10n_teams/tests/src/Kernel/Entity/TeamsEntityOverrideTest.php b/modules/apigee_m10n_teams/tests/src/Kernel/Entity/TeamsEntityOverrideTest.php index 1c61328f..cac1e3ac 100644 --- a/modules/apigee_m10n_teams/tests/src/Kernel/Entity/TeamsEntityOverrideTest.php +++ b/modules/apigee_m10n_teams/tests/src/Kernel/Entity/TeamsEntityOverrideTest.php @@ -19,14 +19,14 @@ namespace Drupal\Tests\apigee_m10n_teams\Kernel\Entity; +use Drupal\Core\Routing\CurrentRouteMatch; +use Drupal\KernelTests\KernelTestBase; use Drupal\apigee_edge\Entity\EdgeEntityType; use Drupal\apigee_m10n\Entity\ProductBundle; use Drupal\apigee_m10n_teams\Entity\Routing\MonetizationTeamsEntityRouteProvider; use Drupal\apigee_m10n_teams\Entity\Storage\TeamPurchasedPlanStorage; use Drupal\apigee_m10n_teams\Entity\TeamProductBundle; use Drupal\apigee_m10n_teams\Entity\TeamsPurchasedPlan; -use Drupal\Core\Routing\CurrentRouteMatch; -use Drupal\KernelTests\KernelTestBase; /** * Tests the module affected overrides are overridden properly. diff --git a/modules/apigee_m10n_teams/tests/src/Kernel/MonetizationTeamsKernelTestBase.php b/modules/apigee_m10n_teams/tests/src/Kernel/MonetizationTeamsKernelTestBase.php index d9f86671..f7aa19bb 100644 --- a/modules/apigee_m10n_teams/tests/src/Kernel/MonetizationTeamsKernelTestBase.php +++ b/modules/apigee_m10n_teams/tests/src/Kernel/MonetizationTeamsKernelTestBase.php @@ -19,13 +19,13 @@ namespace Drupal\Tests\apigee_m10n_teams\Kernel; +use Drupal\Core\Session\UserSession; +use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; use Drupal\apigee_edge\Entity\Developer; use Drupal\apigee_edge_teams\Entity\Team; use Drupal\apigee_edge_teams\Entity\TeamInterface; use Drupal\apigee_edge_teams\Entity\TeamRole; use Drupal\apigee_edge_teams\Entity\TeamRoleInterface; -use Drupal\Core\Session\UserSession; -use Drupal\Tests\apigee_m10n\Kernel\MonetizationKernelTestBase; use Drupal\user\UserInterface; /** diff --git a/modules/apigee_m10n_teams/tests/src/Kernel/MonetizationTeamsTest.php b/modules/apigee_m10n_teams/tests/src/Kernel/MonetizationTeamsTest.php index a0ae41d3..389209b0 100644 --- a/modules/apigee_m10n_teams/tests/src/Kernel/MonetizationTeamsTest.php +++ b/modules/apigee_m10n_teams/tests/src/Kernel/MonetizationTeamsTest.php @@ -19,6 +19,10 @@ namespace Drupal\Tests\apigee_m10n_teams\Kernel; +use Drupal\Core\Url; +use Drupal\KernelTests\KernelTestBase; +use Drupal\Tests\apigee_m10n\Traits\AccountProphecyTrait; +use Drupal\Tests\apigee_m10n_teams\Traits\TeamProphecyTrait; use Drupal\apigee_edge_teams\Entity\Team; use Drupal\apigee_edge_teams\TeamPermissionHandlerInterface; use Drupal\apigee_m10n\Entity\ProductBundle; @@ -30,10 +34,6 @@ use Drupal\apigee_m10n_teams\Plugin\Field\FieldFormatter\TeamPurchasePlanFormFormatter; use Drupal\apigee_m10n_teams\Plugin\Field\FieldFormatter\TeamPurchasePlanLinkFormatter; use Drupal\apigee_m10n_teams\Plugin\Field\FieldWidget\CompanyTermsAndConditionsWidget; -use Drupal\Core\Url; -use Drupal\KernelTests\KernelTestBase; -use Drupal\Tests\apigee_m10n\Traits\AccountProphecyTrait; -use Drupal\Tests\apigee_m10n_teams\Traits\TeamProphecyTrait; /** * Tests the module affected overrides are overridden properly. diff --git a/modules/apigee_m10n_teams/tests/src/Traits/ApigeeMonetizationTeamsTestTrait.php b/modules/apigee_m10n_teams/tests/src/Traits/ApigeeMonetizationTeamsTestTrait.php index 571984b5..3d69ac40 100644 --- a/modules/apigee_m10n_teams/tests/src/Traits/ApigeeMonetizationTeamsTestTrait.php +++ b/modules/apigee_m10n_teams/tests/src/Traits/ApigeeMonetizationTeamsTestTrait.php @@ -23,7 +23,6 @@ use Drupal\apigee_edge_teams\Entity\Team; use Drupal\apigee_m10n\Entity\RatePlanInterface; use Drupal\apigee_m10n\EnvironmentVariable; -use Drupal\apigee_m10n_teams\Entity\TeamsPurchasedPlan; use Drupal\apigee_m10n_teams\Entity\TeamsPurchasedPlanInterface; /** diff --git a/modules/apigee_m10n_teams/tests/src/Unit/TeamCacheContextTest.php b/modules/apigee_m10n_teams/tests/src/Unit/TeamCacheContextTest.php index bab5a93b..decfdf91 100644 --- a/modules/apigee_m10n_teams/tests/src/Unit/TeamCacheContextTest.php +++ b/modules/apigee_m10n_teams/tests/src/Unit/TeamCacheContextTest.php @@ -19,9 +19,9 @@ namespace Drupal\Tests\apigee_m10n_teams\Kernel; +use Drupal\Tests\UnitTestCase; use Drupal\apigee_edge_teams\Entity\TeamInterface; use Drupal\apigee_m10n_teams\Cache\TeamCacheContext; -use Drupal\Tests\UnitTestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; diff --git a/modules/apigee_m10n_teams/tests/src/Unit/TeamPermissionAccessCheckUnitTest.php b/modules/apigee_m10n_teams/tests/src/Unit/TeamPermissionAccessCheckUnitTest.php index 0fac67a2..ba58f8a8 100644 --- a/modules/apigee_m10n_teams/tests/src/Unit/TeamPermissionAccessCheckUnitTest.php +++ b/modules/apigee_m10n_teams/tests/src/Unit/TeamPermissionAccessCheckUnitTest.php @@ -19,14 +19,14 @@ namespace Drupal\Tests\apigee_m10n_teams\Unit; -use Drupal\apigee_edge_teams\Entity\TeamInterface; -use Drupal\apigee_edge_teams\TeamPermissionHandlerInterface; -use Drupal\apigee_m10n_teams\Access\TeamPermissionAccessCheck; use Drupal\Core\Access\AccessResultAllowed; use Drupal\Core\Access\AccessResultNeutral; use Drupal\Core\Cache\Context\CacheContextsManager; -use Drupal\Tests\apigee_m10n\Traits\AccountProphecyTrait; use Drupal\Tests\UnitTestCase; +use Drupal\Tests\apigee_m10n\Traits\AccountProphecyTrait; +use Drupal\apigee_edge_teams\Entity\TeamInterface; +use Drupal\apigee_edge_teams\TeamPermissionHandlerInterface; +use Drupal\apigee_m10n_teams\Access\TeamPermissionAccessCheck; use Prophecy\Argument; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\Routing\Route; diff --git a/src/Controller/BillingTypeController.php b/src/Controller/BillingTypeController.php index 9b69b619..38fc28d0 100755 --- a/src/Controller/BillingTypeController.php +++ b/src/Controller/BillingTypeController.php @@ -19,12 +19,11 @@ namespace Drupal\apigee_m10n\Controller; -use Drupal\apigee_m10n\ApigeeSdkControllerFactoryInterface; -use Drupal\apigee_m10n\MonetizationInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\apigee_m10n\MonetizationInterface; use Drupal\user\UserInterface; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/src/Controller/BuyApiController.php b/src/Controller/BuyApiController.php index a0c90839..3f1a396e 100755 --- a/src/Controller/BuyApiController.php +++ b/src/Controller/BuyApiController.php @@ -19,21 +19,16 @@ namespace Drupal\apigee_m10n\Controller; -use Apigee\Edge\Api\ApigeeX\Controller\RatePlanControllerInterface; -use Drupal\apigee_m10n\ApigeeSdkControllerFactoryInterface; -use Drupal\apigee_m10n\Entity\XProduct; -use Drupal\apigee_m10n\Entity\XRatePlan; -use Drupal\apigee_m10n\Form\RatePlanXConfigForm; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Access\AccessResult; use Drupal\Core\Cache\Cache; use Drupal\Core\Controller\ControllerBase; -use Drupal\Core\Render\Element; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\apigee_m10n\ApigeeSdkControllerFactoryInterface; +use Drupal\apigee_m10n\Entity\XRatePlan; +use Drupal\apigee_m10n\Form\RatePlanXConfigForm; use Drupal\user\UserInterface; use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** @@ -147,7 +142,7 @@ protected function buildPage($plans) { $view_builder = $this->entityTypeManager()->getViewBuilder('xrate_plan'); foreach ($plans as $id => $plan) { - // TODO: Add a test for render cache. + // @todo Add a test for render cache. $build['#cache']['tags'] = Cache::mergeTags($build['#cache']['tags'], $plan->getCacheTags()); // Generate a build array using the view builder. $build['#children'][$id] = $view_builder->view($plan, $view_mode); diff --git a/src/Controller/PrepaidBalanceControllerBase.php b/src/Controller/PrepaidBalanceControllerBase.php index 73842cfc..9927e8ec 100644 --- a/src/Controller/PrepaidBalanceControllerBase.php +++ b/src/Controller/PrepaidBalanceControllerBase.php @@ -20,16 +20,16 @@ namespace Drupal\apigee_m10n\Controller; use Apigee\Edge\Api\Monetization\Entity\PrepaidBalanceInterface; -use Drupal\apigee_edge\SDKConnectorInterface; -use Drupal\apigee_m10n\Form\PrepaidBalanceConfigForm; -use Drupal\apigee_m10n\Form\PrepaidBalanceRefreshForm; -use Drupal\apigee_m10n\Form\PrepaidBalanceReportsDownloadForm; -use Drupal\apigee_m10n\MonetizationInterface; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\FormBuilderInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\apigee_edge\SDKConnectorInterface; +use Drupal\apigee_m10n\Form\PrepaidBalanceConfigForm; +use Drupal\apigee_m10n\Form\PrepaidBalanceRefreshForm; +use Drupal\apigee_m10n\Form\PrepaidBalanceReportsDownloadForm; +use Drupal\apigee_m10n\MonetizationInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/src/Controller/PrepaidBalanceXController.php b/src/Controller/PrepaidBalanceXController.php index 32336da6..baf1e848 100755 --- a/src/Controller/PrepaidBalanceXController.php +++ b/src/Controller/PrepaidBalanceXController.php @@ -23,7 +23,6 @@ use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Session\AccountInterface; use Drupal\user\UserInterface; -use Symfony\Component\HttpFoundation\RedirectResponse; /** * Controller for team balances. diff --git a/src/Controller/PrepaidBalanceXControllerBase.php b/src/Controller/PrepaidBalanceXControllerBase.php index 035f8bb1..74cb2c38 100644 --- a/src/Controller/PrepaidBalanceXControllerBase.php +++ b/src/Controller/PrepaidBalanceXControllerBase.php @@ -20,16 +20,16 @@ namespace Drupal\apigee_m10n\Controller; use Apigee\Edge\Api\ApigeeX\Entity\PrepaidBalanceInterface; -use Drupal\apigee_edge\SDKConnectorInterface; -use Drupal\apigee_m10n\Form\PrepaidBalanceConfigForm; -use Drupal\apigee_m10n\Form\PrepaidBalanceRefreshForm; -use Drupal\apigee_m10n\MonetizationInterface; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\FormBuilderInterface; use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\apigee_edge\SDKConnectorInterface; +use Drupal\apigee_m10n\Form\PrepaidBalanceConfigForm; +use Drupal\apigee_m10n\Form\PrepaidBalanceRefreshForm; +use Drupal\apigee_m10n\MonetizationInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/src/Controller/PricingAndPlansController.php b/src/Controller/PricingAndPlansController.php index 92d6a58c..13c9cafd 100644 --- a/src/Controller/PricingAndPlansController.php +++ b/src/Controller/PricingAndPlansController.php @@ -19,19 +19,16 @@ namespace Drupal\apigee_m10n\Controller; -use Apigee\Edge\Api\Monetization\Controller\RatePlanControllerInterface; -use Drupal\apigee_m10n\ApigeeSdkControllerFactoryInterface; -use Drupal\apigee_m10n\Entity\ProductBundle; -use Drupal\apigee_m10n\Form\RatePlanConfigForm; -use Drupal\apigee_m10n\MonetizationInterface; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Access\AccessResult; use Drupal\Core\Cache\Cache; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Messenger\MessengerInterface; -use Drupal\Core\Render\Element; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\apigee_m10n\ApigeeSdkControllerFactoryInterface; +use Drupal\apigee_m10n\Entity\ProductBundle; +use Drupal\apigee_m10n\Form\RatePlanConfigForm; +use Drupal\apigee_m10n\MonetizationInterface; use Drupal\user\UserInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -207,7 +204,7 @@ protected function buildPage($plans) { $view_builder = $this->entityTypeManager()->getViewBuilder('rate_plan'); foreach ($plans as $id => $plan) { - // TODO: Add a test for render cache. + // @todo Add a test for render cache. $build['#cache']['tags'] = Cache::mergeTags($build['#cache']['tags'], $plan->getCacheTags()); // Generate a build array using the view builder. $build['#children'][$id] = $view_builder->view($plan, $view_mode); diff --git a/src/Entity/Access/RatePlanSubscriptionAccessHandler.php b/src/Entity/Access/RatePlanSubscriptionAccessHandler.php index 28699d9c..7fa63a01 100644 --- a/src/Entity/Access/RatePlanSubscriptionAccessHandler.php +++ b/src/Entity/Access/RatePlanSubscriptionAccessHandler.php @@ -22,13 +22,13 @@ use Apigee\Edge\Api\Monetization\Entity\CompanyRatePlanInterface; use Apigee\Edge\Api\Monetization\Entity\DeveloperCategoryRatePlanInterface; use Apigee\Edge\Api\Monetization\Entity\DeveloperRatePlanInterface; -use Drupal\apigee_m10n\Entity\RatePlanInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Entity\EntityHandlerInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Routing\Access\AccessInterface; +use Drupal\apigee_m10n\Entity\RatePlanInterface; use Drupal\user\UserInterface; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/src/Entity/Access/XRatePlanSubscriptionAccessHandler.php b/src/Entity/Access/XRatePlanSubscriptionAccessHandler.php index bf247ab2..c107ac0b 100755 --- a/src/Entity/Access/XRatePlanSubscriptionAccessHandler.php +++ b/src/Entity/Access/XRatePlanSubscriptionAccessHandler.php @@ -22,13 +22,13 @@ use Apigee\Edge\Api\Monetization\Entity\CompanyRatePlanInterface; use Apigee\Edge\Api\Monetization\Entity\DeveloperCategoryRatePlanInterface; use Apigee\Edge\Api\Monetization\Entity\DeveloperRatePlanInterface; -use Drupal\apigee_m10n\Entity\XRatePlanInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Entity\EntityHandlerInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Routing\Access\AccessInterface; +use Drupal\apigee_m10n\Entity\XRatePlanInterface; use Drupal\user\UserInterface; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/src/Entity/Controller/PurchaseRatePlanController.php b/src/Entity/Controller/PurchaseRatePlanController.php index 0c47dbb7..956add56 100644 --- a/src/Entity/Controller/PurchaseRatePlanController.php +++ b/src/Entity/Controller/PurchaseRatePlanController.php @@ -20,12 +20,12 @@ namespace Drupal\apigee_m10n\Entity\Controller; use Apigee\Edge\Api\Monetization\Entity\Developer; -use Drupal\apigee_m10n\Entity\PurchasedPlan; -use Drupal\apigee_m10n\Entity\RatePlanInterface; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Entity\EntityFormBuilderInterface; use Drupal\Core\Routing\RouteMatchInterface; +use Drupal\apigee_m10n\Entity\PurchasedPlan; +use Drupal\apigee_m10n\Entity\RatePlanInterface; use Drupal\user\UserInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -100,7 +100,7 @@ public function purchaseForm(UserInterface $user, RatePlanInterface $rate_plan) * @return \Drupal\Core\StringTranslation\TranslatableMarkup * The title. */ - public function title(RouteMatchInterface $route_match, UserInterface $user = NULL, RatePlanInterface $rate_plan = NULL) { + public function title(RouteMatchInterface $route_match, ?UserInterface $user = NULL, ?RatePlanInterface $rate_plan = NULL) { return $this->t('Purchase @rate_plan', ['@rate_plan' => $rate_plan->getDisplayName()]); } diff --git a/src/Entity/Controller/PurchaseRatePlanXController.php b/src/Entity/Controller/PurchaseRatePlanXController.php index 91a47d07..b9b0ebc3 100755 --- a/src/Entity/Controller/PurchaseRatePlanXController.php +++ b/src/Entity/Controller/PurchaseRatePlanXController.php @@ -20,12 +20,12 @@ namespace Drupal\apigee_m10n\Entity\Controller; use Apigee\Edge\Api\Monetization\Entity\Developer; -use Drupal\apigee_m10n\Entity\PurchasedProduct; -use Drupal\apigee_m10n\Entity\XRatePlanInterface; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Entity\EntityFormBuilderInterface; use Drupal\Core\Routing\RouteMatchInterface; +use Drupal\apigee_m10n\Entity\PurchasedProduct; +use Drupal\apigee_m10n\Entity\XRatePlanInterface; use Drupal\user\UserInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -75,7 +75,6 @@ public static function create(ContainerInterface $container) { */ public function purchaseForm(UserInterface $user, XRatePlanInterface $xrate_plan) { // Create a purchased_plan to pass to the purchased_plan edit form. - $purchased_plan = PurchasedProduct::create([ 'xratePlan' => $xrate_plan, 'developer' => new Developer(['email' => $user->getEmail()]), @@ -100,7 +99,7 @@ public function purchaseForm(UserInterface $user, XRatePlanInterface $xrate_plan * @return \Drupal\Core\StringTranslation\TranslatableMarkup * The title. */ - public function title(RouteMatchInterface $route_match, UserInterface $user = NULL, XRatePlanInterface $xrate_plan = NULL) { + public function title(RouteMatchInterface $route_match, ?UserInterface $user = NULL, ?XRatePlanInterface $xrate_plan = NULL) { return $this->t('Purchase @rate_plan', ['@rate_plan' => $xrate_plan->getDisplayName()]); } diff --git a/src/Entity/Form/CancelPurchaseConfirmForm.php b/src/Entity/Form/CancelPurchaseConfirmForm.php index b261fb1c..d67675d3 100644 --- a/src/Entity/Form/CancelPurchaseConfirmForm.php +++ b/src/Entity/Form/CancelPurchaseConfirmForm.php @@ -19,12 +19,12 @@ namespace Drupal\apigee_m10n\Entity\Form; -use Drupal\apigee_m10n\ApigeeSdkControllerFactory; use Drupal\Core\Cache\Cache; use Drupal\Core\Entity\EntityConfirmFormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Routing\RouteMatchInterface; +use Drupal\apigee_m10n\ApigeeSdkControllerFactory; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -160,7 +160,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $form_state->setRedirect('entity.purchased_plan.developer_collection', ['user' => $this->entity->getOwnerId()]); } } - // TODO: Check to see if `EntityStorageException` is the only type of error + // @todo Check to see if `EntityStorageException` is the only type of error // to we need to catch here. catch (\Exception $e) { $this->messenger->addError('Error while cancelling plan: ' . $e->getMessage()); diff --git a/src/Entity/Form/CancelPurchasedProductConfirmForm.php b/src/Entity/Form/CancelPurchasedProductConfirmForm.php index 7cc641e7..8c32e66f 100644 --- a/src/Entity/Form/CancelPurchasedProductConfirmForm.php +++ b/src/Entity/Form/CancelPurchasedProductConfirmForm.php @@ -19,12 +19,12 @@ namespace Drupal\apigee_m10n\Entity\Form; -use Drupal\apigee_m10n\ApigeeSdkControllerFactory; use Drupal\Core\Cache\Cache; use Drupal\Core\Entity\EntityConfirmFormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Routing\RouteMatchInterface; +use Drupal\apigee_m10n\ApigeeSdkControllerFactory; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -138,7 +138,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $form_state->setRedirect('entity.purchased_product.developer_product_collection', ['user' => $this->entity->getOwnerId()]); } } - // TODO: Check to see if `EntityStorageException` is the only type of error + // @todo Check to see if `EntityStorageException` is the only type of error // to we need to catch here. catch (\Exception $e) { diff --git a/src/Entity/Form/FieldableMonetizationEntityForm.php b/src/Entity/Form/FieldableMonetizationEntityForm.php index 2f01551e..650dc513 100644 --- a/src/Entity/Form/FieldableMonetizationEntityForm.php +++ b/src/Entity/Form/FieldableMonetizationEntityForm.php @@ -19,9 +19,9 @@ namespace Drupal\apigee_m10n\Entity\Form; -use Drupal\apigee_edge\Entity\Form\FieldableEdgeEntityForm; use Drupal\Core\Entity\EntityConstraintViolationListInterface; use Drupal\Core\Form\FormStateInterface; +use Drupal\apigee_edge\Entity\Form\FieldableEdgeEntityForm; /** * Entity form variant for Apigee Monetization entity types. diff --git a/src/Entity/Form/FieldableMonetizationEntityFormInterface.php b/src/Entity/Form/FieldableMonetizationEntityFormInterface.php index 11732aa9..29aa63ef 100644 --- a/src/Entity/Form/FieldableMonetizationEntityFormInterface.php +++ b/src/Entity/Form/FieldableMonetizationEntityFormInterface.php @@ -19,8 +19,8 @@ namespace Drupal\apigee_m10n\Entity\Form; -use Drupal\apigee_edge\Entity\Form\FieldableEdgeEntityFormInterface; use Drupal\Core\Form\FormStateInterface; +use Drupal\apigee_edge\Entity\Form\FieldableEdgeEntityFormInterface; /** * Entity form variant for Apigee Monetization entity types. diff --git a/src/Entity/Form/PurchasedPlanForm.php b/src/Entity/Form/PurchasedPlanForm.php index 82688d5b..c797c87b 100644 --- a/src/Entity/Form/PurchasedPlanForm.php +++ b/src/Entity/Form/PurchasedPlanForm.php @@ -21,11 +21,6 @@ use Apigee\Edge\Api\Monetization\Entity\LegalEntityInterface; use Apigee\Edge\Exception\ClientErrorException; -use Drupal\apigee_edge\Entity\ApiProductInterface; -use Drupal\apigee_edge\Entity\Developer; -use Drupal\apigee_edge\Entity\Form\FieldableEdgeEntityForm; -use Drupal\apigee_m10n\Form\PrepaidBalanceConfigForm; -use Drupal\apigee_m10n\MonetizationInterface; use Drupal\Core\Cache\Cache; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Extension\ModuleHandlerInterface; @@ -34,6 +29,11 @@ use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Url; +use Drupal\apigee_edge\Entity\ApiProductInterface; +use Drupal\apigee_edge\Entity\Developer; +use Drupal\apigee_edge\Entity\Form\FieldableEdgeEntityForm; +use Drupal\apigee_m10n\Form\PrepaidBalanceConfigForm; +use Drupal\apigee_m10n\MonetizationInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -138,7 +138,7 @@ public static function create(ContainerInterface $container) { * {@inheritdoc} */ public function getFormId() { - // @TODO: Make sure we find a better way to handle names + // @todo Make sure we find a better way to handle names // without adding rate plan ID this form is getting cached // and when rendered as a formatter. // Also known issue in core @see https://www.drupal.org/project/drupal/issues/766146. @@ -287,12 +287,12 @@ protected function insufficientFundsWorkflow(array &$form, FormStateInterface $f return; } - /* @var \Drupal\apigee_m10n\Entity\PurchasedPlan $purchased_plan */ + /** @var \Drupal\apigee_m10n\Entity\PurchasedPlan $purchased_plan */ $purchased_plan = $form_state->getFormObject()->getEntity(); $rate_plan = $purchased_plan->getRatePlan(); $user = $purchased_plan->getOwner(); - /* @var \Drupal\apigee_m10n\ApigeeSdkControllerFactory $sdk */ + /** @var \Drupal\apigee_m10n\ApigeeSdkControllerFactory $sdk */ $sdk = \Drupal::service('apigee_m10n.sdk_controller_factory'); try { $developer = $sdk->developerController()->load($user->getEmail()); diff --git a/src/Entity/Form/PurchasedProductForm.php b/src/Entity/Form/PurchasedProductForm.php index c077be19..0ed92d83 100755 --- a/src/Entity/Form/PurchasedProductForm.php +++ b/src/Entity/Form/PurchasedProductForm.php @@ -21,12 +21,6 @@ use Apigee\Edge\Api\Monetization\Entity\LegalEntityInterface; use Apigee\Edge\Exception\ClientErrorException; -use Apigee\Edge\Exception\ServerErrorException; -use Drupal\apigee_edge\Entity\ApiProductInterface; -use Drupal\apigee_edge\Entity\Developer; -use Drupal\apigee_edge\Entity\Form\FieldableEdgeEntityForm; -use Drupal\apigee_m10n\Form\PrepaidBalanceConfigForm; -use Drupal\apigee_m10n\MonetizationInterface; use Drupal\Core\Cache\Cache; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Extension\ModuleHandlerInterface; @@ -34,7 +28,10 @@ use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Session\AccountInterface; -use Drupal\Core\Url; +use Drupal\apigee_edge\Entity\Developer; +use Drupal\apigee_edge\Entity\Form\FieldableEdgeEntityForm; +use Drupal\apigee_m10n\Form\PrepaidBalanceConfigForm; +use Drupal\apigee_m10n\MonetizationInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -135,7 +132,7 @@ public static function create(ContainerInterface $container) { * {@inheritdoc} */ public function getFormId() { - // @TODO: Make sure we find a better way to handle names + // @todo Make sure we find a better way to handle names // without adding rate plan ID this form is getting cached // and when rendered as a formatter. // Also known issue in core @see https://www.drupal.org/project/drupal/issues/766146. @@ -148,7 +145,6 @@ public function getFormId() { public function form(array $form, FormStateInterface $form_state) { $form = parent::form($form, $form_state); // Redirect to Rate Plan detail page on submit. - $form['#action'] = $this->getEntity()->getRatePlan()->toUrl('purchase')->toString(); return $form; } @@ -197,7 +193,6 @@ protected function actions(array $form, FormStateInterface $form_state) { public function save(array $form, FormStateInterface $form_state) { try { // Auto assign legal name. - $developer_id = $this->getEntity()->getDeveloper()->getEmail(); $developer = Developer::load($developer_id); @@ -264,12 +259,12 @@ protected function insufficientFundsWorkflow(array &$form, FormStateInterface $f return; } - /* @var \Drupal\apigee_m10n\Entity\PurchasedProduct $purchased_product */ + /** @var \Drupal\apigee_m10n\Entity\PurchasedProduct $purchased_product */ $purchased_product = $form_state->getFormObject()->getEntity(); $rate_plan = $purchased_product->getRatePlan(); $user = $purchased_product->getOwner(); - /* @var \Drupal\apigee_m10n\ApigeeSdkControllerFactory $sdk */ + /** @var \Drupal\apigee_m10n\ApigeeSdkControllerFactory $sdk */ $sdk = \Drupal::service('apigee_m10n.sdk_controller_factory'); try { $developer_billing_type = $sdk->developerBillingTypeController($user->getEmail())->getAllBillingDetails(); diff --git a/src/Entity/ListBuilder/PurchasedPlanListBuilder.php b/src/Entity/ListBuilder/PurchasedPlanListBuilder.php index 3444a61b..47ea8dfc 100644 --- a/src/Entity/ListBuilder/PurchasedPlanListBuilder.php +++ b/src/Entity/ListBuilder/PurchasedPlanListBuilder.php @@ -19,9 +19,6 @@ namespace Drupal\apigee_m10n\Entity\ListBuilder; -use Drupal\apigee_m10n\Entity\Form\PurchasedPlanForm; -use Drupal\apigee_m10n\Entity\PurchasedPlanInterface; -use Drupal\apigee_m10n\MonetizationInterface; use Drupal\Component\Utility\Html; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Entity\EntityInterface; @@ -32,6 +29,9 @@ use Drupal\Core\Link; use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Routing\RouteMatchInterface; +use Drupal\apigee_m10n\Entity\Form\PurchasedPlanForm; +use Drupal\apigee_m10n\Entity\PurchasedPlanInterface; +use Drupal\apigee_m10n\MonetizationInterface; use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -131,7 +131,7 @@ public static function create(ContainerInterface $container) { * {@inheritdoc} */ public function getPageTitle(RouteMatchInterface $route_match): string { - // TODO: make sure this string is configurable. + // @todo make sure this string is configurable. return $this->t('Purchased plans'); } diff --git a/src/Entity/ListBuilder/PurchasedPlanListBuilderForDeveloper.php b/src/Entity/ListBuilder/PurchasedPlanListBuilderForDeveloper.php index 08cd38f5..7f8274f7 100644 --- a/src/Entity/ListBuilder/PurchasedPlanListBuilderForDeveloper.php +++ b/src/Entity/ListBuilder/PurchasedPlanListBuilderForDeveloper.php @@ -19,12 +19,12 @@ namespace Drupal\apigee_m10n\Entity\ListBuilder; -use Drupal\apigee_m10n\Entity\PurchasedPlan; -use Drupal\apigee_m10n\Entity\PurchasedPlanInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Url; +use Drupal\apigee_m10n\Entity\PurchasedPlan; +use Drupal\apigee_m10n\Entity\PurchasedPlanInterface; use Drupal\user\UserInterface; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -45,7 +45,7 @@ class PurchasedPlanListBuilderForDeveloper extends PurchasedPlanListBuilder { /** * {@inheritdoc} */ - public function render(UserInterface $user = NULL) { + public function render(?UserInterface $user = NULL) { // Return 404 if the user is not set and keep a compatible method signature. if (!($user instanceof UserInterface)) { // There is a `user: '^[1-9]+[0-9]*$'` requirement on the route that uses diff --git a/src/Entity/ListBuilder/PurchasedProductListBuilder.php b/src/Entity/ListBuilder/PurchasedProductListBuilder.php index 743f52ec..82d34944 100755 --- a/src/Entity/ListBuilder/PurchasedProductListBuilder.php +++ b/src/Entity/ListBuilder/PurchasedProductListBuilder.php @@ -19,8 +19,6 @@ namespace Drupal\apigee_m10n\Entity\ListBuilder; -use Drupal\apigee_m10n\Entity\Form\PurchasedProductForm; -use Drupal\apigee_m10n\Entity\PurchasedProductInterface; use Drupal\Component\Utility\Html; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Entity\EntityInterface; @@ -28,9 +26,10 @@ use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Link; use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Routing\RouteMatchInterface; +use Drupal\apigee_m10n\Entity\Form\PurchasedProductForm; +use Drupal\apigee_m10n\Entity\PurchasedProductInterface; use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -133,7 +132,7 @@ public static function create(ContainerInterface $container) { * {@inheritdoc} */ public function getPageTitle(RouteMatchInterface $route_match): string { - // TODO: make sure this string is configurable. + // @todo make sure this string is configurable. return $this->t('Purchased Products'); } diff --git a/src/Entity/ListBuilder/PurchasedProductListBuilderForDeveloper.php b/src/Entity/ListBuilder/PurchasedProductListBuilderForDeveloper.php index a970471b..49e608e4 100755 --- a/src/Entity/ListBuilder/PurchasedProductListBuilderForDeveloper.php +++ b/src/Entity/ListBuilder/PurchasedProductListBuilderForDeveloper.php @@ -19,14 +19,12 @@ namespace Drupal\apigee_m10n\Entity\ListBuilder; -use Drupal\apigee_m10n\Entity\PurchasedProduct; -use Drupal\apigee_m10n\Entity\PurchasedProductInterface; -use Drupal\apigee_m10n\Monetization; -use Drupal\apigee_m10n\MonetizationInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Url; +use Drupal\apigee_m10n\Entity\PurchasedProduct; +use Drupal\apigee_m10n\Entity\PurchasedProductInterface; use Drupal\user\UserInterface; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -47,7 +45,7 @@ class PurchasedProductListBuilderForDeveloper extends PurchasedProductListBuilde /** * {@inheritdoc} */ - public function render(UserInterface $user = NULL) { + public function render(?UserInterface $user = NULL) { // Return 404 if the user is not set and keep a compatible method signature. if (!($user instanceof UserInterface)) { diff --git a/src/Entity/ListBuilder/XProductListBuilder.php b/src/Entity/ListBuilder/XProductListBuilder.php index db48412f..89061180 100755 --- a/src/Entity/ListBuilder/XProductListBuilder.php +++ b/src/Entity/ListBuilder/XProductListBuilder.php @@ -21,7 +21,6 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityListBuilder; -use Drupal\Core\Render\Markup; /** * Admin list builder for `xproduct` entities. @@ -45,7 +44,6 @@ public function buildHeader() { public function buildRow(EntityInterface $entity) { /** @var \Drupal\apigee_m10n\Entity\XProductInterface $entity */ // Build a list of product links. - $product_links = []; return [ 'title' => $entity->toLink($entity->label()), diff --git a/src/Entity/ProductBundle.php b/src/Entity/ProductBundle.php index 307aff8d..b25c54c1 100644 --- a/src/Entity/ProductBundle.php +++ b/src/Entity/ProductBundle.php @@ -21,6 +21,7 @@ use Apigee\Edge\Api\Monetization\Entity\ApiPackage; use Apigee\Edge\Entity\EntityInterface as EdgeEntityInterface; +use Drupal\Core\Entity\EntityTypeInterface; use Drupal\apigee_edge\Entity\FieldableEdgeEntityBase; use Drupal\apigee_m10n\Entity\Property\ApiProductsPropertyAwareDecoratorTrait; use Drupal\apigee_m10n\Entity\Property\DescriptionPropertyAwareDecoratorTrait; @@ -29,7 +30,6 @@ use Drupal\apigee_m10n\Entity\Property\NamePropertyAwareDecoratorTrait; use Drupal\apigee_m10n\Entity\Property\OrganizationPropertyAwareDecoratorTrait; use Drupal\apigee_m10n\Entity\Property\StatusPropertyAwareDecoratorTrait; -use Drupal\Core\Entity\EntityTypeInterface; use Drupal\user\UserInterface; /** diff --git a/src/Entity/PurchasedPlan.php b/src/Entity/PurchasedPlan.php index a1606c61..241e6985 100644 --- a/src/Entity/PurchasedPlan.php +++ b/src/Entity/PurchasedPlan.php @@ -24,11 +24,11 @@ use Apigee\Edge\Api\Monetization\Entity\DeveloperInterface; use Apigee\Edge\Api\Monetization\Entity\RatePlanInterface; use Apigee\Edge\Entity\EntityInterface as EdgeEntityInterface; +use Drupal\Core\Entity\EntityTypeInterface; use Drupal\apigee_edge\Entity\FieldableEdgeEntityBase; use Drupal\apigee_m10n\Entity\Property\EndDatePropertyAwareDecoratorTrait; use Drupal\apigee_m10n\Entity\Property\StartDatePropertyAwareDecoratorTrait; use Drupal\apigee_m10n\Entity\RatePlanInterface as DrupalRatePlanInterface; -use Drupal\Core\Entity\EntityTypeInterface; use Drupal\user\EntityOwnerInterface; use Drupal\user\UserInterface; @@ -116,7 +116,7 @@ public function __construct(array $values, ?string $entity_type = NULL, ?EdgeEnt parent::__construct($values, $entity_type, $decorated); // Save entity references in this class as well as the decorated instance. if (!empty($values['ratePlan']) && $values['ratePlan'] instanceof DrupalRatePlanInterface) { - // TODO: Since `RatePlan::createFrom($sdk_rate_plan)` is available do we + // @todo Since `RatePlan::createFrom($sdk_rate_plan)` is available do we // need to store an extra reference here. Is the slight performance // benefit worth it? $this->setRatePlan($values['ratePlan']); @@ -374,7 +374,7 @@ public function getPrevRecurringFeeDate(): ?\DateTimeImmutable { * {@inheritdoc} */ public function getDeveloper(): ?DeveloperInterface { - // TODO: Return the `apigee_edge` developer entity reference. + // @todo Return the `apigee_edge` developer entity reference. return $this->decorated->getDeveloper(); } diff --git a/src/Entity/PurchasedProduct.php b/src/Entity/PurchasedProduct.php index 286ee176..a10c119c 100755 --- a/src/Entity/PurchasedProduct.php +++ b/src/Entity/PurchasedProduct.php @@ -21,18 +21,15 @@ use Apigee\Edge\Api\ApigeeX\Entity\AcceptedRatePlan; use Apigee\Edge\Api\ApigeeX\Entity\DeveloperAcceptedRatePlan; -use Apigee\Edge\Api\ApigeeX\Entity\RatePlanInterface; use Apigee\Edge\Api\Monetization\Entity\DeveloperInterface; use Apigee\Edge\Entity\EntityInterface as EdgeEntityInterface; -use Apigee\Edge\Entity\Property\NamePropertyAwareTrait; +use Drupal\Core\Entity\EntityTypeInterface; use Drupal\apigee_edge\Entity\FieldableEdgeEntityBase; use Drupal\apigee_m10n\Entity\Property\ApiProductPropertyAwareDecoratorTrait; use Drupal\apigee_m10n\Entity\Property\EndTimePropertyAwareDecoratorTrait; use Drupal\apigee_m10n\Entity\Property\NamePropertyAwareDecoratorTrait; use Drupal\apigee_m10n\Entity\Property\StartTimePropertyAwareDecoratorTrait; use Drupal\apigee_m10n\Entity\XRatePlanInterface as DrupalRatePlanInterface; -use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Session\AccountProxyInterface; use Drupal\user\EntityOwnerInterface; use Drupal\user\UserInterface; @@ -125,7 +122,7 @@ public function __construct(array $values, ?string $entity_type = NULL, ?EdgeEnt parent::__construct($values, $entity_type, $decorated); if (!empty($values['xratePlan']) && $values['xratePlan'] instanceof DrupalRatePlanInterface) { - // TODO: Since `RatePlan::createFrom($sdk_rate_plan)` is available do we + // @todo Since `RatePlan::createFrom($sdk_rate_plan)` is available do we // need to store an extra reference here. Is the slight performance // benefit worth it? $this->setRatePlan($values['xratePlan']); @@ -173,7 +170,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { 'developer', 'name', 'apiProduct', - 'ratePlan' + 'ratePlan', ]; // Disable the form display entry for all read only fields. foreach ($read_only_fields as $field_name) { @@ -278,7 +275,7 @@ public function getCreatedAt(): ?string { */ public function getDeveloper(): ?DeveloperInterface { $currentUserId = $this->currentUser; - // TODO: Return the `apigee_edge` developer entity reference. + // @todo Return the `apigee_edge` developer entity reference. return $this->decorated->getDeveloper($currentUserId); } diff --git a/src/Entity/RatePlan.php b/src/Entity/RatePlan.php index cd05aeb8..53e45720 100644 --- a/src/Entity/RatePlan.php +++ b/src/Entity/RatePlan.php @@ -27,6 +27,8 @@ use Apigee\Edge\Api\Monetization\Entity\StandardRatePlan; use Apigee\Edge\Api\Monetization\Structure\RatePlanDetail; use Apigee\Edge\Entity\EntityInterface as EdgeEntityInterface; +use Drupal\Core\Cache\Cache; +use Drupal\Core\Entity\EntityTypeInterface; use Drupal\apigee_edge\Entity\FieldableEdgeEntityBase; use Drupal\apigee_m10n\Entity\Property\CurrencyPropertyAwareDecoratorTrait; use Drupal\apigee_m10n\Entity\Property\DescriptionPropertyAwareDecoratorTrait; @@ -42,8 +44,6 @@ use Drupal\apigee_m10n\Entity\Property\RecurringFeePropertyAwareDecoratorTrait; use Drupal\apigee_m10n\Entity\Property\SetUpFeePropertyAwareDecoratorTrait; use Drupal\apigee_m10n\Entity\Property\StartDatePropertyAwareDecoratorTrait; -use Drupal\Core\Cache\Cache; -use Drupal\Core\Entity\EntityTypeInterface; use Drupal\user\Entity\User; /** diff --git a/src/Entity/Routing/MonetizationEntityRouteProvider.php b/src/Entity/Routing/MonetizationEntityRouteProvider.php index 8d4cbb30..8c7d30e9 100644 --- a/src/Entity/Routing/MonetizationEntityRouteProvider.php +++ b/src/Entity/Routing/MonetizationEntityRouteProvider.php @@ -19,8 +19,8 @@ namespace Drupal\apigee_m10n\Entity\Routing; -use Drupal\apigee_m10n\Entity\Controller\ContextDependentEntityController; use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\apigee_m10n\Entity\Controller\ContextDependentEntityController; use Drupal\entity\Routing\DefaultHtmlRouteProvider; use Symfony\Component\Routing\Route; diff --git a/src/Entity/Storage/Controller/DeveloperAcceptedRatePlanSdkControllerProxy.php b/src/Entity/Storage/Controller/DeveloperAcceptedRatePlanSdkControllerProxy.php index c9f41578..e39fbf71 100644 --- a/src/Entity/Storage/Controller/DeveloperAcceptedRatePlanSdkControllerProxy.php +++ b/src/Entity/Storage/Controller/DeveloperAcceptedRatePlanSdkControllerProxy.php @@ -109,7 +109,7 @@ public function loadAll(): array { */ public function loadByDeveloperId(string $developer_id): array { // Get all purchases for this developer. - // TODO: Cache purchased_plan lists per developer. + // @todo Cache purchased_plan lists per developer. return $this->getPurchasedPlanControllerByDeveloperId($developer_id) ->getAllAcceptedRatePlans(); } diff --git a/src/Entity/Storage/Controller/DeveloperAcceptedRatePlanXSdkControllerProxy.php b/src/Entity/Storage/Controller/DeveloperAcceptedRatePlanXSdkControllerProxy.php index 4e41fd83..2c2f97fc 100755 --- a/src/Entity/Storage/Controller/DeveloperAcceptedRatePlanXSdkControllerProxy.php +++ b/src/Entity/Storage/Controller/DeveloperAcceptedRatePlanXSdkControllerProxy.php @@ -106,7 +106,7 @@ public function loadAll(): array { */ public function loadByDeveloperId(string $developer_id): array { // Get all purchases for this developer. - // TODO: Cache purchased_product lists per developer. + // @todo Cache purchased_product lists per developer. return $this->getPurchasedProductControllerByDeveloperId($developer_id) ->getAllAcceptedRatePlans(); } @@ -152,7 +152,6 @@ protected function getPurchasedProductControllerByDeveloperId($developer_id) { static $controller_cache = []; // Make sure a controller is cached. - $controller_cache[$developer_id] = $controller_cache[$developer_id] ?? $this->controllerFactory()->developerAcceptedRatePlanxController($developer_id); diff --git a/src/Entity/Storage/Controller/RatePlanSdkControllerProxy.php b/src/Entity/Storage/Controller/RatePlanSdkControllerProxy.php index 7c8915cf..bca4fd94 100644 --- a/src/Entity/Storage/Controller/RatePlanSdkControllerProxy.php +++ b/src/Entity/Storage/Controller/RatePlanSdkControllerProxy.php @@ -69,7 +69,7 @@ public function delete(string $id): void { * {@inheritdoc} */ public function loadAll(): array { - // TODO: Cache this list. + // @todo Cache this list. $all_product_bundles = ProductBundle::loadAll(); /** @var \Apigee\Edge\Api\Monetization\Entity\RatePlanInterface[] $rate_plans */ diff --git a/src/Entity/Storage/Controller/XRatePlanSdkControllerProxy.php b/src/Entity/Storage/Controller/XRatePlanSdkControllerProxy.php index c96484d5..3fb94236 100755 --- a/src/Entity/Storage/Controller/XRatePlanSdkControllerProxy.php +++ b/src/Entity/Storage/Controller/XRatePlanSdkControllerProxy.php @@ -69,7 +69,7 @@ public function delete(string $id): void { * {@inheritdoc} */ public function loadAll(): array { - // TODO: Cache this list. + // @todo Cache this list. $all_product_bundles = XProduct::loadAll(); /** @var \Apigee\Edge\Api\ApigeeX\Entity\RatePlanInterface[] $rate_plans */ diff --git a/src/Entity/Storage/ProductBundleStorage.php b/src/Entity/Storage/ProductBundleStorage.php index 1af594b6..c7c7f46a 100644 --- a/src/Entity/Storage/ProductBundleStorage.php +++ b/src/Entity/Storage/ProductBundleStorage.php @@ -19,14 +19,12 @@ namespace Drupal\apigee_m10n\Entity\Storage; -use Drupal\apigee_edge\Entity\Controller\EdgeEntityControllerInterface; -use Drupal\apigee_edge\Entity\Storage\EdgeEntityStorageBase; -use Drupal\apigee_m10n\ApigeeSdkControllerFactoryAwareTrait; -use Drupal\apigee_m10n\Entity\Storage\Controller\ProductBundleEntityControllerProxy; use Drupal\Component\Datetime\TimeInterface; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface; use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\apigee_edge\Entity\Controller\EdgeEntityControllerInterface; +use Drupal\apigee_edge\Entity\Storage\EdgeEntityStorageBase; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -119,7 +117,7 @@ public function getAvailableProductBundlesByDeveloper($developer_id) { $this->invokeStorageLoadHook($entities); $this->setPersistentCache($entities); - // TODO: Consider caching this list in the DB. + // @todo Consider caching this list in the DB. // Set static cache. $this->product_bundles_by_developer[$developer_id] = array_map(function ($entity) { return $entity->id(); @@ -153,7 +151,7 @@ public function loadAll() { $this->invokeStorageLoadHook($entities); $this->setPersistentCache($entities); - // TODO: Consider caching this list in the DB. + // @todo Consider caching this list in the DB. // Set static cache. $this->all_product_bundles = array_map(function ($entity) { return $entity->id(); diff --git a/src/Entity/Storage/PurchasedPlanStorage.php b/src/Entity/Storage/PurchasedPlanStorage.php index 148a8c57..d4981160 100644 --- a/src/Entity/Storage/PurchasedPlanStorage.php +++ b/src/Entity/Storage/PurchasedPlanStorage.php @@ -19,16 +19,16 @@ namespace Drupal\apigee_m10n\Entity\Storage; -use Drupal\apigee_edge\Entity\Controller\EdgeEntityControllerInterface; -use Drupal\apigee_edge\Entity\Storage\EdgeEntityStorageBase; -use Drupal\apigee_m10n\Entity\PurchasedPlanInterface; -use Drupal\apigee_m10n\Entity\Storage\Controller\DeveloperAcceptedRatePlanSdkControllerProxyInterface; -use Drupal\apigee_m10n\Exception\UnexpectedValueException; use Drupal\Component\Datetime\TimeInterface; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\apigee_edge\Entity\Controller\EdgeEntityControllerInterface; +use Drupal\apigee_edge\Entity\Storage\EdgeEntityStorageBase; +use Drupal\apigee_m10n\Entity\PurchasedPlanInterface; +use Drupal\apigee_m10n\Entity\Storage\Controller\DeveloperAcceptedRatePlanSdkControllerProxyInterface; +use Drupal\apigee_m10n\Exception\UnexpectedValueException; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/src/Entity/Storage/PurchasedProductStorage.php b/src/Entity/Storage/PurchasedProductStorage.php index 7bdb78a1..da01029c 100755 --- a/src/Entity/Storage/PurchasedProductStorage.php +++ b/src/Entity/Storage/PurchasedProductStorage.php @@ -19,16 +19,15 @@ namespace Drupal\apigee_m10n\Entity\Storage; -use Drupal\apigee_edge\Entity\Controller\EdgeEntityControllerInterface; -use Drupal\apigee_edge\Entity\Storage\EdgeEntityStorageBase; -use Drupal\apigee_m10n\Entity\PurchasedProductInterface; -use Drupal\apigee_m10n\Entity\Storage\Controller\DeveloperAcceptedRatePlanXSdkControllerProxyInterface; -use Drupal\apigee_m10n\Exception\UnexpectedValueException; use Drupal\Component\Datetime\TimeInterface; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\apigee_edge\Entity\Controller\EdgeEntityControllerInterface; +use Drupal\apigee_edge\Entity\Storage\EdgeEntityStorageBase; +use Drupal\apigee_m10n\Entity\PurchasedProductInterface; +use Drupal\apigee_m10n\Entity\Storage\Controller\DeveloperAcceptedRatePlanXSdkControllerProxyInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/src/Entity/Storage/RatePlanStorage.php b/src/Entity/Storage/RatePlanStorage.php index 10571f57..b14f668d 100644 --- a/src/Entity/Storage/RatePlanStorage.php +++ b/src/Entity/Storage/RatePlanStorage.php @@ -20,16 +20,15 @@ namespace Drupal\apigee_m10n\Entity\Storage; use Apigee\Edge\Api\Monetization\Entity\RatePlanRevisionInterface; +use Drupal\Component\Datetime\TimeInterface; +use Drupal\Core\Cache\CacheBackendInterface; +use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface; +use Drupal\Core\Entity\EntityTypeInterface; use Drupal\apigee_edge\Entity\Controller\EdgeEntityControllerInterface; use Drupal\apigee_edge\Entity\Storage\EdgeEntityStorageBase; use Drupal\apigee_m10n\Entity\RatePlanInterface; use Drupal\apigee_m10n\Entity\Storage\Controller\RatePlanSdkControllerProxyInterface; use Drupal\apigee_m10n\Exception\InvalidRatePlanIdException; -use Drupal\apigee_m10n\Exception\SdkEntityLoadException; -use Drupal\Component\Datetime\TimeInterface; -use Drupal\Core\Cache\CacheBackendInterface; -use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface; -use Drupal\Core\Entity\EntityTypeInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/src/Entity/Storage/XProductStorage.php b/src/Entity/Storage/XProductStorage.php index c3cb17be..7a195d44 100755 --- a/src/Entity/Storage/XProductStorage.php +++ b/src/Entity/Storage/XProductStorage.php @@ -19,14 +19,12 @@ namespace Drupal\apigee_m10n\Entity\Storage; -use Drupal\apigee_edge\Entity\Controller\EdgeEntityControllerInterface; -use Drupal\apigee_edge\Entity\Storage\EdgeEntityStorageBase; -use Drupal\apigee_m10n\ApigeeSdkControllerFactoryAwareTrait; -use Drupal\apigee_m10n\Entity\Storage\Controller\XProductEntityControllerProxy; use Drupal\Component\Datetime\TimeInterface; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface; use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\apigee_edge\Entity\Controller\EdgeEntityControllerInterface; +use Drupal\apigee_edge\Entity\Storage\EdgeEntityStorageBase; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -119,7 +117,7 @@ public function getAvailablexProductByDeveloper($developer_id) { $this->invokeStorageLoadHook($entities); $this->setPersistentCache($entities); - // TODO: Consider caching this list in the DB. + // @todo Consider caching this list in the DB. // Set static cache. $this->xproduct_by_developer[$developer_id] = array_map(function ($entity) { return $entity->id(); @@ -153,7 +151,7 @@ public function loadAll() { $this->invokeStorageLoadHook($entities); $this->setPersistentCache($entities); - // TODO: Consider caching this list in the DB. + // @todo Consider caching this list in the DB. // Set static cache. $this->all_xproduct = array_map(function ($entity) { return $entity->id(); diff --git a/src/Entity/Storage/XRatePlanStorage.php b/src/Entity/Storage/XRatePlanStorage.php index 76623369..4a6e58ba 100755 --- a/src/Entity/Storage/XRatePlanStorage.php +++ b/src/Entity/Storage/XRatePlanStorage.php @@ -20,16 +20,15 @@ namespace Drupal\apigee_m10n\Entity\Storage; use Apigee\Edge\Api\ApigeeX\Entity\RatePlanRevisionInterface; +use Drupal\Component\Datetime\TimeInterface; +use Drupal\Core\Cache\CacheBackendInterface; +use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface; +use Drupal\Core\Entity\EntityTypeInterface; use Drupal\apigee_edge\Entity\Controller\EdgeEntityControllerInterface; use Drupal\apigee_edge\Entity\Storage\EdgeEntityStorageBase; use Drupal\apigee_m10n\Entity\Storage\Controller\XRatePlanSdkControllerProxyInterface; use Drupal\apigee_m10n\Entity\XRatePlanInterface; use Drupal\apigee_m10n\Exception\InvalidRatePlanIdException; -use Drupal\apigee_m10n\Exception\SdkEntityLoadException; -use Drupal\Component\Datetime\TimeInterface; -use Drupal\Core\Cache\CacheBackendInterface; -use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface; -use Drupal\Core\Entity\EntityTypeInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/src/Entity/XProduct.php b/src/Entity/XProduct.php index 00ff007c..857b1936 100755 --- a/src/Entity/XProduct.php +++ b/src/Entity/XProduct.php @@ -22,12 +22,12 @@ use Apigee\Edge\Api\ApigeeX\Entity\ApiProduct; use Apigee\Edge\Entity\EntityInterface as EdgeEntityInterface; use Apigee\Edge\Entity\Property\AttributesPropertyAwareTrait; +use Drupal\Core\Entity\EntityTypeInterface; use Drupal\apigee_edge\Entity\FieldableEdgeEntityBase; use Drupal\apigee_m10n\Entity\Property\DescriptionPropertyAwareDecoratorTrait; use Drupal\apigee_m10n\Entity\Property\DisplayNamePropertyAwareDecoratorTrait; use Drupal\apigee_m10n\Entity\Property\IdPropertyAwareDecoratorTrait; use Drupal\apigee_m10n\Entity\Property\NamePropertyAwareDecoratorTrait; -use Drupal\Core\Entity\EntityTypeInterface; use Drupal\user\UserInterface; /** diff --git a/src/Entity/XRatePlan.php b/src/Entity/XRatePlan.php index 3f875c89..054e95a8 100755 --- a/src/Entity/XRatePlan.php +++ b/src/Entity/XRatePlan.php @@ -20,7 +20,6 @@ namespace Drupal\apigee_m10n\Entity; use Apigee\Edge\Api\ApigeeX\Entity\RatePlan as MonetizationRatePlan; -use Apigee\Edge\Api\ApigeeX\Entity\RatePlanRevisionInterface; use Apigee\Edge\Api\ApigeeX\Entity\StandardRatePlan; use Apigee\Edge\Api\ApigeeX\Structure\ConsumptionPricingRate; use Apigee\Edge\Api\ApigeeX\Structure\FixedRecurringFee; @@ -30,6 +29,8 @@ use Apigee\Edge\Api\Monetization\Entity\DeveloperInterface; use Apigee\Edge\Api\Monetization\Entity\DeveloperRatePlanInterface; use Apigee\Edge\Entity\EntityInterface as EdgeEntityInterface; +use Drupal\Core\Cache\Cache; +use Drupal\Core\Entity\EntityTypeInterface; use Drupal\apigee_edge\Entity\FieldableEdgeEntityBase; use Drupal\apigee_m10n\Entity\Property\ApiXProductPropertyAwareDecoratorTrait; use Drupal\apigee_m10n\Entity\Property\BillingPeriodPropertyAwareDecoratorTrait; @@ -45,8 +46,6 @@ use Drupal\apigee_m10n\Entity\Property\RevenueShareTypePropertyAwareDecoratorTrait; use Drupal\apigee_m10n\Entity\Property\StartTimePropertyAwareDecoratorTrait; use Drupal\apigee_m10n\Entity\Property\XPackagePropertyAwareDecoratorTrait; -use Drupal\Core\Cache\Cache; -use Drupal\Core\Entity\EntityTypeInterface; use Drupal\user\Entity\User; /** diff --git a/src/EventSubscriber/ValidateMonetizationEnabledSubscriber.php b/src/EventSubscriber/ValidateMonetizationEnabledSubscriber.php index bb23a8d2..aa45cb9f 100644 --- a/src/EventSubscriber/ValidateMonetizationEnabledSubscriber.php +++ b/src/EventSubscriber/ValidateMonetizationEnabledSubscriber.php @@ -19,9 +19,9 @@ namespace Drupal\apigee_m10n\EventSubscriber; +use Drupal\Core\Messenger\MessengerInterface; use Drupal\apigee_m10n\Monetization; use Drupal\apigee_m10n\MonetizationInterface; -use Drupal\Core\Messenger\MessengerInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\KernelEvents; diff --git a/src/Form/BillingDetailsForm.php b/src/Form/BillingDetailsForm.php index 987042fd..69f99e95 100644 --- a/src/Form/BillingDetailsForm.php +++ b/src/Form/BillingDetailsForm.php @@ -20,7 +20,6 @@ namespace Drupal\apigee_m10n\Form; use Apigee\Edge\Api\Monetization\Controller\DeveloperControllerInterface; -use Drupal\apigee_edge\Entity\Developer; use Drupal\Core\Access\AccessResult; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; @@ -28,6 +27,7 @@ use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\apigee_edge\Entity\Developer; use Drupal\user\UserInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -136,7 +136,7 @@ public function getFormId() { /** * {@inheritdoc} */ - public function buildForm(array $form, FormStateInterface $form_state, UserInterface $user = NULL) { + public function buildForm(array $form, FormStateInterface $form_state, ?UserInterface $user = NULL) { $this->developer = Developer::load($user->getEmail()); // Load the mint developer to retrieve legal name and billing type. diff --git a/src/Form/PrepaidBalanceConfigForm.php b/src/Form/PrepaidBalanceConfigForm.php index dd50dc69..d8160d52 100644 --- a/src/Form/PrepaidBalanceConfigForm.php +++ b/src/Form/PrepaidBalanceConfigForm.php @@ -18,12 +18,12 @@ namespace Drupal\apigee_m10n\Form; -use Drupal\apigee_m10n\Controller\PrepaidBalanceControllerInterface; use Drupal\Core\Cache\Cache; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Datetime\DateFormatterInterface; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\FormStateInterface; +use Drupal\apigee_m10n\Controller\PrepaidBalanceControllerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/src/Form/PrepaidBalanceReportsDownloadForm.php b/src/Form/PrepaidBalanceReportsDownloadForm.php index 3468e026..1a2059b3 100644 --- a/src/Form/PrepaidBalanceReportsDownloadForm.php +++ b/src/Form/PrepaidBalanceReportsDownloadForm.php @@ -20,10 +20,10 @@ namespace Drupal\apigee_m10n\Form; use Apigee\Edge\Exception\ClientErrorException; -use Drupal\apigee_m10n\MonetizationInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; +use Drupal\apigee_m10n\MonetizationInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Response; @@ -68,7 +68,7 @@ public function getFormId() { /** * {@inheritdoc} */ - public function buildForm(array $form, FormStateInterface $form_state, EntityInterface $entity = NULL, array $supported_currencies = []) { + public function buildForm(array $form, FormStateInterface $form_state, ?EntityInterface $entity = NULL, array $supported_currencies = []) { $form['heading'] = [ '#type' => 'html_tag', '#tag' => 'h3', diff --git a/src/Form/ReportsDownloadForm.php b/src/Form/ReportsDownloadForm.php index 004ccbb8..2b37f348 100644 --- a/src/Form/ReportsDownloadForm.php +++ b/src/Form/ReportsDownloadForm.php @@ -31,7 +31,7 @@ class ReportsDownloadForm extends ReportsDownloadFormBase { /** * {@inheritdoc} */ - public function buildForm(array $form, FormStateInterface $form_state, UserInterface $user = NULL) { + public function buildForm(array $form, FormStateInterface $form_state, ?UserInterface $user = NULL) { return $this->getForm($form, $form_state, $user); } diff --git a/src/Form/ReportsDownloadFormBase.php b/src/Form/ReportsDownloadFormBase.php index eefb2dc8..b63ed7d0 100644 --- a/src/Form/ReportsDownloadFormBase.php +++ b/src/Form/ReportsDownloadFormBase.php @@ -22,8 +22,6 @@ use Apigee\Edge\Api\Monetization\Structure\Reports\Criteria\RevenueReportCriteria; use Apigee\Edge\Exception\ClientErrorException; -use Drupal\apigee_m10n\ApigeeSdkControllerFactoryInterface; -use Drupal\apigee_m10n\MonetizationInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Datetime\DrupalDateTime; @@ -33,6 +31,8 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\apigee_m10n\ApigeeSdkControllerFactoryInterface; +use Drupal\apigee_m10n\MonetizationInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Response; @@ -267,7 +267,7 @@ public function access(RouteMatchInterface $route_match, AccountInterface $accou /** * Returns a CSV string for revenue. * - * TODO: Refactor this to an MonetizationInterface. + * @todo Refactor this to an MonetizationInterface. * * @param string $developer_id * The developer id. diff --git a/src/Monetization.php b/src/Monetization.php index b2b996ef..665c404e 100755 --- a/src/Monetization.php +++ b/src/Monetization.php @@ -29,15 +29,7 @@ use Apigee\Edge\Api\Monetization\Entity\TermsAndConditionsInterface; use Apigee\Edge\Api\Monetization\Structure\LegalEntityTermsAndConditionsHistoryItem; use Apigee\Edge\Api\Monetization\Structure\Reports\Criteria\PrepaidBalanceReportCriteria; -use Apigee\Edge\Api\Monetization\Structure\Reports\Criteria\RevenueReportCriteria; use CommerceGuys\Intl\Formatter\CurrencyFormatterInterface; -use Drupal\apigee_edge\Entity\Controller\OrganizationControllerInterface; -use Drupal\apigee_edge\SDKConnectorInterface; -use Drupal\apigee_m10n\Entity\PurchasedPlan; -use Drupal\apigee_m10n\Entity\PurchasedProduct; -use Drupal\apigee_m10n\Entity\RatePlanInterface; -use Drupal\apigee_m10n\Entity\XRatePlanInterface; -use Drupal\apigee_m10n\Exception\SdkEntityLoadException; use Drupal\Core\Access\AccessResult; use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Cache\CacheBackendInterface; @@ -45,6 +37,13 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\apigee_edge\Entity\Controller\OrganizationControllerInterface; +use Drupal\apigee_edge\SDKConnectorInterface; +use Drupal\apigee_m10n\Entity\PurchasedPlan; +use Drupal\apigee_m10n\Entity\PurchasedProduct; +use Drupal\apigee_m10n\Entity\RatePlanInterface; +use Drupal\apigee_m10n\Entity\XRatePlanInterface; +use Drupal\apigee_m10n\Exception\SdkEntityLoadException; use Drupal\user\PermissionHandlerInterface; use Drupal\user\RoleInterface; use Drupal\user\UserInterface; @@ -268,7 +267,7 @@ public function isLatestTermsAndConditionAccepted(string $developer_id): ?bool { if (!($latest_tnc = $this->getLatestTermsAndConditions())) { // If there isn't a latest TnC, and there was no error, there shouldn't be // anything to accept. - // TODO: Add a test for an org with no TnC defined. + // @todo Add a test for an org with no TnC defined. return TRUE; } // Check the cache table. @@ -481,7 +480,7 @@ public function getPrepaidBalanceReport(string $developer_id, \DateTimeImmutable */ public function isDeveloperAlreadySubscribed(string $developer_id, RatePlanInterface $rate_plan): bool { // Use cached result if available. - // TODO: Handle purchased_plan caching per developer on the storage level. + // @todo Handle purchased_plan caching per developer on the storage level. // See: \Drupal\apigee_m10n\Entity\Storage\PurchasedPlanStorage::loadByDeveloperId() $cid = "apigee_m10n:dev:purchased_plans:{$developer_id}"; if ($cache = $this->cache->get($cid)) { diff --git a/src/MonetizationInterface.php b/src/MonetizationInterface.php index 7aa83741..75a3d412 100755 --- a/src/MonetizationInterface.php +++ b/src/MonetizationInterface.php @@ -25,12 +25,12 @@ use Apigee\Edge\Api\Monetization\Entity\CompanyInterface; use Apigee\Edge\Api\Monetization\Entity\TermsAndConditionsInterface; use Apigee\Edge\Api\Monetization\Structure\LegalEntityTermsAndConditionsHistoryItem; -use Drupal\apigee_m10n\Entity\RatePlanInterface; -use Drupal\apigee_m10n\Entity\XRatePlanInterface; use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\apigee_m10n\Entity\RatePlanInterface; +use Drupal\apigee_m10n\Entity\XRatePlanInterface; use Drupal\user\RoleInterface; use Drupal\user\UserInterface; diff --git a/src/Plugin/Field/FieldFormatter/ConsumptionPricingRatesFormatter.php b/src/Plugin/Field/FieldFormatter/ConsumptionPricingRatesFormatter.php index f091b05a..9ff1291b 100755 --- a/src/Plugin/Field/FieldFormatter/ConsumptionPricingRatesFormatter.php +++ b/src/Plugin/Field/FieldFormatter/ConsumptionPricingRatesFormatter.php @@ -19,7 +19,6 @@ namespace Drupal\apigee_m10n\Plugin\Field\FieldFormatter; -use Apigee\Edge\Api\ApigeeX\Structure\Fee; use Drupal\Core\Field\FieldItemInterface; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FormatterBase; @@ -60,7 +59,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function settingsSummary() { - // @todo: Implement settings summary. + // @todo Implement settings summary. $summary = []; return $summary; diff --git a/src/Plugin/Field/FieldFormatter/FixedRecurringFeeFormatter.php b/src/Plugin/Field/FieldFormatter/FixedRecurringFeeFormatter.php index f7cdf1e5..43fe915f 100755 --- a/src/Plugin/Field/FieldFormatter/FixedRecurringFeeFormatter.php +++ b/src/Plugin/Field/FieldFormatter/FixedRecurringFeeFormatter.php @@ -59,7 +59,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function settingsSummary() { - // @todo: Implement settings summary. + // @todo Implement settings summary. $summary = []; return $summary; diff --git a/src/Plugin/Field/FieldFormatter/PurchasePlanFormFormatter.php b/src/Plugin/Field/FieldFormatter/PurchasePlanFormFormatter.php index a1cb6a41..a9a2f899 100644 --- a/src/Plugin/Field/FieldFormatter/PurchasePlanFormFormatter.php +++ b/src/Plugin/Field/FieldFormatter/PurchasePlanFormFormatter.php @@ -20,8 +20,6 @@ namespace Drupal\apigee_m10n\Plugin\Field\FieldFormatter; use Apigee\Edge\Api\Monetization\Entity\Developer; -use Drupal\apigee_m10n\Entity\PurchasedPlan; -use Drupal\apigee_m10n\Monetization; use Drupal\Core\Entity\EntityFormBuilderInterface; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldItemInterface; @@ -29,6 +27,8 @@ use Drupal\Core\Field\FormatterBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; +use Drupal\apigee_m10n\Entity\PurchasedPlan; +use Drupal\apigee_m10n\Monetization; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -156,7 +156,7 @@ protected function viewValue(FieldItemInterface $item) { $start_date->setTimezone($org_timezone); $purchased_plan = PurchasedPlan::create([ 'ratePlan' => $rate_plan, - // TODO: User a controller proxy that caches the developer entity. + // @todo User a controller proxy that caches the developer entity. // @see: https://github.com/apigee/apigee-edge-drupal/pull/97. 'developer' => new Developer(['email' => $developer_id]), 'startDate' => $start_date, diff --git a/src/Plugin/Field/FieldFormatter/PurchasePlanLinkFormatter.php b/src/Plugin/Field/FieldFormatter/PurchasePlanLinkFormatter.php index 06b0bd36..50671cce 100644 --- a/src/Plugin/Field/FieldFormatter/PurchasePlanLinkFormatter.php +++ b/src/Plugin/Field/FieldFormatter/PurchasePlanLinkFormatter.php @@ -19,7 +19,6 @@ namespace Drupal\apigee_m10n\Plugin\Field\FieldFormatter; -use Drupal\apigee_m10n\Monetization; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldItemInterface; use Drupal\Core\Field\FieldItemListInterface; @@ -27,6 +26,7 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Link; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; +use Drupal\apigee_m10n\Monetization; use Symfony\Component\DependencyInjection\ContainerInterface; /** diff --git a/src/Plugin/Field/FieldFormatter/PurchaseProductFormFormatter.php b/src/Plugin/Field/FieldFormatter/PurchaseProductFormFormatter.php index f20ae1bb..a9829b22 100644 --- a/src/Plugin/Field/FieldFormatter/PurchaseProductFormFormatter.php +++ b/src/Plugin/Field/FieldFormatter/PurchaseProductFormFormatter.php @@ -20,8 +20,6 @@ namespace Drupal\apigee_m10n\Plugin\Field\FieldFormatter; use Apigee\Edge\Api\Monetization\Entity\Developer; -use Drupal\apigee_m10n\Entity\PurchasedProduct; -use Drupal\apigee_m10n\Monetization; use Drupal\Core\Entity\EntityFormBuilderInterface; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldItemInterface; @@ -29,6 +27,8 @@ use Drupal\Core\Field\FormatterBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; +use Drupal\apigee_m10n\Entity\PurchasedProduct; +use Drupal\apigee_m10n\Monetization; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -154,7 +154,7 @@ protected function viewValue(FieldItemInterface $item) { $developer_id = $value['user']->getEmail(); $purchased_product = PurchasedProduct::create([ 'xratePlan' => $rate_plan, - // TODO: User a controller proxy that caches the developer entity. + // @todo User a controller proxy that caches the developer entity. // @see: https://github.com/apigee/apigee-edge-drupal/pull/97. 'developer' => new Developer(['email' => $developer_id]), ]); diff --git a/src/Plugin/Field/FieldFormatter/RatePlanDetailsFormatter.php b/src/Plugin/Field/FieldFormatter/RatePlanDetailsFormatter.php index 589e2e7c..da631f87 100644 --- a/src/Plugin/Field/FieldFormatter/RatePlanDetailsFormatter.php +++ b/src/Plugin/Field/FieldFormatter/RatePlanDetailsFormatter.php @@ -61,7 +61,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function settingsSummary() { - // @todo: Implement settings summary. + // @todo Implement settings summary. $summary = []; return $summary; diff --git a/src/Plugin/Field/FieldFormatter/RatePlanXFeeFormatter.php b/src/Plugin/Field/FieldFormatter/RatePlanXFeeFormatter.php index 464a8ff2..20bbad86 100755 --- a/src/Plugin/Field/FieldFormatter/RatePlanXFeeFormatter.php +++ b/src/Plugin/Field/FieldFormatter/RatePlanXFeeFormatter.php @@ -59,7 +59,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function settingsSummary() { - // @todo: Implement settings summary. + // @todo Implement settings summary. $summary = []; return $summary; diff --git a/src/Plugin/Field/FieldFormatter/RevenueShareRatesFormatter.php b/src/Plugin/Field/FieldFormatter/RevenueShareRatesFormatter.php index ace30155..b55d87af 100755 --- a/src/Plugin/Field/FieldFormatter/RevenueShareRatesFormatter.php +++ b/src/Plugin/Field/FieldFormatter/RevenueShareRatesFormatter.php @@ -59,7 +59,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function settingsSummary() { - // @todo: Implement settings summary. + // @todo Implement settings summary. $summary = []; return $summary; diff --git a/src/Plugin/Field/FieldFormatter/TermsAndConditionsFormatter.php b/src/Plugin/Field/FieldFormatter/TermsAndConditionsFormatter.php index 2ebcf235..eca0e5d1 100644 --- a/src/Plugin/Field/FieldFormatter/TermsAndConditionsFormatter.php +++ b/src/Plugin/Field/FieldFormatter/TermsAndConditionsFormatter.php @@ -42,7 +42,7 @@ public function viewElements(FieldItemListInterface $items, $langcode) { $elements = []; foreach ($items as $delta => $item) { $elements[$delta] = [ - '#markup' => $item->value ? $this->t('Accepted') : $this->t('Declined') + '#markup' => $item->value ? $this->t('Accepted') : $this->t('Declined'), ]; } return $elements; diff --git a/src/Plugin/Field/FieldType/ConsumptionPricingRatesFieldItem.php b/src/Plugin/Field/FieldType/ConsumptionPricingRatesFieldItem.php index bc99befd..9c2c01a4 100755 --- a/src/Plugin/Field/FieldType/ConsumptionPricingRatesFieldItem.php +++ b/src/Plugin/Field/FieldType/ConsumptionPricingRatesFieldItem.php @@ -73,7 +73,7 @@ public static function generateSampleValue(FieldDefinitionInterface $field_defin 'units' => rand(5, 20), 'nanos' => rand(5, 20), ]), - ] + ], ]); return $values; diff --git a/src/Plugin/Field/FieldWidget/TermsAndConditionsWidget.php b/src/Plugin/Field/FieldWidget/TermsAndConditionsWidget.php index 1399351e..c416438e 100644 --- a/src/Plugin/Field/FieldWidget/TermsAndConditionsWidget.php +++ b/src/Plugin/Field/FieldWidget/TermsAndConditionsWidget.php @@ -19,13 +19,13 @@ namespace Drupal\apigee_m10n\Plugin\Field\FieldWidget; -use Drupal\apigee_m10n\MonetizationInterface; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\WidgetBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Url; +use Drupal\apigee_m10n\MonetizationInterface; use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -81,7 +81,7 @@ class TermsAndConditionsWidget extends WidgetBase implements ContainerFactoryPlu * @param \Drupal\apigee_m10n\MonetizationInterface $monetization * Monetization factory. */ - public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, LoggerInterface $logger, MonetizationInterface $monetization = NULL) { + public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, LoggerInterface $logger, ?MonetizationInterface $monetization = NULL) { parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings); $this->monetization = $monetization; $this->logger = $logger; diff --git a/src/Plugin/Menu/PlansPluginClass.php b/src/Plugin/Menu/PlansPluginClass.php index a5b1edd6..bb54642c 100644 --- a/src/Plugin/Menu/PlansPluginClass.php +++ b/src/Plugin/Menu/PlansPluginClass.php @@ -20,7 +20,6 @@ namespace Drupal\apigee_m10n\Plugin\Menu; use Drupal\Core\Menu\MenuLinkDefault; -use Drupal\Core\Url; /** * Represents a menu link for a listing and buying apis for 4G and 5G.