diff --git a/.github/workflows/php-test-workflow.yml b/.github/workflows/php-test-workflow.yml
index 4330eafca..e1227ab24 100644
--- a/.github/workflows/php-test-workflow.yml
+++ b/.github/workflows/php-test-workflow.yml
@@ -15,9 +15,17 @@ jobs:
dependencies-preference: " "
- php: '8.1'
dependencies-preference: "--prefer-lowest"
+ - php: '8.2'
+ dependencies-preference: " "
+ - php: '8.2'
+ dependencies-preference: "--prefer-lowest"
+ - php: '8.3'
+ dependencies-preference: " "
+ - php: '8.3'
+ dependencies-preference: "--prefer-lowest"
fail-fast: false
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PHP
@@ -32,7 +40,7 @@ jobs:
- name: Cache Composer packages
id: composer-cache
- uses: actions/cache@v2
+ uses: actions/cache@v4
with:
path: vendor
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('./composer.json') }}
@@ -60,8 +68,9 @@ jobs:
run: composer metrics
- name: Upload coverage to Codecov
- uses: codecov/codecov-action@v2
+ uses: codecov/codecov-action@v4
with:
+ token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: ./coverage.xml
flags: unittests
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
deleted file mode 100644
index ab88493b1..000000000
--- a/.github/workflows/stale.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-name: Mark stale issues and pull requests
-
-on:
- schedule:
- - cron: '05 00 * * *'
-
-jobs:
- stale:
-
- runs-on: ubuntu-latest
- permissions:
- issues: write
- pull-requests: write
-
- steps:
- - uses: actions/stale@v3
- with:
- repo-token: ${{ secrets.GITHUB_TOKEN }}
- stale-issue-message: >
- This issue has been automatically marked as stale because it has not had
- recent activity. It will be closed if no further activity occurs. Thank you
- for your contributions.
- stale-pr-message: >
- This pull request has been automatically marked as stale because it has not had
- recent activity. It will be closed if no further activity occurs. Thank you
- for your contributions.
- stale-issue-label: 'no-issue-activity'
- stale-pr-label: 'no-pr-activity'
diff --git a/.gitignore b/.gitignore
index 4fadd2dd0..2129f5a5e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,7 +11,7 @@
/*.php
/*.xml
/*.log
-!/.php_cs.dist
+!/.php-cs-fixer.dist.php
!/psalm.xml.dist
!/phpunit.xml.dist
/vendor
diff --git a/.php_cs.dist b/.php-cs-fixer.dist.php
similarity index 67%
rename from .php_cs.dist
rename to .php-cs-fixer.dist.php
index 4005cb913..e39b5d80f 100644
--- a/.php_cs.dist
+++ b/.php-cs-fixer.dist.php
@@ -11,21 +11,25 @@
* added to the repo.
* @todo: Add a copyright validation (https://github.com/apigee/apigee-client-php/issues/81).
*/
-return PhpCsFixer\Config::create()
+$config = new PhpCsFixer\Config();
+
+$config
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
- 'class_definition' => ['singleLine' => false, 'singleItemSingleLine' => true],
+ 'class_definition' => ['single_line' => false, 'single_item_single_line' => true],
'concat_space' => ['spacing' => 'one'],
- 'general_phpdoc_annotation_remove' => ['author'],
+ 'general_phpdoc_annotation_remove' => ['annotations' => ['author']],
'ordered_class_elements' => true,
'ordered_imports' => true,
'phpdoc_align' => false,
'phpdoc_annotation_without_dot' => false,
'phpdoc_indent' => false,
- 'phpdoc_inline_tag' => false,
+ 'general_phpdoc_tag_rename' => false,
+ 'phpdoc_inline_tag_normalizer' => false,
+ 'phpdoc_tag_type' => false,
'phpdoc_order' => true,
// Disabled because fluent setters return type in an interface can not be self.
'self_accessor' => false,
@@ -34,8 +38,9 @@
'no_superfluous_phpdoc_tags' => false,
// Disabled because multiple lines allow code clarity.
'single_line_throw' => false,
- // Disabled because phpcs fails for php8.1 if there is '&' in the argument.
- // see https://github.com/apigee/apigee-client-php/issues/233
- 'function_typehint_space' => false,
+ 'global_namespace_import' => ['import_classes' => true, 'import_constants' => true, 'import_functions' => true],
+ 'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true]
])
->setFinder($finder);
+
+return $config;
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7486871fd..c6ed34c1e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,52 @@
# CHANGELOG
+## [3.0.9](https://github.com/apigee/apigee-client-php/milestone/34?closed=1)
+* [#409] Changed the getter and setter to camelcase function name.
+* [#420] Support for drz endpoint.
+
+## [3.0.8](https://github.com/apigee/apigee-client-php/milestone/32?closed=1)
+* [#379] Update option-resolver's symfony component version to its latest.
+
+## [3.0.7](https://github.com/apigee/apigee-client-php/milestone/31?closed=1)
+* [#374] Bump minimum required version of symfony/serializer.
+* [#376] Remove symfony/serializer conflict and bump version.
+
+## [3.0.6](https://github.com/apigee/apigee-client-php/milestone/30?closed=1)
+* [#371] Added support of AttributesProperty to ApiProduct.
+* [#369] PHP 8.3 version support added for Apigee Client PHP.
+* [#364] Fix for Uncaught TypeError: AppByOwnerController::responseArrayToArrayOfEntities()
+* [#365] Restricts Symfony update to 6.4.6 due to issue in latest version 6.4.7.
+
+## [3.0.5](https://github.com/apigee/apigee-client-php/milestone/29?closed=1)
+* [#351] Retrieving the next list items based on 'nextpagetoken' flag in Apigee X.
+* [#348] Fix for composer analyze failing in github action.
+
+## [3.0.4](https://github.com/apigee/apigee-client-php/milestone/28?closed=1)
+* [#343] Fix Invalid payload issue while editing/updating AppGroup/Teams in Apigee X.
+* [#342] Fix for test failing for symfony 6.4.
+* [#340] Fix for attribute values lost in PUT call while creating AppGroup.
+* [#337] Fix for Team app credentials listings sorted in ascending order.
+* [#334] Fix for \Apigee\Edge\HttpClient\Plugin\Authentication\GceServiceAccount::isAvailable() throws exception when called on non-GCE context.
+
+## [3.0.3](https://github.com/apigee/apigee-client-php/milestone/26?closed=1)
+* [#323] Add union type to suppress deprecation warning.
+* [#325] Fix error when AppGroup list is empty or do not returns appgroups array.
+
+## [3.0.2](https://github.com/apigee/apigee-client-php/milestone/24?closed=1)
+* [#314] Added method getSupportedTypes which is added in symfony 6.3.
+* [#316] PHPCS : Added import global namespace.
+* [#312] Bumped symfony version to 6.3.
+* [#310] Added support for psr/http-message >=2.0.
+* Added query parameters in PaginatedEntityListingControllerInterface.
+
+## [3.0.1](https://github.com/apigee/apigee-client-php/milestone/22?closed=1)
+* [#286] Support for PHP 8.2 and updated league/period library.
+* [#290] Upgraded friendsofphp/php-cs-fixer to ^3.22.
+* [#297] Extended AppGroup class from base class AppOwner.
+* [#298] Apigee X Teams with pagination.
+See [AppGroup-pagination] (https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.appgroups/list#query-parameters) for more information.
+* [#307] Apigee X Teams Apps with pagination.
+See [AppGroup-Apps-pagination] (https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.appgroups.apps/list#query-parameters) for more information.
+
## [3.0.0](https://github.com/apigee/apigee-client-php/milestone/21?closed=1)
* [#262] Support Symfony/Serializer minimum version 6.2 (Added support for Drupal 10)
* [#272] Update dependencies for Symfony/Serializer 6.2 and dropped support for Symfony/Serializer 4.4
diff --git a/README.md b/README.md
index 492a26c22..b91ba7447 100644
--- a/README.md
+++ b/README.md
@@ -4,16 +4,17 @@
[](https://codecov.io/gh/apigee/apigee-client-php/branch/2.x)
[](https://packagist.org/packages/apigee/apigee-client-php)
[](https://packagist.org/packages/apigee/apigee-client-php)
-[](https://php.net/)
+[](https://php.net/)
[](https://packagist.org/packages/apigee/apigee-client-php)
-The Apigee API Client Library for PHP makes it easy to develop PHP clients that call the Apigee Edge Management API. The
-Apigee API Client Library for PHP enables you to interact with the API using objects instead of coding to handle the
+The Apigee API Client Library for PHP makes it easy to develop PHP clients that call the Apigee Edge/ X Management API. The
+Apigee API Client Library for PHP enables you to interact with the API using objects instead of coding to handle the
HTTP request and response calls directly.
-Specifically, the Apigee API Client Library for PHP provides access to Apigee Edge Management APIs in the following
+Specifically, the Apigee API Client Library for PHP provides access to Apigee Edge and Apigee Management APIs in the following
categories:
+### Apigee Edge
* [API Products](https://apidocs.apigee.com/api/api-products-1)
* [Apps](https://apidocs.apigee.com/api/apps-0)
* [Apps: Company](https://apidocs.apigee.com/api/apps-company)
@@ -25,7 +26,18 @@ categories:
* [Developers](https://apidocs.apigee.com/api/developers-0)
* [Stats](https://apidocs.apigee.com/api/stats)
-For more information about the Apigee Edge Management APIs, see [Getting started with the API Edge Management APIs](https://apidocs.apigee.com/api-reference/content/api-reference-getting-started)
+### Apigee
+* [API Products](https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.apiproducts)
+* [Apps](https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.apps)
+* [Apps: AppGroup](https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.appgroups.apps)
+* [Apps: Developer](https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.developers.apps)
+* [AppGroup](https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.appgroups)
+* [AppGroup App Keys](https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.appgroups.apps.keys)
+* [Developer App Keys](https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.developers.apps.keys)
+* [Developers](https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.developers)
+* [Stats](https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments.stats)
+
+For more information about the Apigee Edge and Apigee Management APIs, see [Getting started with the Apigee Edge Management APIs](https://apidocs.apigee.com/api-reference/content/api-reference-getting-started) and [Getting started with the Apigee Management APIs](https://cloud.google.com/apigee/docs/api-platform/get-started/api-get-started)
in the Apigee documentation.
The Apigee API Client Library for PHP, built using the HTTPlug library, provides an HTTP client
diff --git a/composer.json b/composer.json
index ca7777829..a8b47d158 100644
--- a/composer.json
+++ b/composer.json
@@ -13,13 +13,13 @@
"homepage": "http://github.com/apigee/apigee-client-php",
"license": "Apache-2.0",
"require": {
- "php": "~8.1",
+ "php": "~8.1 || ~8.2 || ~8.3",
"ext-json": "*",
"ext-openssl": "*",
"ext-reflection": "*",
"fightbulc/moment": "^1.26",
"firebase/php-jwt": "^6.0",
- "league/period": "^4.12",
+ "league/period": "^5.2",
"php-http/client-common": "^2.0",
"php-http/client-implementation": "^1.0",
"php-http/discovery": "^1.18",
@@ -27,15 +27,15 @@
"php-http/message": "^1.13",
"php-http/message-factory": "^1.0",
"phpdocumentor/reflection-docblock": "^5.0",
- "psr/http-message": "^1.0",
- "symfony/options-resolver": "^5.4",
- "symfony/property-access": "^6.2",
- "symfony/property-info": "^6.2",
- "symfony/serializer": "^6.2"
+ "psr/http-message": "^1.0 || ^2.0",
+ "symfony/options-resolver": "^6.4.8",
+ "symfony/property-access": "^6.4.9",
+ "symfony/property-info": "^6.4.9",
+ "symfony/serializer": "^6.4.9"
},
"require-dev": {
"dms/phpunit-arraysubset-asserts": "^0.4.0",
- "friendsofphp/php-cs-fixer": "^2.19",
+ "friendsofphp/php-cs-fixer": "^3.87",
"fzaninotto/faker": "^1.7",
"guzzlehttp/psr7": "^2.5",
"league/flysystem": "^1.0",
@@ -46,8 +46,8 @@
"phpmetrics/phpmetrics": "^2.7",
"phpunit/phpunit": "^9.6",
"sebastian/comparator": "^4.0.5",
- "symfony/cache": "~5.0",
- "vimeo/psalm": "^5.12"
+ "symfony/cache": "^6.4.9",
+ "vimeo/psalm": "^5.20"
},
"autoload": {
"psr-4": {
@@ -78,8 +78,8 @@
"analyze": "vendor/vimeo/psalm/psalm --config=psalm.xml.dist --show-info=false --stats",
"metrics": "vendor/bin/phpmetrics .",
"metrics-html": "vendor/bin/phpmetrics . --report-html=report",
- "check-style": "vendor/bin/php-cs-fixer fix --config=./.php_cs.dist --verbose --dry-run",
- "fix-style": "vendor/bin/php-cs-fixer fix --config=./.php_cs.dist"
+ "check-style": "vendor/bin/php-cs-fixer fix --config=./.php-cs-fixer.dist.php --verbose --dry-run",
+ "fix-style": "vendor/bin/php-cs-fixer fix --config=./.php-cs-fixer.dist.php"
},
"extra": {
"branch-alias": {
diff --git a/examples/authentication.inc b/examples/authentication.inc
index c676645f6..c36ab945b 100644
--- a/examples/authentication.inc
+++ b/examples/authentication.inc
@@ -99,16 +99,16 @@ class ClientFactory
/** @var string|null */
private $endpoint;
- /** @var \CredentialProvider */
+ /** @var CredentialProvider */
private $credential;
- /** @var \Apigee\Edge\ClientInterface|null */
+ /** @var ClientInterface|null */
private $client;
/**
* ClientFactory constructor.
*
- * @param \CredentialProvider $credential
+ * @param CredentialProvider $credential
* Apigee Edge credentials.
* @param string|null $endpoint
* Apigee Edge endpoint, if null it falls back to the url of Apigee Edge cloud.
@@ -122,7 +122,7 @@ class ClientFactory
/**
* Returns a configured API client.
*
- * @return \Apigee\Edge\ClientInterface
+ * @return ClientInterface
*/
public function getClient(): ClientInterface
{
diff --git a/examples/create_new_app_with_credential.php b/examples/create_new_app_with_credential.php
index 71881d50d..09820c0e3 100644
--- a/examples/create_new_app_with_credential.php
+++ b/examples/create_new_app_with_credential.php
@@ -33,7 +33,7 @@
try {
// Create a new developer app.
- /** @var \Apigee\Edge\Api\Management\Entity\DeveloperApp $developerApp */
+ /** @var DeveloperApp $developerApp */
$developerApp = new DeveloperApp(['name' => 'test_app_1']);
$developerApp->setDisplayName('My first app');
$developerApp->setAttributes(new AttributesProperty(['bar' => 'baz']));
@@ -46,7 +46,7 @@
// Add products, attributes, and scopes to the auto-generated credential that was created along with the app.
$credentials = $developerApp->getCredentials();
- /** @var \Apigee\Edge\Api\Management\Entity\AppCredential $credential */
+ /** @var Apigee\Edge\Api\Management\Entity\AppCredential $credential */
$credential = reset($credentials);
$dacc->addProducts($credential->id(), $apiProducts);
$dacc->updateAttributes($credential->id(), $credAttributes);
diff --git a/examples/developer_app_analytics.php b/examples/developer_app_analytics.php
index c387c1a6c..849ffd578 100644
--- a/examples/developer_app_analytics.php
+++ b/examples/developer_app_analytics.php
@@ -33,7 +33,7 @@
try {
$dc = new DeveloperController($clientFactory->getOrganization(), $clientFactory->getClient());
- /** @var \Apigee\Edge\Api\Management\Entity\DeveloperInterface $developer */
+ /** @var Apigee\Edge\Api\Management\Entity\DeveloperInterface $developer */
$developer = $dc->load($developerMail);
} catch (ClientErrorException $e) {
// HTTP code >= 400 and < 500. Ex.: 401 Unauthorised.
@@ -52,7 +52,7 @@
// Anything else, because this is the parent class of all the above.
}
-$sc = new \Apigee\Edge\Api\Management\Controller\StatsController($environment, $clientFactory->getOrganization(), $clientFactory->getClient());
+$sc = new Apigee\Edge\Api\Management\Controller\StatsController($environment, $clientFactory->getOrganization(), $clientFactory->getClient());
// Read more about Period library usage here: http://period.thephpleague.com/3.0
$q = new StatsQuery(['total_response_time'], new Period('now - 7 days', 'now'));
$q->setFilter("(developer_email eq '{$developer->getEmail()}' and developer_app eq '{$developerAppName}')")
diff --git a/examples/list_multiple_entities.php b/examples/list_multiple_entities.php
index d034f661d..3de31b21b 100644
--- a/examples/list_multiple_entities.php
+++ b/examples/list_multiple_entities.php
@@ -28,7 +28,7 @@
* List all developers on the organization.
*/
$dc = new DeveloperController($clientFactory->getOrganization(), $clientFactory->getClient());
-/** @var \Apigee\Edge\Api\Management\Entity\DeveloperInterface $developer */
+/** @var Apigee\Edge\Api\Management\Entity\DeveloperInterface $developer */
foreach ($dc->getEntities() as $developer) {
echo $developer->getFirstName() . ' ' . $developer->getLastName() . "\n";
}
@@ -76,7 +76,7 @@
* In the SDK anything that implements \Apigee\Edge\Controller\NonCpsListingEntityControllerInterface.
*/
$ac = new ApiProductController($clientFactory->getOrganization(), $clientFactory->getClient());
-/** @var \Apigee\Edge\Api\Management\Entity\ApiProductInterface $product */
+/** @var Apigee\Edge\Api\Management\Entity\ApiProductInterface $product */
foreach ($ac->getEntities() as $product) {
echo $product->getDisplayName() . "\n";
}
diff --git a/psalm.xml.dist b/psalm.xml.dist
index b05821456..065e811dd 100644
--- a/psalm.xml.dist
+++ b/psalm.xml.dist
@@ -52,5 +52,8 @@
+
+
+
diff --git a/src/Api/ApigeeX/Controller/AcceptedRatePlanController.php b/src/Api/ApigeeX/Controller/AcceptedRatePlanController.php
index c241613c0..29f19c564 100755
--- a/src/Api/ApigeeX/Controller/AcceptedRatePlanController.php
+++ b/src/Api/ApigeeX/Controller/AcceptedRatePlanController.php
@@ -39,8 +39,8 @@ abstract class AcceptedRatePlanController extends OrganizationAwareEntityControl
* AcceptedRatePlanController constructor.
*
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
@@ -59,7 +59,7 @@ public function getAllAcceptedRatePlans(): array
/**
* {@inheritdoc}
*/
- public function getPaginatedAcceptedRatePlanList(int $limit = null, int $page = 1): array
+ public function getPaginatedAcceptedRatePlanList(?int $limit = null, int $page = 1): array
{
$query_params = [
'page' => $page,
@@ -78,7 +78,7 @@ public function getPaginatedAcceptedRatePlanList(int $limit = null, int $page =
public function acceptRatePlan(RatePlanInterface $ratePlan): AcceptedRatePlanInterface
{
$rc = new ReflectionClass($this->getEntityClass());
- /** @var \Apigee\Edge\Api\ApigeeX\Entity\AcceptedRatePlanInterface $acceptedRatePlan */
+ /** @var AcceptedRatePlanInterface $acceptedRatePlan */
$acceptedRatePlan = $rc->newInstance(
[
'ratePlan' => $ratePlan,
@@ -124,7 +124,7 @@ abstract protected function buildContextForEntityTransformerInCreate(): array;
* has more than one listing endpoint so getBaseEntityEndpoint() was
* enough until this time.
*
- * @return \Psr\Http\Message\UriInterface
+ * @return UriInterface
*/
abstract protected function getAcceptedRatePlansEndpoint(): UriInterface;
diff --git a/src/Api/ApigeeX/Controller/AcceptedRatePlanControllerInterface.php b/src/Api/ApigeeX/Controller/AcceptedRatePlanControllerInterface.php
index 584f6b491..07971226c 100755
--- a/src/Api/ApigeeX/Controller/AcceptedRatePlanControllerInterface.php
+++ b/src/Api/ApigeeX/Controller/AcceptedRatePlanControllerInterface.php
@@ -47,22 +47,22 @@ public function getAllAcceptedRatePlans(): array;
*
* @return \Apigee\Edge\Api\ApigeeX\Entity\AcceptedRatePlanInterface[]
*/
- public function getPaginatedAcceptedRatePlanList(int $limit = null, int $page = 1): array;
+ public function getPaginatedAcceptedRatePlanList(?int $limit = null, int $page = 1): array;
/**
* Accepts a rate plan.
*
- * @param \Apigee\Edge\Api\ApigeeX\Entity\RatePlanInterface $ratePlan
+ * @param RatePlanInterface $ratePlan
* The rate plan to be accepted.
*
- * @return \Apigee\Edge\Api\ApigeeX\Entity\AcceptedRatePlanInterface
+ * @return AcceptedRatePlanInterface
*/
public function acceptRatePlan(RatePlanInterface $ratePlan): AcceptedRatePlanInterface;
/**
* Update a rate plan that has been accepted by a developer.
*
- * @param \Apigee\Edge\Api\ApigeeX\Entity\AcceptedRatePlanInterface $acceptedRatePlan
+ * @param AcceptedRatePlanInterface $acceptedRatePlan
* Previously accepted rate plan that should be modified.
*/
public function updateSubscription(AcceptedRatePlanInterface $acceptedRatePlan): void;
diff --git a/src/Api/ApigeeX/Controller/ApiProductController.php b/src/Api/ApigeeX/Controller/ApiProductController.php
index ad51b2c3b..696eb99a9 100755
--- a/src/Api/ApigeeX/Controller/ApiProductController.php
+++ b/src/Api/ApigeeX/Controller/ApiProductController.php
@@ -44,7 +44,7 @@ class ApiProductController extends OrganizationAwareEntityController implements
*
* @param string $organization
* @param ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
@@ -123,7 +123,7 @@ private function getEligibleProducts(string $type, string $entityId): array
$subscribed_product_ids = [];
if ('developers' == $type) {
// Developer subscriptions.
- /** @var \Apigee\Edge\Api\ApigeeX\Controller\DeveloperAcceptedRatePlanController $dev_accepted_rateplan */
+ /** @var DeveloperAcceptedRatePlanController $dev_accepted_rateplan */
$dev_accepted_rateplan = new DeveloperAcceptedRatePlanController($entityId, $this->organization, $this->client);
$subscriptions = $dev_accepted_rateplan->getAllAcceptedRatePlans();
@@ -138,7 +138,7 @@ private function getEligibleProducts(string $type, string $entityId): array
foreach ($this->getAvailablexApiProducts($type, $entityId, true) as $item) {
// Create a new rate plan controller.
- /** @var \Apigee\Edge\Api\ApigeeX\Controller\RatePlanController $rateplan */
+ /** @var RatePlanController $rateplan */
$rateplan = new RatePlanController($item->id(), $this->organization, $this->client);
if (empty($rateplan->getEntities())) {
@@ -150,7 +150,7 @@ private function getEligibleProducts(string $type, string $entityId): array
} else {
foreach ($rateplan->getEntities() as $plan) {
if (null !== $plan->getendTime() && $plan->getendTime() < $current_ms) {
- //Free product - No active rateplan
+ // Free product - No active rateplan
$products[$item->id()] = $item;
}
}
diff --git a/src/Api/ApigeeX/Controller/AppByOwnerController.php b/src/Api/ApigeeX/Controller/AppByOwnerController.php
new file mode 100644
index 000000000..83a0b1677
--- /dev/null
+++ b/src/Api/ApigeeX/Controller/AppByOwnerController.php
@@ -0,0 +1,53 @@
+listEntityIds($pager, []);
}
@@ -85,7 +85,7 @@ public function listAppIds(PagerInterface $pager = null): array
/**
* {@inheritdoc}
*/
- public function listApps(bool $includeCredentials = true, PagerInterface $pager = null): array
+ public function listApps(bool $includeCredentials = true, ?PagerInterface $pager = null): array
{
$queryParams = [
'includeCred' => $includeCredentials ? 'true' : 'false',
@@ -97,7 +97,7 @@ public function listApps(bool $includeCredentials = true, PagerInterface $pager
/**
* {@inheritdoc}
*/
- public function listAppIdsByStatus(string $status, PagerInterface $pager = null): array
+ public function listAppIdsByStatus(string $status, ?PagerInterface $pager = null): array
{
$queryParams = [
'status' => $status,
@@ -112,7 +112,7 @@ public function listAppIdsByStatus(string $status, PagerInterface $pager = null)
public function listAppsByStatus(
string $status,
bool $includeCredentials = true,
- PagerInterface $pager = null
+ ?PagerInterface $pager = null,
): array {
$queryParams = [
'status' => $status,
@@ -125,7 +125,7 @@ public function listAppsByStatus(
/**
* {@inheritdoc}
*/
- public function listAppIdsByType(string $appType, PagerInterface $pager = null): array
+ public function listAppIdsByType(string $appType, ?PagerInterface $pager = null): array
{
$queryParams = [
'apptype' => $appType,
@@ -156,9 +156,9 @@ protected function getEntityClass(): string
* {@inheritdoc}
*/
protected function listEntities(
- PagerInterface $pager = null,
+ ?PagerInterface $pager = null,
array $query_params = [],
- string $idGetter = null
+ ?string $idGetter = null,
): array {
$idGetter = $idGetter ?? static::ID_GETTER;
diff --git a/src/Api/ApigeeX/Controller/AppControllerInterface.php b/src/Api/ApigeeX/Controller/AppControllerInterface.php
index 99a63a15f..dc9f7f275 100644
--- a/src/Api/ApigeeX/Controller/AppControllerInterface.php
+++ b/src/Api/ApigeeX/Controller/AppControllerInterface.php
@@ -58,7 +58,7 @@ interface AppControllerInterface extends PaginatedEntityControllerInterface, Ent
* @param string $appId
* UUID of an app (appId).
*
- * @return \Apigee\Edge\Api\Management\Entity\AppInterface
+ * @return AppInterface
* A developer- or a appgroup app entity.
*/
public function loadAppGroup(string $appId): AppInterface;
@@ -66,39 +66,39 @@ public function loadAppGroup(string $appId): AppInterface;
/**
* Returns list of app ids from Edge.
*
- * @param \Apigee\Edge\Structure\PagerInterface|null $pager
+ * @param PagerInterface|null $pager
* Number of results to return.
*
* @return string[]
* An array of developer- and appgroup app ids.
*/
- public function listAppIds(PagerInterface $pager = null): array;
+ public function listAppIds(?PagerInterface $pager = null): array;
/**
* Returns list of app entities from Edge. The returned number of entities can be limited.
*
* @param bool $includeCredentials
* Whether to include consumer key and secret for each app in the response or not.
- * @param \Apigee\Edge\Structure\PagerInterface|null $pager
+ * @param PagerInterface|null $pager
* Number of results to return.
*
* @return \Apigee\Edge\Api\Management\Entity\AppInterface[]
* An array that can contain both developer- and appgroup app entities.
*/
- public function listApps(bool $includeCredentials = false, PagerInterface $pager = null): array;
+ public function listApps(bool $includeCredentials = false, ?PagerInterface $pager = null): array;
/**
* Returns a list of app ids filtered by status from Edge.
*
* @param string $status
* App status. (Recommended way is to use App entity constants.)
- * @param \Apigee\Edge\Structure\PagerInterface|null $pager
+ * @param PagerInterface|null $pager
* Number of results to return.
*
* @return string[]
* An array of developer- and appgroup app ids.
*/
- public function listAppIdsByStatus(string $status, PagerInterface $pager = null): array;
+ public function listAppIdsByStatus(string $status, ?PagerInterface $pager = null): array;
/**
* Returns a list of app entities filtered by status from Edge.
@@ -107,7 +107,7 @@ public function listAppIdsByStatus(string $status, PagerInterface $pager = null)
* App status. (Recommended way is to use App entity constants.)
* @param bool $includeCredentials
* Whether to include app credentials in the response or not.
- * @param \Apigee\Edge\Structure\PagerInterface|null $pager
+ * @param PagerInterface|null $pager
* Number of results to return.
*
* @return \Apigee\Edge\Api\Management\Entity\AppInterface[]
@@ -116,7 +116,7 @@ public function listAppIdsByStatus(string $status, PagerInterface $pager = null)
public function listAppsByStatus(
string $status,
bool $includeCredentials = true,
- PagerInterface $pager = null
+ ?PagerInterface $pager = null,
): array;
/**
@@ -124,11 +124,11 @@ public function listAppsByStatus(
*
* @param string $appType
* Either "developer" or "appgroup".
- * @param \Apigee\Edge\Structure\PagerInterface|null $pager
+ * @param PagerInterface|null $pager
* Number of results to return.
*
* @return string[]
* An array of developer- and appgroup app ids.
*/
- public function listAppIdsByType(string $appType, PagerInterface $pager = null): array;
+ public function listAppIdsByType(string $appType, ?PagerInterface $pager = null): array;
}
diff --git a/src/Api/ApigeeX/Controller/AppGroupAppController.php b/src/Api/ApigeeX/Controller/AppGroupAppController.php
index c8b3b29c6..c508a4ece 100644
--- a/src/Api/ApigeeX/Controller/AppGroupAppController.php
+++ b/src/Api/ApigeeX/Controller/AppGroupAppController.php
@@ -20,12 +20,11 @@
use Apigee\Edge\Api\ApigeeX\Entity\AppGroupApp;
use Apigee\Edge\Api\ApigeeX\Serializer\AppGroupEntitySerializer;
-use Apigee\Edge\Api\Management\Controller\AppByOwnerController;
+use Apigee\Edge\Api\ApigeeX\Structure\PagerInterface;
use Apigee\Edge\Api\Management\Controller\OrganizationController;
use Apigee\Edge\Api\Management\Controller\OrganizationControllerInterface;
use Apigee\Edge\ClientInterface;
use Apigee\Edge\Serializer\EntitySerializerInterface;
-use Apigee\Edge\Structure\PagerInterface;
use Psr\Http\Message\UriInterface;
/**
@@ -36,7 +35,7 @@ class AppGroupAppController extends AppByOwnerController implements AppGroupAppC
use AppGroupAwareControllerTrait;
/**
- * @var \Apigee\Edge\Api\Management\Controller\OrganizationControllerInterface
+ * @var OrganizationControllerInterface
*/
protected $organizationController;
@@ -45,16 +44,16 @@ class AppGroupAppController extends AppByOwnerController implements AppGroupAppC
*
* @param string $organization
* @param string $appGroup
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
- * @param \Apigee\Edge\Api\Management\Controller\OrganizationControllerInterface|null $organizationController
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
+ * @param OrganizationControllerInterface|null $organizationController
*/
public function __construct(
string $organization,
string $appGroup,
ClientInterface $client,
?EntitySerializerInterface $entitySerializer = null,
- ?OrganizationControllerInterface $organizationController = null
+ ?OrganizationControllerInterface $organizationController = null,
) {
$this->appGroup = $appGroup;
$entitySerializer = $entitySerializer ?? new AppGroupEntitySerializer();
@@ -62,26 +61,6 @@ public function __construct(
parent::__construct($organization, $client, $entitySerializer);
}
- /**
- * Override the getEntities() method, for AppGroup compatibility.
- *
- * AppGroup does not support the "expand=false" query parameter.
- *
- * {@inheritdoc}
- *
- * @return \Apigee\Edge\Entity\EntityInterface[]
- */
- public function getEntities(): array
- {
- $uri = $this->getBaseEndpointUri();
- $response = $this->getClient()->get($uri);
- $responseArray = $this->responseToArray($response);
- // Ignore entity type key from response, ex.: apiProduct.
- $responseArray = reset($responseArray);
-
- return $this->responseArrayToArrayOfEntities($responseArray);
- }
-
/**
* Override the getEntityIds() method, for AppGroup compatibility.
*
@@ -89,7 +68,7 @@ public function getEntities(): array
*
* {@inheritdoc}
*/
- public function getEntityIds(PagerInterface $pager = null): array
+ public function getEntityIds(?PagerInterface $pager = null): array
{
$uri = $this->getBaseEndpointUri();
$response = $this->getClient()->get($uri);
diff --git a/src/Api/ApigeeX/Controller/AppGroupAppControllerInterface.php b/src/Api/ApigeeX/Controller/AppGroupAppControllerInterface.php
index 20a121647..20d2bac0e 100644
--- a/src/Api/ApigeeX/Controller/AppGroupAppControllerInterface.php
+++ b/src/Api/ApigeeX/Controller/AppGroupAppControllerInterface.php
@@ -18,12 +18,10 @@
namespace Apigee\Edge\Api\ApigeeX\Controller;
-use Apigee\Edge\Api\Management\Controller\AppByOwnerControllerInterface;
-
/**
* Interface AppGroupAppControllerInterface.
*
- * @see https://apidocs.apigee.com/api/apps-appgroup
+ * @see https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.appgroups.apps
*/
interface AppGroupAppControllerInterface extends AppByOwnerControllerInterface, AppGroupAwareControllerInterface
{
diff --git a/src/Api/ApigeeX/Controller/AppGroupAppCredentialController.php b/src/Api/ApigeeX/Controller/AppGroupAppCredentialController.php
index 220b53223..a9419a7ec 100644
--- a/src/Api/ApigeeX/Controller/AppGroupAppCredentialController.php
+++ b/src/Api/ApigeeX/Controller/AppGroupAppCredentialController.php
@@ -19,6 +19,7 @@
namespace Apigee\Edge\Api\ApigeeX\Controller;
use Apigee\Edge\Api\Management\Controller\CompanyAppCredentialController;
+use Apigee\Edge\Api\Management\Entity\AppCredentialInterface;
use Apigee\Edge\ClientInterface;
use Apigee\Edge\Serializer\EntitySerializerInterface;
use Psr\Http\Message\UriInterface;
@@ -37,20 +38,43 @@ class AppGroupAppCredentialController extends CompanyAppCredentialController
* @param string $organization
* @param string $appGroup
* @param string $appName
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(
string $organization,
string $appGroup,
string $appName,
ClientInterface $client,
- ?EntitySerializerInterface $entitySerializer = null
+ ?EntitySerializerInterface $entitySerializer = null,
) {
$this->appGroup = $appGroup;
parent::__construct($organization, $appGroup, $appName, $client, $entitySerializer);
}
+ /**
+ * Modify (override) scopes of a customer key.
+ *
+ * @param string $consumerKey
+ * The consumer key to modify.
+ * @param string[] $scopes
+ *
+ * @return AppCredentialInterface
+ */
+ public function overrideAppGroupScopes(string $consumerKey, array $scopes): AppCredentialInterface
+ {
+ $response = $this->client->post(
+ $this->getEntityEndpointUri($consumerKey),
+ (string) json_encode((object) ['appGroupAppKey' => ['scopes' => $scopes]])
+ );
+
+ return $this->entitySerializer->deserialize(
+ (string) $response->getBody(),
+ $this->getEntityClass(),
+ 'json'
+ );
+ }
+
/**
* {@inheritdoc}
*/
diff --git a/src/Api/ApigeeX/Controller/AppGroupAwareControllerTrait.php b/src/Api/ApigeeX/Controller/AppGroupAwareControllerTrait.php
index 6b4021b05..d4031ae2d 100644
--- a/src/Api/ApigeeX/Controller/AppGroupAwareControllerTrait.php
+++ b/src/Api/ApigeeX/Controller/AppGroupAwareControllerTrait.php
@@ -21,7 +21,7 @@
/**
* Trait AppGroupAwareControllerTrait.
*
- * @see \Apigee\Edge\Api\ApigeeX\Controller\AppGroupAwareControllerInterface
+ * @see AppGroupAwareControllerInterface
*/
trait AppGroupAwareControllerTrait
{
diff --git a/src/Api/ApigeeX/Controller/AppGroupController.php b/src/Api/ApigeeX/Controller/AppGroupController.php
index 55e628f42..c53cb26a6 100644
--- a/src/Api/ApigeeX/Controller/AppGroupController.php
+++ b/src/Api/ApigeeX/Controller/AppGroupController.php
@@ -22,7 +22,6 @@
use Apigee\Edge\Api\ApigeeX\Serializer\AppGroupSerializer;
use Apigee\Edge\Api\Management\Controller\AttributesAwareEntityControllerTrait;
use Apigee\Edge\ClientInterface;
-use Apigee\Edge\Controller\EntityController;
use Apigee\Edge\Controller\EntityCreateOperationControllerTrait;
use Apigee\Edge\Controller\EntityCrudOperationsControllerTrait;
use Apigee\Edge\Controller\EntityListingControllerTrait;
@@ -34,11 +33,13 @@
/**
* Class AppGroupController.
*/
-class AppGroupController extends EntityController implements AppGroupControllerInterface
+class AppGroupController extends PaginatedEntityController implements AppGroupControllerInterface
{
use AttributesAwareEntityControllerTrait;
use EntityCrudOperationsControllerTrait;
use EntityListingControllerTrait;
+ use PaginatedEntityListingControllerTrait;
+ use PaginationHelperTrait;
use StatusAwareEntityControllerTrait;
use EntityCreateOperationControllerTrait;
@@ -46,8 +47,8 @@ class AppGroupController extends EntityController implements AppGroupControllerI
* AppGroupController constructor.
*
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
* @param \Apigee\Edge\Api\Management\Controller\OrganizationControllerInterface|null $organizationController
*/
public function __construct(string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
@@ -56,25 +57,6 @@ public function __construct(string $organization, ClientInterface $client, ?Enti
parent::__construct($organization, $client, $entitySerializer);
}
- /**
- * {@inheritdoc}
- */
- public function getEntities(): array
- {
- $uri = $this->getBaseEndpointUri();
- $response = $this->client->get($uri);
- $responseArray = $this->responseToArray($response);
- // Ignore entity type key from response.
- $responseArray = reset($responseArray);
-
- // Appgroup can be empty.
- if (empty($responseArray)) {
- return [];
- }
-
- return $this->responseArrayToArrayOfEntities($responseArray);
- }
-
/**
* {@inheritdoc}
*/
diff --git a/src/Api/ApigeeX/Controller/AppGroupControllerInterface.php b/src/Api/ApigeeX/Controller/AppGroupControllerInterface.php
index 0a24d4ca1..5bdc72fc8 100644
--- a/src/Api/ApigeeX/Controller/AppGroupControllerInterface.php
+++ b/src/Api/ApigeeX/Controller/AppGroupControllerInterface.php
@@ -25,11 +25,14 @@
/**
* Interface AppGroupControllerInterface.
+ *
+ * @see https://cloud.google.com/apigee/docs/reference/apis/apigee/rest/v1/organizations.appgroups
*/
interface AppGroupControllerInterface extends
AttributesAwareEntityControllerInterface,
EntityControllerInterface,
EntityCrudOperationsControllerInterface,
+ PaginatedEntityListingControllerInterface,
StatusAwareEntityControllerInterface
{
}
diff --git a/src/Api/ApigeeX/Controller/AppGroupMembersController.php b/src/Api/ApigeeX/Controller/AppGroupMembersController.php
index a4fe6b4b2..411eaa3d8 100644
--- a/src/Api/ApigeeX/Controller/AppGroupMembersController.php
+++ b/src/Api/ApigeeX/Controller/AppGroupMembersController.php
@@ -20,6 +20,7 @@
use Apigee\Edge\Api\ApigeeX\Serializer\AppGroupMembershipSerializer;
use Apigee\Edge\Api\ApigeeX\Structure\AppGroupMembership;
+use Apigee\Edge\Api\Management\Serializer\AttributesPropertyAwareEntitySerializer;
use Apigee\Edge\ClientInterface;
use Apigee\Edge\Controller\AbstractController;
use Apigee\Edge\Controller\OrganizationAwareControllerTrait;
@@ -47,7 +48,7 @@ class AppGroupMembersController extends AbstractController implements AppGroupMe
*
* @param string $appGroup
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
+ * @param ClientInterface $client
*/
public function __construct(string $appGroup, string $organization, ClientInterface $client)
{
@@ -73,8 +74,10 @@ public function getMembers(): AppGroupMembership
public function setMembers(AppGroupMembership $members): AppGroupMembership
{
$members = $this->serializer->normalize($members);
- $apigeeReservedMembers = new AttributesProperty();
+ // We don't have a separate API to get appgroup attributes,
+ // that is why we are calling getAppGroupAttributes() method.
+ $apigeeReservedMembers = $this->getAppGroupAttributes();
// Adding the new members into the attribute.
$apigeeReservedMembers->add('__apigee_reserved__developer_details', json_encode($members));
$response = $this->client->put(
@@ -101,6 +104,23 @@ public function removeMember(string $email): void
$this->client->delete($this->getBaseEndpointUri()->withPath("{$this->getBaseEndpointUri()->getPath()}/{$encoded}"));
}
+ /**
+ * Helper function for getting all attributes in AppGroup.
+ *
+ * @return AttributesProperty
+ */
+ public function getAppGroupAttributes(): AttributesProperty
+ {
+ $appGroup = $this->responseToArray($this->client->get($this->getBaseEndpointUri()));
+ $serializer = new AttributesPropertyAwareEntitySerializer();
+ $appGroupAttributes = $serializer->denormalize(
+ $appGroup['attributes'],
+ AttributesProperty::class
+ );
+
+ return $appGroupAttributes;
+ }
+
/**
* {@inheritdoc}
*/
diff --git a/src/Api/ApigeeX/Controller/AppGroupMembersControllerInterface.php b/src/Api/ApigeeX/Controller/AppGroupMembersControllerInterface.php
index 9f5f67b12..a321d92ef 100644
--- a/src/Api/ApigeeX/Controller/AppGroupMembersControllerInterface.php
+++ b/src/Api/ApigeeX/Controller/AppGroupMembersControllerInterface.php
@@ -28,7 +28,7 @@ interface AppGroupMembersControllerInterface extends AppGroupAwareControllerInte
/**
* List all developers associated with a appgroup.
*
- * @return \Apigee\Edge\Api\ApigeeX\Structure\AppGroupMembership
+ * @return AppGroupMembership
* Array of developers with their optional roles in the appgroup.
*/
public function getMembers(): AppGroupMembership;
@@ -39,10 +39,10 @@ public function getMembers(): AppGroupMembership;
* WARNING! If you pass en empty membership object you remove all developers
* from the appgroup.
*
- * @param \Apigee\Edge\Api\ApigeeX\Structure\AppGroupMembership $members
+ * @param AppGroupMembership $members
* Membership object with the changes to be applied.
*
- * @return \Apigee\Edge\Api\ApigeeX\Structure\AppGroupMembership
+ * @return AppGroupMembership
* Membership object with the applied changes, it does not contain all
* members. Use getMembers() to retrieve them.
*/
diff --git a/src/Api/ApigeeX/Controller/BillingTypeController.php b/src/Api/ApigeeX/Controller/BillingTypeController.php
index 794c90cf0..b514099b9 100644
--- a/src/Api/ApigeeX/Controller/BillingTypeController.php
+++ b/src/Api/ApigeeX/Controller/BillingTypeController.php
@@ -36,8 +36,8 @@ abstract class BillingTypeController extends EntityController implements Billing
* BillingTypeController constructor.
*
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
@@ -75,7 +75,7 @@ public function updateBillingType($billingtype): BillingTypeInterface
/**
* Helper function for getting the billing type.
*
- * @return \Apigee\Edge\Api\ApigeeX\Entity\BillingTypeInterface
+ * @return BillingTypeInterface
*/
private function getDeveloperBillingType(): BillingTypeInterface
{
diff --git a/src/Api/ApigeeX/Controller/BillingTypeControllerInterface.php b/src/Api/ApigeeX/Controller/BillingTypeControllerInterface.php
index ca91196c9..825bb8914 100644
--- a/src/Api/ApigeeX/Controller/BillingTypeControllerInterface.php
+++ b/src/Api/ApigeeX/Controller/BillingTypeControllerInterface.php
@@ -34,7 +34,7 @@ interface BillingTypeControllerInterface extends
/**
* Gets the billingtype.
*
- * @return \Apigee\Edge\Api\ApigeeX\Entity\BillingTypeInterface
+ * @return BillingTypeInterface
*/
public function getAllBillingDetails(): BillingTypeInterface;
diff --git a/src/Api/ApigeeX/Controller/DeveloperAcceptedRatePlanController.php b/src/Api/ApigeeX/Controller/DeveloperAcceptedRatePlanController.php
index 64f1fe11c..60ba2ed9e 100755
--- a/src/Api/ApigeeX/Controller/DeveloperAcceptedRatePlanController.php
+++ b/src/Api/ApigeeX/Controller/DeveloperAcceptedRatePlanController.php
@@ -39,8 +39,8 @@ class DeveloperAcceptedRatePlanController extends AcceptedRatePlanController
*
* @param string $developerId
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $developerId, string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
diff --git a/src/Api/ApigeeX/Controller/DeveloperBillingTypeController.php b/src/Api/ApigeeX/Controller/DeveloperBillingTypeController.php
index c35275d47..c43981bce 100644
--- a/src/Api/ApigeeX/Controller/DeveloperBillingTypeController.php
+++ b/src/Api/ApigeeX/Controller/DeveloperBillingTypeController.php
@@ -37,8 +37,8 @@ class DeveloperBillingTypeController extends BillingTypeController
*
* @param string $developerId
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $developerId, string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
diff --git a/src/Api/ApigeeX/Controller/DeveloperPrepaidBalanceController.php b/src/Api/ApigeeX/Controller/DeveloperPrepaidBalanceController.php
index 7cb5a08cf..e0f4fb347 100644
--- a/src/Api/ApigeeX/Controller/DeveloperPrepaidBalanceController.php
+++ b/src/Api/ApigeeX/Controller/DeveloperPrepaidBalanceController.php
@@ -36,8 +36,8 @@ class DeveloperPrepaidBalanceController extends PrepaidBalanceController impleme
*
* @param string $developerId
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $developerId, string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
diff --git a/src/Api/ApigeeX/Controller/ListingHelperTrait.php b/src/Api/ApigeeX/Controller/ListingHelperTrait.php
index e74a23902..6a8dc1ecd 100755
--- a/src/Api/ApigeeX/Controller/ListingHelperTrait.php
+++ b/src/Api/ApigeeX/Controller/ListingHelperTrait.php
@@ -34,7 +34,7 @@ protected function listEntities(UriInterface $uri): array
/**
* Returns a raw API response as an array of a listing API endpoint.
*
- * @param \Psr\Http\Message\UriInterface $uri
+ * @param UriInterface $uri
* URI of the endpoint where the request should be sent.
*
* @return array
@@ -46,7 +46,7 @@ protected function getRawList(UriInterface $uri): array
$responseArray = $this->responseToArray($response);
- //ApigeeX can return empty array.
+ // ApigeeX can return empty array.
if (empty($responseArray)) {
return $responseArray;
}
@@ -58,7 +58,7 @@ protected function getRawList(UriInterface $uri): array
/**
* Returns a raw API response as an array when there is single value in api response.
*
- * @param \Psr\Http\Message\UriInterface $uri
+ * @param UriInterface $uri
* URI of the endpoint where the request should be sent.
*
* @return array
diff --git a/src/Api/ApigeeX/Controller/PaginatedEntityController.php b/src/Api/ApigeeX/Controller/PaginatedEntityController.php
new file mode 100644
index 000000000..5dadbf102
--- /dev/null
+++ b/src/Api/ApigeeX/Controller/PaginatedEntityController.php
@@ -0,0 +1,65 @@
+organizationController = $organizationController ?: new OrganizationController($client);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getOrganizationController(): OrganizationControllerInterface
+ {
+ return $this->organizationController;
+ }
+}
diff --git a/src/Api/ApigeeX/Controller/PaginatedEntityControllerInterface.php b/src/Api/ApigeeX/Controller/PaginatedEntityControllerInterface.php
new file mode 100644
index 000000000..5d72b21d2
--- /dev/null
+++ b/src/Api/ApigeeX/Controller/PaginatedEntityControllerInterface.php
@@ -0,0 +1,46 @@
+listEntities($pager, $queryparams, $key_provider);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ abstract protected function listEntities(?PagerInterface $pager = null, array $query_params = [], string $key_provider = 'id'): array;
+}
diff --git a/src/Api/ApigeeX/Controller/PaginatedListingHelperTrait.php b/src/Api/ApigeeX/Controller/PaginatedListingHelperTrait.php
index b596b161f..be4522fae 100755
--- a/src/Api/ApigeeX/Controller/PaginatedListingHelperTrait.php
+++ b/src/Api/ApigeeX/Controller/PaginatedListingHelperTrait.php
@@ -38,7 +38,7 @@ protected function listAllEntities(UriInterface $uri): array
return $this->listEntities($uri->withQuery(http_build_query($query_params)));
}
- protected function listEntitiesInRange(UriInterface $uri, int $limit = null, int $page = 1): array
+ protected function listEntitiesInRange(UriInterface $uri, ?int $limit = null, int $page = 1): array
{
// Do not lose already set query parameters.
$query_params = [];
diff --git a/src/Api/ApigeeX/Controller/PaginationHelperTrait.php b/src/Api/ApigeeX/Controller/PaginationHelperTrait.php
new file mode 100644
index 000000000..87fd0c153
--- /dev/null
+++ b/src/Api/ApigeeX/Controller/PaginationHelperTrait.php
@@ -0,0 +1,185 @@
+pageToken;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getLimit(): int
+ {
+ return $this->limit;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setPageToken(?string $pageToken): ?string
+ {
+ $this->pageToken = $pageToken;
+
+ return $this->pageToken;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setLimit(int $limit): int
+ {
+ $this->limit = $limit;
+
+ return $this->limit;
+ }
+ };
+
+ $pager->setLimit($limit);
+ $pager->setPageToken($pageToken);
+
+ return $pager;
+ }
+
+ /**
+ * Loads paginated list of entities from Apigee X.
+ *
+ * @param PagerInterface|null $pager
+ * Pager.
+ * @param array $query_params
+ * Additional query parameters.
+ * @param string $key_provider
+ * Getter method on the entity that should provide a unique array key.
+ *
+ * @return \Apigee\Edge\Entity\EntityInterface[]
+ * Array of entity objects.
+ *
+ * @psalm-suppress PossiblyNullArrayOffset $tmp->id() is always not null here.
+ * @psalm-suppress PossiblyFalseArgument $tmp not be false.
+ */
+ protected function listEntities(?PagerInterface $pager = null, array $query_params = [], string $key_provider = 'id'): array
+ {
+ if ($pager) {
+ $responseArray = $this->getResultsInRange($pager, $query_params);
+ // Ignore entity type key from response, ex.: developer,
+ // apiproduct, etc.
+ $responseArray = reset($responseArray);
+
+ return $this->responseArrayToArrayOfEntities($responseArray, $key_provider);
+ } else {
+ // Default page size set to 1000, because the AppGroupApps endpoint
+ // does not return nextPageToken unless a pageSize is specified
+ // in the request parameters.
+ $pageSize = 1000;
+ // Pass an empty pager to load all entities.
+ $responseArray = $this->getResultsInRange($this->createPager($pageSize), $query_params);
+ // Check flag 'nextPageToken' to get next items from the list.
+ $nextPageToken = array_key_exists('nextPageToken', $responseArray) ? $responseArray['nextPageToken'] : false;
+ // Ignore entity type key from response, ex.: developer, apiproduct,
+ // etc.
+ $responseArray = reset($responseArray);
+ // Appgroup can be empty.
+ if (empty($responseArray) || !is_array($responseArray)) {
+ return [];
+ }
+ $entities = $this->responseArrayToArrayOfEntities($responseArray, $key_provider);
+
+ if ($nextPageToken) {
+ do {
+ $tmp = $this->getResultsInRange($this->createPager($pageSize, $nextPageToken), $query_params);
+ // Check the flag 'nextPageToken' to get next items from the list.
+ $nextPageToken = array_key_exists('nextPageToken', $tmp) ? $tmp['nextPageToken'] : false;
+ // Ignore entity type key from response, ex.: developer,
+ // apiproduct, etc.
+ $tmp = reset($tmp);
+ // Remove the first item from the list because it is the same
+ // as the last item of $entities at this moment.
+ // Apigee X response always starts with the requested entity
+ // (pageToken).
+ array_shift($tmp);
+ $tmpEntities = $this->responseArrayToArrayOfEntities($tmp, $key_provider);
+ // The returned entity array is keyed by entity id which
+ // is unique so we can do this.
+ $entities += $tmpEntities;
+ } while ($nextPageToken);
+ }
+
+ return $entities;
+ }
+ }
+
+ /**
+ * Gets entities and entity ids in a provided range from Apigee X.
+ *
+ * @param PagerInterface $pager
+ * limit object with configured pageToken and limit.
+ * @param array $query_params
+ * Query parameters for the API call.
+ * @param bool $expandCompatability
+ * If the API response requires backwards compatibility with the way Edge
+ * formats it's responses.
+ *
+ * @see \Apigee\Edge\Utility\ResponseToArrayHelper::responseToArray()
+ *
+ * @return array
+ * API response parsed as an array.
+ */
+ private function getResultsInRange(PagerInterface $pager, array $query_params, bool $expandCompatibility = false): array
+ {
+ $query_params['pageToken'] = $pager->getPageToken();
+ // Do not add 0 unnecessarily to the query parameters.
+ if ($pager->getLimit() > 0) {
+ $query_params['pageSize'] = $pager->getLimit();
+ }
+ $uri = $this->getBaseEndpointUri()->withQuery(http_build_query($query_params));
+ $response = $this->getClient()->get($uri);
+
+ return $this->responseToArray($response, $expandCompatibility);
+ }
+}
diff --git a/src/Api/ApigeeX/Controller/PrepaidBalanceController.php b/src/Api/ApigeeX/Controller/PrepaidBalanceController.php
index 8a15a565e..bc0f81b47 100755
--- a/src/Api/ApigeeX/Controller/PrepaidBalanceController.php
+++ b/src/Api/ApigeeX/Controller/PrepaidBalanceController.php
@@ -35,7 +35,7 @@ abstract class PrepaidBalanceController extends OrganizationAwareEntityControlle
use PaginatedEntityListingControllerAwareTrait;
/**
- * @var \Apigee\Edge\Serializer\EntitySerializerInterface
+ * @var EntitySerializerInterface
*/
protected $prepaidBalanceSerializer;
@@ -50,10 +50,10 @@ abstract class PrepaidBalanceController extends OrganizationAwareEntityControlle
* PrepaidBalanceController constructor.
*
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $balanceSerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $balanceSerializer
* @param string|null $prepaidBalanceClass
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $prepaidBalanceSerializer
+ * @param EntitySerializerInterface|null $prepaidBalanceSerializer
*/
public function __construct(string $organization, ClientInterface $client, ?EntitySerializerInterface $balanceSerializer = null, ?string $prepaidBalanceClass = null, ?EntitySerializerInterface $prepaidBalanceSerializer = null)
{
@@ -75,9 +75,9 @@ public function topUpBalance($amount, $amountnano, string $currencyCode, string
$this->getBaseEndpointUri(),
(string) json_encode((object) [
'transactionAmount' => [
- 'currencyCode' => $currencyCode,
- 'units' => $amount,
- 'nanos' => $amountnano,
+ 'currencyCode' => $currencyCode,
+ 'units' => $amount,
+ 'nanos' => $amountnano,
],
'transactionId' => $transaction_id,
])
@@ -109,7 +109,7 @@ protected function getEntityClass(): string
/**
* Returns the URI of the prepaid balances endpoint.
*
- * @return \Psr\Http\Message\UriInterface
+ * @return UriInterface
*/
abstract protected function getPrepaidBalanceEndpoint(): UriInterface;
@@ -126,7 +126,7 @@ private function listPrepaidBalances(?string $currencyCode = null): array
{
$balances = [];
foreach ($this->getRawList($this->getPrepaidBalanceEndpoint()) as $item) {
- /** @var \Apigee\Edge\Api\ApigeeX\Entity\PrepaidBalanceInterface $balance */
+ /** @var PrepaidBalanceInterface $balance */
$balance = $this->prepaidBalanceSerializer->denormalize($item, $this->prepaidBalanceClass);
$balances[$balance->getBalance()->getCurrencyCode()] = $balance;
}
diff --git a/src/Api/ApigeeX/Controller/PrepaidBalanceControllerInterface.php b/src/Api/ApigeeX/Controller/PrepaidBalanceControllerInterface.php
index ad46636c9..a5637a23d 100755
--- a/src/Api/ApigeeX/Controller/PrepaidBalanceControllerInterface.php
+++ b/src/Api/ApigeeX/Controller/PrepaidBalanceControllerInterface.php
@@ -30,7 +30,7 @@ interface PrepaidBalanceControllerInterface extends EntityControllerInterface, P
* @param string $currencyCode
* @param string $transaction_id
*
- * @return \Apigee\Edge\Api\ApigeeX\Entity\PrepaidBalanceInterface
+ * @return PrepaidBalanceInterface
*/
public function topUpBalance($amount, $amountnano, string $currencyCode, string $transaction_id): PrepaidBalanceInterface;
diff --git a/src/Api/ApigeeX/Controller/RatePlanController.php b/src/Api/ApigeeX/Controller/RatePlanController.php
index 728f33966..bb5f414f8 100755
--- a/src/Api/ApigeeX/Controller/RatePlanController.php
+++ b/src/Api/ApigeeX/Controller/RatePlanController.php
@@ -47,8 +47,8 @@ class RatePlanController extends OrganizationAwareEntityController implements Ra
*
* @param string $apiProduct
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $apiProduct, string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
@@ -73,7 +73,7 @@ public function getEntities(?bool $showCurrentOnly = null, ?bool $showPrivate =
// Ignore entity type key from response, ex.: product.
$responseArray = reset($responseArray);
- //XProduct is not monetized and we skip it.
+ // XProduct is not monetized and we skip it.
if (empty($responseArray)) {
return [];
}
diff --git a/src/Api/ApigeeX/Controller/RatePlanControllerInterface.php b/src/Api/ApigeeX/Controller/RatePlanControllerInterface.php
index c8d2b5a7d..795807620 100755
--- a/src/Api/ApigeeX/Controller/RatePlanControllerInterface.php
+++ b/src/Api/ApigeeX/Controller/RatePlanControllerInterface.php
@@ -52,7 +52,7 @@ public function getEntities(?bool $showCurrentOnly = null, ?bool $showPrivate =
/**
* Creates a new rate plan revision.
*
- * @param \Apigee\Edge\Api\ApigeeX\Entity\RatePlanRevisionInterface $entity
+ * @param RatePlanRevisionInterface $entity
* Rate plan revision to be created.
*/
public function createNewRevision(RatePlanRevisionInterface $entity): void;
diff --git a/src/Api/ApigeeX/Denormalizer/AcceptedRatePlanDenormalizer.php b/src/Api/ApigeeX/Denormalizer/AcceptedRatePlanDenormalizer.php
index 4157aca00..4a8130b5c 100755
--- a/src/Api/ApigeeX/Denormalizer/AcceptedRatePlanDenormalizer.php
+++ b/src/Api/ApigeeX/Denormalizer/AcceptedRatePlanDenormalizer.php
@@ -34,7 +34,7 @@ abstract class AcceptedRatePlanDenormalizer extends ObjectDenormalizer
*/
public function denormalize($data, $type, $format = null, array $context = [])
{
- /** @var \Apigee\Edge\Api\ApigeeX\Entity\AcceptedRatePlanInterface $denormalized */
+ /** @var AcceptedRatePlanInterface $denormalized */
$denormalized = parent::denormalize($data, $type, $format, $context);
return $denormalized;
diff --git a/src/Api/ApigeeX/Denormalizer/ApiProductDenormalizer.php b/src/Api/ApigeeX/Denormalizer/ApiProductDenormalizer.php
index a93e2674d..51b009515 100755
--- a/src/Api/ApigeeX/Denormalizer/ApiProductDenormalizer.php
+++ b/src/Api/ApigeeX/Denormalizer/ApiProductDenormalizer.php
@@ -31,10 +31,10 @@ class ApiProductDenormalizer extends ObjectDenormalizer
/**
* ApiProductDenormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/ApigeeX/Denormalizer/AppDenormalizer.php b/src/Api/ApigeeX/Denormalizer/AppDenormalizer.php
index 147e34f3f..89e048fce 100644
--- a/src/Api/ApigeeX/Denormalizer/AppDenormalizer.php
+++ b/src/Api/ApigeeX/Denormalizer/AppDenormalizer.php
@@ -70,4 +70,14 @@ public function supportsDenormalization($data, $type, $format = null)
return AppInterface::class === $type || $type instanceof AppInterface || in_array(AppInterface::class, class_implements($type));
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ AppInterface::class => true,
+ ];
+ }
}
diff --git a/src/Api/ApigeeX/Denormalizer/BillingTypeDenormalizer.php b/src/Api/ApigeeX/Denormalizer/BillingTypeDenormalizer.php
index 585f37970..ab98d1297 100644
--- a/src/Api/ApigeeX/Denormalizer/BillingTypeDenormalizer.php
+++ b/src/Api/ApigeeX/Denormalizer/BillingTypeDenormalizer.php
@@ -28,7 +28,7 @@ abstract class BillingTypeDenormalizer extends ObjectDenormalizer
*/
public function denormalize($data, $type, $format = null, array $context = [])
{
- /** @var \Apigee\Edge\Api\ApigeeX\Entity\BillingTypeInterface $denormalized */
+ /** @var BillingTypeInterface $denormalized */
$denormalized = parent::denormalize($data, $type, $format, $context);
return $denormalized;
diff --git a/src/Api/ApigeeX/Denormalizer/PrepaidBalanceDenormalizer.php b/src/Api/ApigeeX/Denormalizer/PrepaidBalanceDenormalizer.php
index 6b009c7f0..ea42fe34e 100755
--- a/src/Api/ApigeeX/Denormalizer/PrepaidBalanceDenormalizer.php
+++ b/src/Api/ApigeeX/Denormalizer/PrepaidBalanceDenormalizer.php
@@ -31,10 +31,10 @@ class PrepaidBalanceDenormalizer extends ObjectDenormalizer
/**
* PrepaidBalanceDenormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/ApigeeX/Denormalizer/RatePlanDenormalizer.php b/src/Api/ApigeeX/Denormalizer/RatePlanDenormalizer.php
index 93d3dc5b2..1494d83e4 100755
--- a/src/Api/ApigeeX/Denormalizer/RatePlanDenormalizer.php
+++ b/src/Api/ApigeeX/Denormalizer/RatePlanDenormalizer.php
@@ -37,10 +37,10 @@ abstract class RatePlanDenormalizer extends ObjectDenormalizer
/**
* RatePlanDenormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
@@ -56,7 +56,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
*/
public function denormalize($data, $type, $format = null, array $context = [])
{
- /** @var \Apigee\Edge\Api\ApigeeX\Entity\RatePlanInterface $entity */
+ /** @var RatePlanInterface $entity */
$entity = parent::denormalize($data, $type, $format, $context);
return $entity;
diff --git a/src/Api/ApigeeX/Denormalizer/RatePlanDenormalizerFactory.php b/src/Api/ApigeeX/Denormalizer/RatePlanDenormalizerFactory.php
index 066f3a8d5..c64cca650 100755
--- a/src/Api/ApigeeX/Denormalizer/RatePlanDenormalizerFactory.php
+++ b/src/Api/ApigeeX/Denormalizer/RatePlanDenormalizerFactory.php
@@ -93,4 +93,14 @@ public function setSerializer(SerializerInterface $serializer): void
}
}
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ '*' => false,
+ ];
+ }
}
diff --git a/src/Api/ApigeeX/Denormalizer/StandardRatePlanDenormalizer.php b/src/Api/ApigeeX/Denormalizer/StandardRatePlanDenormalizer.php
index 0437fe1f1..cdc0f72b9 100755
--- a/src/Api/ApigeeX/Denormalizer/StandardRatePlanDenormalizer.php
+++ b/src/Api/ApigeeX/Denormalizer/StandardRatePlanDenormalizer.php
@@ -61,7 +61,7 @@ public function supportsDenormalization($data, $type, $format = null)
}
if (parent::supportsDenormalization($data, $type, $format)) {
- //return RatePlanInterface::TYPE_STANDARD == $data->type;
+ // return RatePlanInterface::TYPE_STANDARD == $data->type;
return RatePlanInterface::TYPE_STANDARD == 'STANDARD';
}
diff --git a/src/Api/ApigeeX/Entity/AcceptedRatePlan.php b/src/Api/ApigeeX/Entity/AcceptedRatePlan.php
index b9e6cb875..278489b22 100755
--- a/src/Api/ApigeeX/Entity/AcceptedRatePlan.php
+++ b/src/Api/ApigeeX/Entity/AcceptedRatePlan.php
@@ -37,7 +37,7 @@ abstract class AcceptedRatePlan extends Entity implements AcceptedRatePlanInterf
/** @var string|null */
protected $lastModifiedAt;
- /** @var \Apigee\Edge\Api\ApigeeX\Entity\RatePlanInterface|null */
+ /** @var RatePlanInterface|null */
protected $ratePlan;
/**
diff --git a/src/Api/ApigeeX/Entity/ApiProduct.php b/src/Api/ApigeeX/Entity/ApiProduct.php
index 42fbee47d..d2cdedee2 100755
--- a/src/Api/ApigeeX/Entity/ApiProduct.php
+++ b/src/Api/ApigeeX/Entity/ApiProduct.php
@@ -19,12 +19,14 @@
namespace Apigee\Edge\Api\ApigeeX\Entity;
use Apigee\Edge\Api\Monetization\Entity\Entity;
+use Apigee\Edge\Entity\Property\AttributesPropertyAwareTrait;
use Apigee\Edge\Entity\Property\DescriptionPropertyAwareTrait;
use Apigee\Edge\Entity\Property\DisplayNamePropertyAwareTrait;
use Apigee\Edge\Entity\Property\NamePropertyAwareTrait;
class ApiProduct extends Entity implements ApiProductInterface
{
+ use AttributesPropertyAwareTrait;
use DescriptionPropertyAwareTrait;
use DisplayNamePropertyAwareTrait;
use NamePropertyAwareTrait;
diff --git a/src/Api/ApigeeX/Entity/ApiProductInterface.php b/src/Api/ApigeeX/Entity/ApiProductInterface.php
index beb82a8b3..4e377bf6d 100755
--- a/src/Api/ApigeeX/Entity/ApiProductInterface.php
+++ b/src/Api/ApigeeX/Entity/ApiProductInterface.php
@@ -18,11 +18,13 @@
namespace Apigee\Edge\Api\ApigeeX\Entity;
+use Apigee\Edge\Entity\Property\AttributesPropertyInterface;
use Apigee\Edge\Entity\Property\DescriptionPropertyInterface;
use Apigee\Edge\Entity\Property\DisplayNamePropertyInterface;
use Apigee\Edge\Entity\Property\NamePropertyInterface;
interface ApiProductInterface extends
+ AttributesPropertyInterface,
DescriptionPropertyInterface,
DisplayNamePropertyInterface,
NamePropertyInterface
diff --git a/src/Api/ApigeeX/Entity/BillingType.php b/src/Api/ApigeeX/Entity/BillingType.php
index ce166363d..139939d5b 100644
--- a/src/Api/ApigeeX/Entity/BillingType.php
+++ b/src/Api/ApigeeX/Entity/BillingType.php
@@ -28,7 +28,7 @@ abstract class BillingType extends Entity implements BillingTypeInterface
/**
* {@inheritdoc}
*/
- public function getbillingType(): ?string
+ public function getBillingType(): ?string
{
return $this->billingType;
}
@@ -38,7 +38,7 @@ public function getbillingType(): ?string
*
* @internal
*/
- public function setbillingType(?string $billingType): void
+ public function setBillingType(?string $billingType): void
{
$this->billingType = $billingType;
}
diff --git a/src/Api/ApigeeX/Entity/BillingTypeInterface.php b/src/Api/ApigeeX/Entity/BillingTypeInterface.php
index 2f01457be..5851864e8 100644
--- a/src/Api/ApigeeX/Entity/BillingTypeInterface.php
+++ b/src/Api/ApigeeX/Entity/BillingTypeInterface.php
@@ -25,10 +25,10 @@ interface BillingTypeInterface extends EntityInterface
/**
* @return string
*/
- public function getbillingType(): ?string;
+ public function getBillingType(): ?string;
/**
* @param string|null $billingType
*/
- public function setbillingType(?string $billingType): void;
+ public function setBillingType(?string $billingType): void;
}
diff --git a/src/Api/ApigeeX/Entity/PrepaidBalance.php b/src/Api/ApigeeX/Entity/PrepaidBalance.php
index bff5823a0..473e948e8 100755
--- a/src/Api/ApigeeX/Entity/PrepaidBalance.php
+++ b/src/Api/ApigeeX/Entity/PrepaidBalance.php
@@ -25,7 +25,7 @@ class PrepaidBalance extends Entity implements PrepaidBalanceInterface
/** @var string|null */
protected $lastCreditTime;
- /** @var \Apigee\Edge\Api\ApigeeX\Entity\Balance */
+ /** @var Balance */
protected $balance;
/**
@@ -37,7 +37,7 @@ public function getBalance(): Balance
}
/**
- * @param \Apigee\Edge\Api\ApigeeX\Entity\Balance $balance
+ * @param Balance $balance
*/
public function setBalance(Balance $balance): void
{
@@ -47,7 +47,7 @@ public function setBalance(Balance $balance): void
/**
* {@inheritdoc}
*/
- public function getlastCreditTime(): ?string
+ public function getLastCreditTime(): ?string
{
return $this->lastCreditTime;
}
@@ -55,7 +55,7 @@ public function getlastCreditTime(): ?string
/**
* @param string $lastCreditTime
*/
- public function setlastCreditTime(string $lastCreditTime): void
+ public function setLastCreditTime(string $lastCreditTime): void
{
$this->lastCreditTime = $lastCreditTime;
}
diff --git a/src/Api/ApigeeX/Entity/PrepaidBalanceInterface.php b/src/Api/ApigeeX/Entity/PrepaidBalanceInterface.php
index 8cde36735..413ebdabe 100755
--- a/src/Api/ApigeeX/Entity/PrepaidBalanceInterface.php
+++ b/src/Api/ApigeeX/Entity/PrepaidBalanceInterface.php
@@ -29,12 +29,12 @@
interface PrepaidBalanceInterface extends EntityInterface
{
/**
- * @return \Apigee\Edge\Api\ApigeeX\Entity\Balance
+ * @return Balance
*/
public function getBalance(): Balance;
/**
* @return string
*/
- public function getlastCreditTime(): ?string;
+ public function getLastCreditTime(): ?string;
}
diff --git a/src/Api/ApigeeX/Entity/Property/BillingPeriodPropertyAwareTrait.php b/src/Api/ApigeeX/Entity/Property/BillingPeriodPropertyAwareTrait.php
index 9a1240ded..cd7db860e 100755
--- a/src/Api/ApigeeX/Entity/Property/BillingPeriodPropertyAwareTrait.php
+++ b/src/Api/ApigeeX/Entity/Property/BillingPeriodPropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait BillingPeriodPropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\ApigeeX\Entity\Property\BillingPeriodPropertyInterface
+ * @see BillingPeriodPropertyInterface
*/
trait BillingPeriodPropertyAwareTrait
{
diff --git a/src/Api/ApigeeX/Entity/Property/ConsumptionPricingTypePropertyAwareTrait.php b/src/Api/ApigeeX/Entity/Property/ConsumptionPricingTypePropertyAwareTrait.php
index 2c18ea7c6..72baea59e 100755
--- a/src/Api/ApigeeX/Entity/Property/ConsumptionPricingTypePropertyAwareTrait.php
+++ b/src/Api/ApigeeX/Entity/Property/ConsumptionPricingTypePropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait ConsumptionPricingTypePropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\ApigeeX\Entity\Property\ConsumptionPricingTypePropertyInterface
+ * @see ConsumptionPricingTypePropertyInterface
*/
trait ConsumptionPricingTypePropertyAwareTrait
{
diff --git a/src/Api/ApigeeX/Entity/Property/CurrencyCodePropertyAwareTrait.php b/src/Api/ApigeeX/Entity/Property/CurrencyCodePropertyAwareTrait.php
index 995c6711d..dd128e0be 100755
--- a/src/Api/ApigeeX/Entity/Property/CurrencyCodePropertyAwareTrait.php
+++ b/src/Api/ApigeeX/Entity/Property/CurrencyCodePropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait CurrencyCodePropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\ApigeeX\Entity\Property\CurrencyCodePropertyInterface
+ * @see CurrencyCodePropertyInterface
*/
trait CurrencyCodePropertyAwareTrait
{
diff --git a/src/Api/ApigeeX/Entity/Property/EndTimePropertyAwareTrait.php b/src/Api/ApigeeX/Entity/Property/EndTimePropertyAwareTrait.php
index 45caa31ad..640dbfd11 100755
--- a/src/Api/ApigeeX/Entity/Property/EndTimePropertyAwareTrait.php
+++ b/src/Api/ApigeeX/Entity/Property/EndTimePropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait EndTimePropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\ApigeeX\Entity\Property\EndTimePropertyInterface
+ * @see EndTimePropertyInterface
*/
trait EndTimePropertyAwareTrait
{
diff --git a/src/Api/ApigeeX/Entity/Property/FixedFeeFrequencyPropertyAwareTrait.php b/src/Api/ApigeeX/Entity/Property/FixedFeeFrequencyPropertyAwareTrait.php
index 02581a2a3..c66a0fd47 100755
--- a/src/Api/ApigeeX/Entity/Property/FixedFeeFrequencyPropertyAwareTrait.php
+++ b/src/Api/ApigeeX/Entity/Property/FixedFeeFrequencyPropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait FixedFeeFrequencyPropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\ApigeeX\Entity\Property\FixedFeeFrequencyPropertyInterface
+ * @see FixedFeeFrequencyPropertyInterface
*/
trait FixedFeeFrequencyPropertyAwareTrait
{
diff --git a/src/Api/ApigeeX/Entity/Property/NanosPropertyAwareTrait.php b/src/Api/ApigeeX/Entity/Property/NanosPropertyAwareTrait.php
index 3ec5482aa..47bc2e201 100755
--- a/src/Api/ApigeeX/Entity/Property/NanosPropertyAwareTrait.php
+++ b/src/Api/ApigeeX/Entity/Property/NanosPropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait NanosPropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\ApigeeX\Entity\Property\NanosPropertyInterface
+ * @see NanosPropertyInterface
*/
trait NanosPropertyAwareTrait
{
diff --git a/src/Api/ApigeeX/Entity/Property/PaymentFundingModelPropertyAwareTrait.php b/src/Api/ApigeeX/Entity/Property/PaymentFundingModelPropertyAwareTrait.php
index 3900296b7..1f174f5d1 100755
--- a/src/Api/ApigeeX/Entity/Property/PaymentFundingModelPropertyAwareTrait.php
+++ b/src/Api/ApigeeX/Entity/Property/PaymentFundingModelPropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait PaymentFundingModelPropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\ApigeeX\Entity\Property\PaymentFundingModelPropertyInterface
+ * @see PaymentFundingModelPropertyInterface
*/
trait PaymentFundingModelPropertyAwareTrait
{
diff --git a/src/Api/ApigeeX/Entity/Property/RevenueShareTypePropertyAwareTrait.php b/src/Api/ApigeeX/Entity/Property/RevenueShareTypePropertyAwareTrait.php
index 38bc6949b..4fda0e37e 100755
--- a/src/Api/ApigeeX/Entity/Property/RevenueShareTypePropertyAwareTrait.php
+++ b/src/Api/ApigeeX/Entity/Property/RevenueShareTypePropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait RevenueShareTypePropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\ApigeeX\Entity\Property\RevenueShareTypePropertyInterface
+ * @see RevenueShareTypePropertyInterface
*/
trait RevenueShareTypePropertyAwareTrait
{
diff --git a/src/Api/ApigeeX/Entity/Property/StartTimePropertyAwareTrait.php b/src/Api/ApigeeX/Entity/Property/StartTimePropertyAwareTrait.php
index eddb22135..93e1efea7 100755
--- a/src/Api/ApigeeX/Entity/Property/StartTimePropertyAwareTrait.php
+++ b/src/Api/ApigeeX/Entity/Property/StartTimePropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait StartTimePropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\ApigeeX\Entity\Property\StartTimePropertyInterface
+ * @see StartTimePropertyInterface
*/
trait StartTimePropertyAwareTrait
{
diff --git a/src/Api/ApigeeX/Entity/Property/UnitsPropertyAwareTrait.php b/src/Api/ApigeeX/Entity/Property/UnitsPropertyAwareTrait.php
index 28e433add..c7bef982d 100755
--- a/src/Api/ApigeeX/Entity/Property/UnitsPropertyAwareTrait.php
+++ b/src/Api/ApigeeX/Entity/Property/UnitsPropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait UnitsPropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\ApigeeX\Entity\Property\UnitsPropertyInterface
+ * @see UnitsPropertyInterface
*/
trait UnitsPropertyAwareTrait
{
diff --git a/src/Api/ApigeeX/Entity/RatePlan.php b/src/Api/ApigeeX/Entity/RatePlan.php
index c26cbf9bd..431889b7e 100755
--- a/src/Api/ApigeeX/Entity/RatePlan.php
+++ b/src/Api/ApigeeX/Entity/RatePlan.php
@@ -59,7 +59,7 @@ abstract class RatePlan extends Entity implements RatePlanInterface
/**
* It can be null when a new rate plan is created.
*
- * @var \Apigee\Edge\Api\ApigeeX\Entity\ApiProduct|null
+ * @var ApiProduct|null
*/
protected $package;
diff --git a/src/Api/ApigeeX/Entity/RatePlanInterface.php b/src/Api/ApigeeX/Entity/RatePlanInterface.php
index 03ff093fb..34d8e529c 100755
--- a/src/Api/ApigeeX/Entity/RatePlanInterface.php
+++ b/src/Api/ApigeeX/Entity/RatePlanInterface.php
@@ -58,12 +58,12 @@ interface RatePlanInterface extends
/**
* It could be null only when a rate plan is created.
*
- * @return \Apigee\Edge\Api\ApigeeX\Entity\ApiProductInterface|null
+ * @return ApiProductInterface|null
*/
public function getPackage(): ?ApiProductInterface;
/**
- * @param \Apigee\Edge\Api\ApigeeX\Entity\ApiProductInterface $package
+ * @param ApiProductInterface $package
*/
public function setPackage(ApiProductInterface $package): void;
@@ -73,7 +73,7 @@ public function setPackage(ApiProductInterface $package): void;
public function getRatePlanxFee(): array;
/**
- * @param \Apigee\Edge\Api\ApigeeX\Structure\RatePlanXFee ...$ratePlanXFee
+ * @param RatePlanXFee ...$ratePlanXFee
*/
public function setRatePlanxFee(RatePlanXFee ...$ratePlanXFee): void;
@@ -83,7 +83,7 @@ public function setRatePlanxFee(RatePlanXFee ...$ratePlanXFee): void;
public function getFixedRecurringFee(): array;
/**
- * @param \Apigee\Edge\Api\ApigeeX\Structure\FixedRecurringFee ...$fixedRecurringFee
+ * @param FixedRecurringFee ...$fixedRecurringFee
*/
public function setFixedRecurringFee(FixedRecurringFee ...$fixedRecurringFee): void;
@@ -93,7 +93,7 @@ public function setFixedRecurringFee(FixedRecurringFee ...$fixedRecurringFee): v
public function getConsumptionPricingRates(): array;
/**
- * @param \Apigee\Edge\Api\ApigeeX\Structure\ConsumptionPricingRate ...$consumptionPricingRates
+ * @param ConsumptionPricingRate ...$consumptionPricingRates
*/
public function setConsumptionPricingRates(ConsumptionPricingRate ...$consumptionPricingRates): void;
@@ -103,7 +103,7 @@ public function setConsumptionPricingRates(ConsumptionPricingRate ...$consumptio
public function getRevenueShareRates(): array;
/**
- * @param \Apigee\Edge\Api\ApigeeX\Structure\RevenueShareRates ...$revenueShareRates
+ * @param RevenueShareRates ...$revenueShareRates
*/
public function setRevenueShareRates(RevenueShareRates ...$revenueShareRates): void;
}
diff --git a/src/Api/ApigeeX/Normalizer/AcceptedRatePlanNormalizer.php b/src/Api/ApigeeX/Normalizer/AcceptedRatePlanNormalizer.php
index daaf8bdd6..e84a51c48 100755
--- a/src/Api/ApigeeX/Normalizer/AcceptedRatePlanNormalizer.php
+++ b/src/Api/ApigeeX/Normalizer/AcceptedRatePlanNormalizer.php
@@ -34,7 +34,7 @@ class AcceptedRatePlanNormalizer extends EntityNormalizer
*/
public function normalize($object, $format = null, array $context = [])
{
- /** @var \Apigee\Edge\Api\ApigeeX\Entity\AcceptedRatePlanInterface $object */
+ /** @var AcceptedRatePlanInterface $object */
/** @var object $normalized */
$normalized = parent::normalize($object, $format, $context);
diff --git a/src/Api/ApigeeX/Normalizer/ApiProductNormalizer.php b/src/Api/ApigeeX/Normalizer/ApiProductNormalizer.php
index 3facc018f..05ab9e6c5 100755
--- a/src/Api/ApigeeX/Normalizer/ApiProductNormalizer.php
+++ b/src/Api/ApigeeX/Normalizer/ApiProductNormalizer.php
@@ -31,10 +31,10 @@ class ApiProductNormalizer extends EntityNormalizer
/**
* ApiProductNormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/ApigeeX/Normalizer/AppGroupMembershipNormalizer.php b/src/Api/ApigeeX/Normalizer/AppGroupMembershipNormalizer.php
index ebf63f593..f0fba9e9f 100644
--- a/src/Api/ApigeeX/Normalizer/AppGroupMembershipNormalizer.php
+++ b/src/Api/ApigeeX/Normalizer/AppGroupMembershipNormalizer.php
@@ -33,7 +33,7 @@ public function normalize($object, $format = null, array $context = [])
{
$normalized = [];
- /** @var \Apigee\Edge\Api\ApigeeX\Structure\AppGroupMembership $object */
+ /** @var AppGroupMembership $object */
foreach ($object->getMembers() as $member => $role) {
$normalized[] = ['developer' => $member, 'roles' => $role];
}
diff --git a/src/Api/ApigeeX/Normalizer/AppNormalizer.php b/src/Api/ApigeeX/Normalizer/AppNormalizer.php
index c17990a65..3f7b3564a 100644
--- a/src/Api/ApigeeX/Normalizer/AppNormalizer.php
+++ b/src/Api/ApigeeX/Normalizer/AppNormalizer.php
@@ -54,4 +54,14 @@ public function normalize($object, $format = null, array $context = [])
return $normalized;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ AppInterface::class => true,
+ ];
+ }
}
diff --git a/src/Api/ApigeeX/Normalizer/BillingTypeNormalizer.php b/src/Api/ApigeeX/Normalizer/BillingTypeNormalizer.php
index 70cc46327..a7e73b0da 100644
--- a/src/Api/ApigeeX/Normalizer/BillingTypeNormalizer.php
+++ b/src/Api/ApigeeX/Normalizer/BillingTypeNormalizer.php
@@ -31,7 +31,7 @@ class BillingTypeNormalizer extends EntityNormalizer
*/
public function normalize($object, $format = null, array $context = [])
{
- /** @var \Apigee\Edge\Api\ApigeeX\Entity\BillingTypeInterface $object */
+ /** @var BillingTypeInterface $object */
/** @var object $normalized */
$normalized = parent::normalize($object, $format, $context);
diff --git a/src/Api/ApigeeX/Normalizer/PrepaidBalanceNormalizer.php b/src/Api/ApigeeX/Normalizer/PrepaidBalanceNormalizer.php
index e360f7c06..72f9bb10a 100755
--- a/src/Api/ApigeeX/Normalizer/PrepaidBalanceNormalizer.php
+++ b/src/Api/ApigeeX/Normalizer/PrepaidBalanceNormalizer.php
@@ -31,10 +31,10 @@ class PrepaidBalanceNormalizer extends EntityNormalizer
/**
* PrepaidBalanceNormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/ApigeeX/Normalizer/RatePlanNormalizer.php b/src/Api/ApigeeX/Normalizer/RatePlanNormalizer.php
index c369fe0fb..c8a45393e 100755
--- a/src/Api/ApigeeX/Normalizer/RatePlanNormalizer.php
+++ b/src/Api/ApigeeX/Normalizer/RatePlanNormalizer.php
@@ -35,10 +35,10 @@ abstract class RatePlanNormalizer extends EntityNormalizer
/**
* RatePlanNormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
@@ -59,7 +59,7 @@ public function normalize($object, $format = null, array $context = [])
// Fix the start- and end date of the rate plan if the organization's
// timezone is different from the default PHP timezone.
- /** @var \Apigee\Edge\Api\ApigeeX\Entity\RatePlanInterface $object */
+ /** @var RatePlanInterface $object */
if (null === $object->getPackage()) {
throw new UninitializedPropertyException($object, 'package', 'Apigee\Edge\Api\ApigeeX\Entity\ApiProductInterface');
}
diff --git a/src/Api/ApigeeX/Normalizer/RatePlanNormalizerFactory.php b/src/Api/ApigeeX/Normalizer/RatePlanNormalizerFactory.php
index 7307b0cbc..3debb38aa 100755
--- a/src/Api/ApigeeX/Normalizer/RatePlanNormalizerFactory.php
+++ b/src/Api/ApigeeX/Normalizer/RatePlanNormalizerFactory.php
@@ -93,4 +93,14 @@ public function setSerializer(SerializerInterface $serializer): void
}
}
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ '*' => false,
+ ];
+ }
}
diff --git a/src/Api/ApigeeX/Serializer/AppGroupMembershipSerializer.php b/src/Api/ApigeeX/Serializer/AppGroupMembershipSerializer.php
index 80a7e5fb3..b912560e1 100644
--- a/src/Api/ApigeeX/Serializer/AppGroupMembershipSerializer.php
+++ b/src/Api/ApigeeX/Serializer/AppGroupMembershipSerializer.php
@@ -32,7 +32,7 @@ class AppGroupMembershipSerializer extends EntitySerializer
public function __construct($normalizers = [])
{
$normalizers = array_merge($normalizers, [
- new AppgroupMembershipDenormalizer(), new AppgroupMembershipNormalizer(),
+ new AppGroupMembershipDenormalizer(), new AppGroupMembershipNormalizer(),
]);
parent::__construct($normalizers);
}
diff --git a/src/Api/ApigeeX/Structure/AppGroupMembership.php b/src/Api/ApigeeX/Structure/AppGroupMembership.php
index dae3fed16..488f1971f 100644
--- a/src/Api/ApigeeX/Structure/AppGroupMembership.php
+++ b/src/Api/ApigeeX/Structure/AppGroupMembership.php
@@ -112,10 +112,10 @@ public function isMember(string $email): bool
* @param string $email
* Developer email address.
*
- * @return string|null
+ * @return array|null
* Developer role if set, NULL otherwise.
*/
- public function getRole(string $email): ?string
+ public function getRole(string $email): ?array
{
return $this->members[$email] ?? null;
}
diff --git a/src/Api/ApigeeX/Structure/ConsumptionPricingRate.php b/src/Api/ApigeeX/Structure/ConsumptionPricingRate.php
index 3505abf06..3a7e8c0d2 100755
--- a/src/Api/ApigeeX/Structure/ConsumptionPricingRate.php
+++ b/src/Api/ApigeeX/Structure/ConsumptionPricingRate.php
@@ -44,9 +44,9 @@ final class ConsumptionPricingRate extends BaseObject
private $start;
/**
- * @var \Apigee\Edge\Api\ApigeeX\Structure\Fee|null
+ * @var Fee|null
*/
- private $fee = null;
+ private $fee;
/**
* @return string|null
@@ -81,7 +81,7 @@ public function setStart(string $start): void
}
/**
- * @return \Apigee\Edge\Api\ApigeeX\Structure\Fee|null
+ * @return Fee|null
*/
public function getFee(): ?Fee
{
@@ -89,7 +89,7 @@ public function getFee(): ?Fee
}
/**
- * @param \Apigee\Edge\Api\ApigeeX\Structure\Fee $fee
+ * @param Fee $fee
*/
public function setFee(Fee $fee): void
{
diff --git a/src/Api/ApigeeX/Structure/PagerInterface.php b/src/Api/ApigeeX/Structure/PagerInterface.php
new file mode 100644
index 000000000..05e854023
--- /dev/null
+++ b/src/Api/ApigeeX/Structure/PagerInterface.php
@@ -0,0 +1,55 @@
+listEntityIds($pager, []);
}
@@ -84,7 +84,7 @@ public function listAppIds(PagerInterface $pager = null): array
/**
* {@inheritdoc}
*/
- public function listApps(bool $includeCredentials = true, PagerInterface $pager = null): array
+ public function listApps(bool $includeCredentials = true, ?PagerInterface $pager = null): array
{
$queryParams = [
'includeCred' => $includeCredentials ? 'true' : 'false',
@@ -96,7 +96,7 @@ public function listApps(bool $includeCredentials = true, PagerInterface $pager
/**
* {@inheritdoc}
*/
- public function listAppIdsByStatus(string $status, PagerInterface $pager = null): array
+ public function listAppIdsByStatus(string $status, ?PagerInterface $pager = null): array
{
$queryParams = [
'status' => $status,
@@ -111,7 +111,7 @@ public function listAppIdsByStatus(string $status, PagerInterface $pager = null)
public function listAppsByStatus(
string $status,
bool $includeCredentials = true,
- PagerInterface $pager = null
+ ?PagerInterface $pager = null,
): array {
$queryParams = [
'status' => $status,
@@ -124,7 +124,7 @@ public function listAppsByStatus(
/**
* {@inheritdoc}
*/
- public function listAppIdsByType(string $appType, PagerInterface $pager = null): array
+ public function listAppIdsByType(string $appType, ?PagerInterface $pager = null): array
{
$queryParams = [
'apptype' => $appType,
@@ -136,7 +136,7 @@ public function listAppIdsByType(string $appType, PagerInterface $pager = null):
/**
* {@inheritdoc}
*/
- public function listAppIdsByFamily(string $appFamily, PagerInterface $pager = null): array
+ public function listAppIdsByFamily(string $appFamily, ?PagerInterface $pager = null): array
{
$queryParams = [
'appfamily' => $appFamily,
@@ -167,9 +167,9 @@ protected function getEntityClass(): string
* {@inheritdoc}
*/
protected function listEntities(
- PagerInterface $pager = null,
+ ?PagerInterface $pager = null,
array $query_params = [],
- string $idGetter = null
+ ?string $idGetter = null,
): array {
$idGetter = $idGetter ?? static::ID_GETTER;
diff --git a/src/Api/Management/Controller/AppControllerInterface.php b/src/Api/Management/Controller/AppControllerInterface.php
index 94b256006..0896bbc57 100644
--- a/src/Api/Management/Controller/AppControllerInterface.php
+++ b/src/Api/Management/Controller/AppControllerInterface.php
@@ -58,7 +58,7 @@ interface AppControllerInterface extends PaginatedEntityControllerInterface, Ent
* @param string $appId
* UUID of an app (appId).
*
- * @return \Apigee\Edge\Api\Management\Entity\AppInterface
+ * @return AppInterface
* A developer- or a company app entity.
*/
public function loadApp(string $appId): AppInterface;
@@ -66,39 +66,39 @@ public function loadApp(string $appId): AppInterface;
/**
* Returns list of app ids from Edge.
*
- * @param \Apigee\Edge\Structure\PagerInterface|null $pager
+ * @param PagerInterface|null $pager
* Number of results to return.
*
* @return string[]
* An array of developer- and company app ids.
*/
- public function listAppIds(PagerInterface $pager = null): array;
+ public function listAppIds(?PagerInterface $pager = null): array;
/**
* Returns list of app entities from Edge. The returned number of entities can be limited.
*
* @param bool $includeCredentials
* Whether to include consumer key and secret for each app in the response or not.
- * @param \Apigee\Edge\Structure\PagerInterface|null $pager
+ * @param PagerInterface|null $pager
* Number of results to return.
*
* @return \Apigee\Edge\Api\Management\Entity\AppInterface[]
* An array that can contain both developer- and company app entities.
*/
- public function listApps(bool $includeCredentials = false, PagerInterface $pager = null): array;
+ public function listApps(bool $includeCredentials = false, ?PagerInterface $pager = null): array;
/**
* Returns a list of app ids filtered by status from Edge.
*
* @param string $status
* App status. (Recommended way is to use App entity constants.)
- * @param \Apigee\Edge\Structure\PagerInterface|null $pager
+ * @param PagerInterface|null $pager
* Number of results to return.
*
* @return string[]
* An array of developer- and company app ids.
*/
- public function listAppIdsByStatus(string $status, PagerInterface $pager = null): array;
+ public function listAppIdsByStatus(string $status, ?PagerInterface $pager = null): array;
/**
* Returns a list of app entities filtered by status from Edge.
@@ -107,7 +107,7 @@ public function listAppIdsByStatus(string $status, PagerInterface $pager = null)
* App status. (Recommended way is to use App entity constants.)
* @param bool $includeCredentials
* Whether to include app credentials in the response or not.
- * @param \Apigee\Edge\Structure\PagerInterface|null $pager
+ * @param PagerInterface|null $pager
* Number of results to return.
*
* @return \Apigee\Edge\Api\Management\Entity\AppInterface[]
@@ -116,7 +116,7 @@ public function listAppIdsByStatus(string $status, PagerInterface $pager = null)
public function listAppsByStatus(
string $status,
bool $includeCredentials = true,
- PagerInterface $pager = null
+ ?PagerInterface $pager = null,
): array;
/**
@@ -124,24 +124,24 @@ public function listAppsByStatus(
*
* @param string $appType
* Either "developer" or "company".
- * @param \Apigee\Edge\Structure\PagerInterface|null $pager
+ * @param PagerInterface|null $pager
* Number of results to return.
*
* @return string[]
* An array of developer- and company app ids.
*/
- public function listAppIdsByType(string $appType, PagerInterface $pager = null): array;
+ public function listAppIdsByType(string $appType, ?PagerInterface $pager = null): array;
/**
* Returns a list of app ids filtered by app family from Edge.
*
* @param string $appFamily
* App family, example: default.
- * @param \Apigee\Edge\Structure\PagerInterface|null $pager
+ * @param PagerInterface|null $pager
* Number of results to return.
*
* @return string[]
* An array of developer- and company app ids.
*/
- public function listAppIdsByFamily(string $appFamily, PagerInterface $pager = null): array;
+ public function listAppIdsByFamily(string $appFamily, ?PagerInterface $pager = null): array;
}
diff --git a/src/Api/Management/Controller/AppCredentialController.php b/src/Api/Management/Controller/AppCredentialController.php
index ddcafac7d..75a0497c0 100644
--- a/src/Api/Management/Controller/AppCredentialController.php
+++ b/src/Api/Management/Controller/AppCredentialController.php
@@ -43,8 +43,8 @@ abstract class AppCredentialController extends EntityController implements AppCr
*
* @param string $organization
* @param string $appName
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $organization, string $appName, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
@@ -79,7 +79,7 @@ public function generate(
AttributesProperty $appAttributes,
string $callbackUrl,
array $scopes = [],
- string $keyExpiresIn = '-1'
+ string $keyExpiresIn = '-1',
): AppCredentialInterface {
$response = $this->client->put(
$this->getBaseEndpointUri(),
@@ -172,10 +172,10 @@ public function load(string $consumerKey): AppCredentialInterface
$response = $this->client->get($this->getEntityEndpointUri($consumerKey));
return $this->entitySerializer->deserialize(
- (string) $response->getBody(),
- $this->getEntityClass(),
- 'json'
- );
+ (string) $response->getBody(),
+ $this->getEntityClass(),
+ 'json'
+ );
}
/**
@@ -186,10 +186,10 @@ public function delete(string $consumerKey): AppCredentialInterface
$response = $this->client->delete($this->getEntityEndpointUri($consumerKey));
return $this->entitySerializer->deserialize(
- (string) $response->getBody(),
- $this->getEntityClass(),
- 'json'
- );
+ (string) $response->getBody(),
+ $this->getEntityClass(),
+ 'json'
+ );
}
/**
diff --git a/src/Api/Management/Controller/AppCredentialControllerInterface.php b/src/Api/Management/Controller/AppCredentialControllerInterface.php
index 78a808381..6a8cd8309 100644
--- a/src/Api/Management/Controller/AppCredentialControllerInterface.php
+++ b/src/Api/Management/Controller/AppCredentialControllerInterface.php
@@ -49,7 +49,7 @@ interface AppCredentialControllerInterface extends
*
* @throws \Apigee\Edge\Exception\ClientErrorException
*
- * @return \Apigee\Edge\Api\Management\Entity\AppCredentialInterface
+ * @return AppCredentialInterface
*
* @see https://docs.apigee.com/management/apis/post/organizations/%7Borg_name%7D/developers/%7Bdeveloper_email_or_id%7D/apps/%7Bapp_name%7D/keys/create
*/
@@ -62,7 +62,7 @@ public function create(string $consumerKey, string $consumerSecret): AppCredenti
*
* @param string[] $apiProducts
* API Product names.
- * @param \Apigee\Edge\Structure\AttributesProperty $appAttributes
+ * @param AttributesProperty $appAttributes
* Current attributes of the app. "In this API call, be sure to include any existing app attributes.
* If you don't, the existing attributes are deleted."
* @param string $callbackUrl
@@ -72,14 +72,14 @@ public function create(string $consumerKey, string $consumerSecret): AppCredenti
* @param string $keyExpiresIn
* In milliseconds. A value of -1 means the key/secret pair never expire.
*
- * @return \Apigee\Edge\Api\Management\Entity\AppCredentialInterface
+ * @return AppCredentialInterface
*/
public function generate(
array $apiProducts,
AttributesProperty $appAttributes,
string $callbackUrl,
array $scopes = [],
- string $keyExpiresIn = '-1'
+ string $keyExpiresIn = '-1',
): AppCredentialInterface;
/**
@@ -95,7 +95,7 @@ public function generate(
* @param string[] $apiProducts
* API Product names.
*
- * @return \Apigee\Edge\Api\Management\Entity\AppCredentialInterface
+ * @return AppCredentialInterface
*/
public function addProducts(string $consumerKey, array $apiProducts): AppCredentialInterface;
@@ -128,7 +128,7 @@ public function setApiProductStatus(string $consumerKey, string $apiProduct, str
*
* @param string $consumerKey
*
- * @return \Apigee\Edge\Api\Management\Entity\AppCredentialInterface
+ * @return AppCredentialInterface
*/
public function delete(string $consumerKey): AppCredentialInterface;
@@ -140,7 +140,7 @@ public function delete(string $consumerKey): AppCredentialInterface;
* @param string $consumerKey
* @param string $apiProduct
*
- * @return \Apigee\Edge\Api\Management\Entity\AppCredentialInterface
+ * @return AppCredentialInterface
*/
public function deleteApiProduct(string $consumerKey, string $apiProduct): AppCredentialInterface;
@@ -151,7 +151,7 @@ public function deleteApiProduct(string $consumerKey, string $apiProduct): AppCr
*
* @param string $consumerKey
*
- * @return \Apigee\Edge\Api\Management\Entity\AppCredentialInterface
+ * @return AppCredentialInterface
*/
public function load(string $consumerKey): AppCredentialInterface;
@@ -167,7 +167,7 @@ public function load(string $consumerKey): AppCredentialInterface;
* The consumer key to modify.
* @param string[] $scopes
*
- * @return \Apigee\Edge\Api\Management\Entity\AppCredentialInterface
+ * @return AppCredentialInterface
*/
public function overrideScopes(string $consumerKey, array $scopes): AppCredentialInterface;
}
diff --git a/src/Api/Management/Controller/AttributesAwareEntityControllerTrait.php b/src/Api/Management/Controller/AttributesAwareEntityControllerTrait.php
index b93ed58d0..5f5f3f820 100644
--- a/src/Api/Management/Controller/AttributesAwareEntityControllerTrait.php
+++ b/src/Api/Management/Controller/AttributesAwareEntityControllerTrait.php
@@ -28,7 +28,7 @@
/**
* Trait AttributesAwareEntityControllerTrait.
*
- * @see \Apigee\Edge\Api\Management\Controller\AttributesAwareEntityControllerInterface
+ * @see AttributesAwareEntityControllerInterface
*/
trait AttributesAwareEntityControllerTrait
{
diff --git a/src/Api/Management/Controller/CompanyAppController.php b/src/Api/Management/Controller/CompanyAppController.php
index f401ee7f9..6e30fdee6 100644
--- a/src/Api/Management/Controller/CompanyAppController.php
+++ b/src/Api/Management/Controller/CompanyAppController.php
@@ -31,7 +31,7 @@ class CompanyAppController extends AppByOwnerController implements CompanyAppCon
{
use CompanyAwareControllerTrait;
/**
- * @var \Apigee\Edge\Api\Management\Controller\OrganizationControllerInterface
+ * @var OrganizationControllerInterface
*/
protected $organizationController;
@@ -40,16 +40,16 @@ class CompanyAppController extends AppByOwnerController implements CompanyAppCon
*
* @param string $organization
* @param string $companyName
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
- * @param \Apigee\Edge\Api\Management\Controller\OrganizationControllerInterface|null $organizationController
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
+ * @param OrganizationControllerInterface|null $organizationController
*/
public function __construct(
string $organization,
string $companyName,
ClientInterface $client,
?EntitySerializerInterface $entitySerializer = null,
- ?OrganizationControllerInterface $organizationController = null
+ ?OrganizationControllerInterface $organizationController = null,
) {
$this->companyName = $companyName;
$entitySerializer = $entitySerializer ?? new AppEntitySerializer();
diff --git a/src/Api/Management/Controller/CompanyAppCredentialController.php b/src/Api/Management/Controller/CompanyAppCredentialController.php
index fd09e90bd..b091b5335 100644
--- a/src/Api/Management/Controller/CompanyAppCredentialController.php
+++ b/src/Api/Management/Controller/CompanyAppCredentialController.php
@@ -38,15 +38,15 @@ class CompanyAppCredentialController extends AppCredentialController implements
* @param string $organization
* @param string $companyName
* @param string $appName
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(
string $organization,
string $companyName,
string $appName,
ClientInterface $client,
- ?EntitySerializerInterface $entitySerializer = null
+ ?EntitySerializerInterface $entitySerializer = null,
) {
$this->companyName = $companyName;
parent::__construct($organization, $appName, $client, $entitySerializer);
diff --git a/src/Api/Management/Controller/CompanyAwareControllerTrait.php b/src/Api/Management/Controller/CompanyAwareControllerTrait.php
index c0d7489cc..80ab99cff 100644
--- a/src/Api/Management/Controller/CompanyAwareControllerTrait.php
+++ b/src/Api/Management/Controller/CompanyAwareControllerTrait.php
@@ -21,7 +21,7 @@
/**
* Trait CompanyAwareControllerTrait.
*
- * @see \Apigee\Edge\Api\Management\Controller\CompanyAwareControllerInterface
+ * @see CompanyAwareControllerInterface
*/
trait CompanyAwareControllerTrait
{
diff --git a/src/Api/Management/Controller/CompanyController.php b/src/Api/Management/Controller/CompanyController.php
index 69aeae480..3379fba85 100644
--- a/src/Api/Management/Controller/CompanyController.php
+++ b/src/Api/Management/Controller/CompanyController.php
@@ -48,9 +48,9 @@ class CompanyController extends PaginatedEntityController implements CompanyCont
* CompanyController constructor.
*
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
- * @param \Apigee\Edge\Api\Management\Controller\OrganizationControllerInterface|null $organizationController
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
+ * @param OrganizationControllerInterface|null $organizationController
*/
public function __construct(string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null, ?OrganizationControllerInterface $organizationController = null)
{
diff --git a/src/Api/Management/Controller/CompanyMembersController.php b/src/Api/Management/Controller/CompanyMembersController.php
index 6faed0b1e..d190f00a5 100644
--- a/src/Api/Management/Controller/CompanyMembersController.php
+++ b/src/Api/Management/Controller/CompanyMembersController.php
@@ -46,7 +46,7 @@ class CompanyMembersController extends AbstractController implements CompanyMemb
*
* @param string $companyName
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
+ * @param ClientInterface $client
*/
public function __construct(string $companyName, string $organization, ClientInterface $client)
{
diff --git a/src/Api/Management/Controller/CompanyMembersControllerInterface.php b/src/Api/Management/Controller/CompanyMembersControllerInterface.php
index 983f1f37d..58ad194a1 100644
--- a/src/Api/Management/Controller/CompanyMembersControllerInterface.php
+++ b/src/Api/Management/Controller/CompanyMembersControllerInterface.php
@@ -30,7 +30,7 @@ interface CompanyMembersControllerInterface extends CompanyAwareControllerInterf
/**
* List all developers associated with a company.
*
- * @return \Apigee\Edge\Api\Management\Structure\CompanyMembership
+ * @return CompanyMembership
* Array of developers with their optional roles in the company.
*/
public function getMembers(): CompanyMembership;
@@ -41,10 +41,10 @@ public function getMembers(): CompanyMembership;
* WARNING! If you pass en empty membership object you remove all developers
* from the company.
*
- * @param \Apigee\Edge\Api\Management\Structure\CompanyMembership $members
+ * @param CompanyMembership $members
* Membership object with the changes to be applied.
*
- * @return \Apigee\Edge\Api\Management\Structure\CompanyMembership
+ * @return CompanyMembership
* Membership object with the applied changes, it does not contain all
* members. Use getMembers() to retrieve them.
*/
diff --git a/src/Api/Management/Controller/DeveloperAppController.php b/src/Api/Management/Controller/DeveloperAppController.php
index 4ea5d8d58..9e8b66685 100644
--- a/src/Api/Management/Controller/DeveloperAppController.php
+++ b/src/Api/Management/Controller/DeveloperAppController.php
@@ -33,7 +33,7 @@ class DeveloperAppController extends AppByOwnerController implements DeveloperAp
protected $developerId;
/**
- * @var \Apigee\Edge\Api\Management\Controller\OrganizationControllerInterface
+ * @var OrganizationControllerInterface
*/
protected $organizationController;
@@ -42,16 +42,16 @@ class DeveloperAppController extends AppByOwnerController implements DeveloperAp
*
* @param string $organization
* @param string $developerId
- * @param \Apigee\Edge\ClientInterface $client
+ * @param ClientInterface $client
* @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
- * @param \Apigee\Edge\Api\Management\Controller\OrganizationControllerInterface|null $organizationController
+ * @param OrganizationControllerInterface|null $organizationController
*/
public function __construct(
string $organization,
string $developerId,
ClientInterface $client,
?\Apigee\Edge\Serializer\EntitySerializerInterface $entitySerializer = null,
- ?OrganizationControllerInterface $organizationController = null
+ ?OrganizationControllerInterface $organizationController = null,
) {
$this->developerId = $developerId;
$this->organizationController = $organizationController ?? new OrganizationController($client);
diff --git a/src/Api/Management/Controller/DeveloperAppCredentialController.php b/src/Api/Management/Controller/DeveloperAppCredentialController.php
index 560f8f7c2..57d59dfd0 100644
--- a/src/Api/Management/Controller/DeveloperAppCredentialController.php
+++ b/src/Api/Management/Controller/DeveloperAppCredentialController.php
@@ -39,15 +39,15 @@ class DeveloperAppCredentialController extends AppCredentialController implement
* @param string $organization
* @param string $developerId
* @param string $appName
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(
string $organization,
string $developerId,
string $appName,
ClientInterface $client,
- ?EntitySerializerInterface $entitySerializer = null
+ ?EntitySerializerInterface $entitySerializer = null,
) {
$this->developerId = $developerId;
parent::__construct($organization, $appName, $client, $entitySerializer);
diff --git a/src/Api/Management/Controller/DeveloperController.php b/src/Api/Management/Controller/DeveloperController.php
index 29554f8d5..483adf650 100644
--- a/src/Api/Management/Controller/DeveloperController.php
+++ b/src/Api/Management/Controller/DeveloperController.php
@@ -54,8 +54,8 @@ class DeveloperController extends PaginatedEntityController implements Developer
* DeveloperController constructor.
*
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
* @param OrganizationControllerInterface|null $organizationController
*/
public function __construct(string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null, ?OrganizationControllerInterface $organizationController = null)
@@ -87,8 +87,8 @@ public function getDeveloperByApp(string $appName): DeveloperInterface
* {@inheritdoc}
*/
public function getEntities(
- PagerInterface $pager = null,
- string $key_provider = 'id'
+ ?PagerInterface $pager = null,
+ string $key_provider = 'id',
): array {
// The getEntityIds() returns email addresses so we should use email
// addresses as keys in the array as well.
@@ -106,7 +106,7 @@ public function getEntities(
*/
public function update(EntityInterface $entity): void
{
- /** @var \Apigee\Edge\Api\Management\Entity\Developer $entity */
+ /** @var Developer $entity */
$developer_entity = $entity;
$uri = $this->getEntityEndpointUri($developer_entity->originalEmail());
$response = $this->getClient()->put(
diff --git a/src/Api/Management/Controller/EnvironmentController.php b/src/Api/Management/Controller/EnvironmentController.php
index 827d72d61..24fe7c939 100644
--- a/src/Api/Management/Controller/EnvironmentController.php
+++ b/src/Api/Management/Controller/EnvironmentController.php
@@ -39,13 +39,13 @@ class EnvironmentController extends EntityController implements EnvironmentContr
* EnvironmentController constructor.
*
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(
string $organization,
ClientInterface $client,
- ?EntitySerializerInterface $entitySerializer = null
+ ?EntitySerializerInterface $entitySerializer = null,
) {
$entitySerializer = $entitySerializer ?? new EnvironmentSerializer();
parent::__construct($organization, $client, $entitySerializer);
diff --git a/src/Api/Management/Controller/OrganizationController.php b/src/Api/Management/Controller/OrganizationController.php
index 4079bdbf3..8d05f5cf7 100644
--- a/src/Api/Management/Controller/OrganizationController.php
+++ b/src/Api/Management/Controller/OrganizationController.php
@@ -42,8 +42,8 @@ class OrganizationController extends AbstractEntityController implements Organiz
/**
* OrganizationController constructor.
*
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
@@ -51,6 +51,25 @@ public function __construct(ClientInterface $client, ?EntitySerializerInterface
parent::__construct($client, $entitySerializer);
}
+ /**
+ * Gets the project ID and region for an Apigee organization.
+ *
+ * This is only available for Apigee X organizations.
+ *
+ * @param string $organizationName
+ * The name of the organization.
+ *
+ * @return array
+ * Organization detail.
+ */
+ public function getProjectMapping(string $organizationName): array
+ {
+ $uri = $this->getBaseEndpointUri()->withPath("{$this->getBaseEndpointUri()}/{$organizationName}:getProjectMapping");
+ $response = $this->getClient()->get($uri);
+
+ return $this->responseToArray($response);
+ }
+
/**
* {@inheritdoc}
*/
diff --git a/src/Api/Management/Controller/StatsController.php b/src/Api/Management/Controller/StatsController.php
index a04a0dc31..05ca7c0f8 100644
--- a/src/Api/Management/Controller/StatsController.php
+++ b/src/Api/Management/Controller/StatsController.php
@@ -23,6 +23,8 @@
use Apigee\Edge\ClientInterface;
use Apigee\Edge\Controller\AbstractController;
use Apigee\Edge\Controller\OrganizationAwareControllerTrait;
+use DateTime;
+use InvalidArgumentException;
use League\Period\Period;
use Moment\Moment;
use Psr\Http\Message\UriInterface;
@@ -38,7 +40,7 @@ class StatsController extends AbstractController implements StatsControllerInter
/** @var string */
protected $environment;
- /** @var \Apigee\Edge\Api\Management\Query\StatsQueryNormalizer */
+ /** @var StatsQueryNormalizer */
protected $normalizer;
/** @var string */
@@ -51,7 +53,7 @@ class StatsController extends AbstractController implements StatsControllerInter
* The environment name.
* @param string $organization
* Name of the organization that the entities belongs to.
- * @param \Apigee\Edge\ClientInterface $client
+ * @param ClientInterface $client
* Apigee Edge API client.
*/
public function __construct(string $environment, string $organization, ClientInterface $client)
@@ -104,7 +106,7 @@ public function getMetrics(StatsQueryInterface $query, ?string $optimized = 'js'
* Stats query object.
*
* @throws \Moment\MomentException
- * @throws \InvalidArgumentException
+ * @throws InvalidArgumentException
* Find more information in fillGapsInTimeUnitsData() method.
*
* @return array
@@ -119,6 +121,7 @@ public function getOptimisedMetrics(StatsQueryInterface $query): array
if (empty($response['stats'])) {
return $response;
}
+
if (null !== $query->getTimeUnit()) {
$originalTimeUnits = $response['TimeUnit'];
$response['TimeUnit'] = $this->fillGapsInTimeUnitsData(
@@ -145,6 +148,7 @@ public function getOptimisedMetrics(StatsQueryInterface $query): array
public function getMetricsByDimensions(array $dimensions, StatsQueryInterface $query, ?string $optimized = 'js'): array
{
$query_params = (array) $this->normalizer->normalize($query);
+
if ('js' === $optimized && !$this->isHybrid()) {
$query_params += [
'_optimized' => $optimized,
@@ -179,7 +183,7 @@ public function getMetricsByDimensions(array $dimensions, StatsQueryInterface $q
* Stats query object.
*
* @throws \Moment\MomentException
- * @throws \InvalidArgumentException
+ * @throws InvalidArgumentException
* Find more information in fillGapsInTimeUnitsData() method.
*
* @return array
@@ -194,6 +198,7 @@ public function getOptimizedMetricsByDimensions(array $dimensions, StatsQueryInt
if (empty($response['stats'])) {
return $response;
}
+
if (null !== $query->getTimeUnit()) {
$originalTimeUnits = $response['TimeUnit'];
$response['TimeUnit'] = $this->fillGapsInTimeUnitsData(
@@ -247,7 +252,7 @@ protected function getBaseEndpointUri(): UriInterface
* Time unit from StatsQuery.
* @param bool $tsAscending
*
- * @throws \InvalidArgumentException
+ * @throws InvalidArgumentException
* If time unit is not supported by the Moment library.
* @throws \Moment\MomentException
*
@@ -261,19 +266,20 @@ private function fillGapsInTimeUnitsData(Period $period, string $timeUnit, bool
// unit to this function and they should rather use the "non-optimized" methods from the controller for
// retrieving data for these time periods.
if (in_array($timeUnit, ['decade', 'century', 'millennium'])) {
- throw new \InvalidArgumentException("The {$timeUnit} time unit is not supported by the https://github.com/fightbulc/moment.php library.");
+ throw new InvalidArgumentException("The {$timeUnit} time unit is not supported by the https://github.com/fightbulc/moment.php library.");
}
+
$allTimeUnits = [];
// Fix time unit for correct time interval calculation.
- $startDate = new Moment('@' . $period->getStartDate()->getTimestamp());
- $endDate = new Moment('@' . $period->getEndDate()->getTimestamp());
+ $startDate = new Moment('@' . $period->startDate->getTimestamp());
+ $endDate = new Moment('@' . $period->endDate->getTimestamp());
// Returned intervals by Apigee Edge are always inclusive-inclusive.
$startDate->startOf($timeUnit);
$endDate->endOf($timeUnit);
- $period = new Period($startDate, $endDate);
+ $period = Period::fromDate($startDate, $endDate);
$timeUnit = '1 ' . $timeUnit;
- /** @var \DateTime $dateTime */
- foreach ($period->getDatePeriod($timeUnit) as $dateTime) {
+ /** @var DateTime $dateTime */
+ foreach ($period->rangeForward($timeUnit) as $dateTime) {
$allTimeUnits[] = $dateTime->getTimestamp() * 1000;
}
@@ -309,8 +315,10 @@ private function fillGapsInMetricsData(bool $tsAscending, array $allTimeUnits, a
$needs_reindex = true;
continue;
}
+
$metricsData[$key]['values'] = array_combine($originalTimeUnits, $metric['values']);
$metricsData[$key]['values'] += $zeroArray;
+
if ($tsAscending) {
ksort($metricsData[$key]['values']);
} else {
@@ -319,6 +327,7 @@ private function fillGapsInMetricsData(bool $tsAscending, array $allTimeUnits, a
// Keep original numerical indexes.
$metricsData[$key]['values'] = array_values($metricsData[$key]['values']);
}
+
// Just in case, as a "BC layer", re-index the array.
if ($needs_reindex) {
$metricsData = array_values($metricsData);
@@ -326,13 +335,16 @@ private function fillGapsInMetricsData(bool $tsAscending, array $allTimeUnits, a
}
/**
- * Helper function to check current organization is Hybrid or Edge.
- *
- * @return bool
- * True if current organization is Hybrid otherwise False
- */
+ * Helper function to check current organization is Hybrid or Edge.
+ *
+ * @return bool
+ * True if current organization is Hybrid otherwise False
+ */
private function isHybrid(): bool
{
- return ClientInterface::APIGEE_ON_GCP_ENDPOINT === $this->getClient()->getEndpoint();
+ // Determines if the current endpoint is an ApigeeX endpoint.
+ $baseDomain = str_replace('https://', '', ClientInterface::APIGEE_ON_GCP_ENDPOINT);
+
+ return str_ends_with($this->getClient()->getEndpoint(), $baseDomain);
}
}
diff --git a/src/Api/Management/Denormalizer/CompanyMembershipDenormalizer.php b/src/Api/Management/Denormalizer/CompanyMembershipDenormalizer.php
index 42b3f38a1..828e6d5a5 100755
--- a/src/Api/Management/Denormalizer/CompanyMembershipDenormalizer.php
+++ b/src/Api/Management/Denormalizer/CompanyMembershipDenormalizer.php
@@ -53,4 +53,14 @@ public function supportsDenormalization($data, $type, $format = null)
return CompanyMembership::class === $type || $type instanceof CompanyMembership;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ CompanyMembership::class => true,
+ ];
+ }
}
diff --git a/src/Api/Management/Entity/ApiProduct.php b/src/Api/Management/Entity/ApiProduct.php
index aa0b84c75..17c89fb08 100644
--- a/src/Api/Management/Entity/ApiProduct.php
+++ b/src/Api/Management/Entity/ApiProduct.php
@@ -27,6 +27,7 @@
use Apigee\Edge\Entity\Property\NamePropertyAwareTrait;
use Apigee\Edge\Entity\Property\ScopesPropertyAwareTrait;
use Apigee\Edge\Structure\AttributesProperty;
+use ReflectionException;
/**
* Describes an API product entity.
@@ -76,7 +77,7 @@ class ApiProduct extends Entity implements ApiProductInterface
*
* @param array $values
*
- * @throws \ReflectionException
+ * @throws ReflectionException
*/
public function __construct(array $values = [])
{
diff --git a/src/Api/Management/Entity/App.php b/src/Api/Management/Entity/App.php
index 0b030015b..b089189db 100644
--- a/src/Api/Management/Entity/App.php
+++ b/src/Api/Management/Entity/App.php
@@ -25,6 +25,7 @@
use Apigee\Edge\Entity\Property\ScopesPropertyAwareTrait;
use Apigee\Edge\Entity\Property\StatusPropertyAwareTrait;
use Apigee\Edge\Structure\AttributesProperty;
+use LogicException;
/**
* Class App.
@@ -55,7 +56,7 @@ abstract class App extends Entity implements AppInterface
/** @var string Url, used for "three-legged" OAuth grant type flows. */
protected $callbackUrl;
- /** @var \Apigee\Edge\Api\Management\Entity\AppCredential[] */
+ /** @var AppCredential[] */
protected $credentials = [];
/** @var string[] */
@@ -187,6 +188,8 @@ public function setCallbackUrl(string $callbackUrl): void
*/
public function getCredentials(): array
{
+ usort($this->credentials, static fn (AppCredentialInterface $a, AppCredentialInterface $b) => $b->getIssuedAt() <=> $a->getIssuedAt());
+
return $this->credentials;
}
@@ -195,7 +198,7 @@ public function getCredentials(): array
*
* Credentials, included in app, can not be changed by modifying them on the entity level.
*
- * @param \Apigee\Edge\Api\Management\Entity\AppCredentialInterface ...$credentials
+ * @param AppCredentialInterface ...$credentials
*
* @internal
*/
@@ -238,14 +241,14 @@ final public function getApiProducts(): array
*
* @param array $initialApiProducts
*
- * @throws \LogicException If used to update existing App.
+ * @throws LogicException If used to update existing App.
*/
final public function setInitialApiProducts(array $initialApiProducts): void
{
if (!$this->appId) {
$this->initialApiProducts = $initialApiProducts;
} else {
- throw new \LogicException('This method is only supported for creating a new app.');
+ throw new LogicException('This method is only supported for creating a new app.');
}
}
}
diff --git a/src/Api/Management/Entity/AppCredential.php b/src/Api/Management/Entity/AppCredential.php
index 393465373..67507179a 100644
--- a/src/Api/Management/Entity/AppCredential.php
+++ b/src/Api/Management/Entity/AppCredential.php
@@ -24,6 +24,8 @@
use Apigee\Edge\Entity\Property\StatusPropertyAwareTrait;
use Apigee\Edge\Structure\AttributesProperty;
use Apigee\Edge\Structure\CredentialProductInterface;
+use DateTimeImmutable;
+use ReflectionException;
/**
* Class AppCredential.
@@ -52,11 +54,11 @@ class AppCredential extends Entity implements AppCredentialInterface
* never expires. So if this value is null then it either means that this is a new entity (check whether consumerKey
* or consumerSecret are also null) or this credential never expires.
*
- * @var \DateTimeImmutable|null
+ * @var DateTimeImmutable|null
*/
protected $expiresAt;
- /** @var \DateTimeImmutable */
+ /** @var DateTimeImmutable */
protected $issuedAt;
/**
@@ -64,7 +66,7 @@ class AppCredential extends Entity implements AppCredentialInterface
*
* @param array $values
*
- * @throws \ReflectionException
+ * @throws ReflectionException
*/
public function __construct(array $values = [])
{
@@ -93,7 +95,7 @@ public function getApiProducts(): array
*
* Included API products in an app credential can not be changed by modifying this property's value.
*
- * @param \Apigee\Edge\Structure\CredentialProductInterface ...$apiProducts
+ * @param CredentialProductInterface ...$apiProducts
*
* @internal
*/
@@ -149,7 +151,7 @@ public function setConsumerSecret(string $consumerSecret): void
/**
* {@inheritdoc}
*/
- public function getExpiresAt(): ?\DateTimeImmutable
+ public function getExpiresAt(): ?DateTimeImmutable
{
return $this->expiresAt;
}
@@ -159,7 +161,7 @@ public function getExpiresAt(): ?\DateTimeImmutable
*
* Expiration date can not be changed by modifying this property's value.
*
- * @param \DateTimeImmutable|null $date
+ * @param DateTimeImmutable|null $date
*
* @internal
*/
@@ -171,7 +173,7 @@ public function setExpiresAt($date): void
/**
* {@inheritdoc}
*/
- public function getIssuedAt(): ?\DateTimeImmutable
+ public function getIssuedAt(): ?DateTimeImmutable
{
return $this->issuedAt;
}
@@ -181,11 +183,11 @@ public function getIssuedAt(): ?\DateTimeImmutable
*
* Consumer key can not be changed by modifying this property's value.
*
- * @param \DateTimeImmutable $date
+ * @param DateTimeImmutable $date
*
* @internal
*/
- public function setIssuedAt(\DateTimeImmutable $date): void
+ public function setIssuedAt(DateTimeImmutable $date): void
{
$this->issuedAt = $date;
}
diff --git a/src/Api/Management/Entity/AppCredentialInterface.php b/src/Api/Management/Entity/AppCredentialInterface.php
index e043769f7..967c93f67 100644
--- a/src/Api/Management/Entity/AppCredentialInterface.php
+++ b/src/Api/Management/Entity/AppCredentialInterface.php
@@ -22,6 +22,7 @@
use Apigee\Edge\Entity\Property\AttributesPropertyInterface;
use Apigee\Edge\Entity\Property\ScopesPropertyInterface;
use Apigee\Edge\Entity\Property\StatusPropertyInterface;
+use DateTimeImmutable;
/**
* Interface AppCredentialInterface.
@@ -69,12 +70,12 @@ public function getConsumerKey(): string;
public function getConsumerSecret(): string;
/**
- * @return \DateTimeImmutable|null
+ * @return DateTimeImmutable|null
*/
- public function getExpiresAt(): ?\DateTimeImmutable;
+ public function getExpiresAt(): ?DateTimeImmutable;
/**
- * @return \DateTimeImmutable|null
+ * @return DateTimeImmutable|null
*/
- public function getIssuedAt(): ?\DateTimeImmutable;
+ public function getIssuedAt(): ?DateTimeImmutable;
}
diff --git a/src/Api/Management/Entity/Developer.php b/src/Api/Management/Entity/Developer.php
index 76b498794..13a20817f 100644
--- a/src/Api/Management/Entity/Developer.php
+++ b/src/Api/Management/Entity/Developer.php
@@ -45,10 +45,10 @@ class Developer extends AppOwner implements DeveloperInterface
protected $companies = [];
/**
- * The original email address of the developer.
- *
- * @var string|null
- */
+ * The original email address of the developer.
+ *
+ * @var string|null
+ */
private $originalEmail;
/**
diff --git a/src/Api/Management/Entity/Environment.php b/src/Api/Management/Entity/Environment.php
index c075e53b8..04dd139a6 100644
--- a/src/Api/Management/Entity/Environment.php
+++ b/src/Api/Management/Entity/Environment.php
@@ -23,6 +23,7 @@
use Apigee\Edge\Entity\Property\NamePropertyAwareTrait;
use Apigee\Edge\Entity\Property\PropertiesPropertyAwareTrait;
use Apigee\Edge\Structure\PropertiesProperty;
+use ReflectionException;
/**
* Class Environment.
@@ -41,7 +42,7 @@ class Environment extends Entity implements EnvironmentInterface
*
* @param array $values
*
- * @throws \ReflectionException
+ * @throws ReflectionException
*/
public function __construct(array $values = [])
{
diff --git a/src/Api/Management/Entity/Organization.php b/src/Api/Management/Entity/Organization.php
index 3640bc695..adcbe7c3b 100644
--- a/src/Api/Management/Entity/Organization.php
+++ b/src/Api/Management/Entity/Organization.php
@@ -27,6 +27,8 @@
use Apigee\Edge\Entity\Property\RuntimeTypeAwareTrait;
use Apigee\Edge\Structure\AddonsConfig;
use Apigee\Edge\Structure\PropertiesProperty;
+use InvalidArgumentException;
+use ReflectionException;
/**
* Describes an Organization entity.
@@ -55,16 +57,16 @@ class Organization extends Entity implements OrganizationInterface
protected $type;
/**
- * @var \Apigee\Edge\Structure\AddonsConfig|null
+ * @var AddonsConfig|null
*/
- protected $addonsConfig = null;
+ protected $addonsConfig;
/**
* Organization constructor.
*
* @param array $values
*
- * @throws \ReflectionException
+ * @throws ReflectionException
*/
public function __construct(array $values = [])
{
@@ -86,7 +88,7 @@ public function getType(): ?string
public function setType(string $type): void
{
if (!in_array($type, self::TYPES)) {
- throw new \InvalidArgumentException("{$type} type is not a valid.");
+ throw new InvalidArgumentException("{$type} type is not a valid.");
}
$this->type = $type;
}
diff --git a/src/Api/Management/Entity/OrganizationInterface.php b/src/Api/Management/Entity/OrganizationInterface.php
index ad6669a62..d33454dd9 100644
--- a/src/Api/Management/Entity/OrganizationInterface.php
+++ b/src/Api/Management/Entity/OrganizationInterface.php
@@ -26,6 +26,7 @@
use Apigee\Edge\Entity\Property\PropertiesPropertyInterface;
use Apigee\Edge\Entity\Property\RuntimeTypeInterface;
use Apigee\Edge\Structure\AddonsConfig;
+use InvalidArgumentException;
/**
* Interface OrganizationInterface.
@@ -47,7 +48,7 @@ public function getType(): ?string;
/**
* @param string $type
*
- * @throws \InvalidArgumentException
+ * @throws InvalidArgumentException
*/
public function setType(string $type): void;
@@ -59,12 +60,12 @@ public function setType(string $type): void;
public function getTypes(): array;
/**
- * @return \Apigee\Edge\Structure\AddonsConfig|null
+ * @return AddonsConfig|null
*/
public function getAddonsConfig(): ?AddonsConfig;
/**
- * @param \Apigee\Edge\Structure\AddonsConfig $addonsConfig
+ * @param AddonsConfig $addonsConfig
*/
public function setAddonsConfig(AddonsConfig $addonsConfig): void;
}
diff --git a/src/Api/Management/Normalizer/AppCredentialNormalizer.php b/src/Api/Management/Normalizer/AppCredentialNormalizer.php
index d841560cc..0903c413c 100644
--- a/src/Api/Management/Normalizer/AppCredentialNormalizer.php
+++ b/src/Api/Management/Normalizer/AppCredentialNormalizer.php
@@ -53,4 +53,14 @@ public function normalize($object, $format = null, array $context = [])
return $normalized;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ AppCredentialInterface::class => true,
+ ];
+ }
}
diff --git a/src/Api/Management/Normalizer/AppNormalizer.php b/src/Api/Management/Normalizer/AppNormalizer.php
index c5d036d79..5010f277e 100644
--- a/src/Api/Management/Normalizer/AppNormalizer.php
+++ b/src/Api/Management/Normalizer/AppNormalizer.php
@@ -51,4 +51,14 @@ public function normalize($object, $format = null, array $context = [])
return $normalized;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ AppInterface::class => true,
+ ];
+ }
}
diff --git a/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php b/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php
index c4f856a93..68065c927 100644
--- a/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php
+++ b/src/Api/Management/Normalizer/CompanyMembershipNormalizer.php
@@ -19,6 +19,7 @@
namespace Apigee\Edge\Api\Management\Normalizer;
use Apigee\Edge\Api\Management\Structure\CompanyMembership;
+use ArrayObject;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
class CompanyMembershipNormalizer implements NormalizerInterface
@@ -34,14 +35,14 @@ public function normalize($object, $format = null, array $context = [])
$normalized = [
'developer' => [],
];
- /** @var \Apigee\Edge\Api\Management\Structure\CompanyMembership $object */
+ /** @var CompanyMembership $object */
foreach ($object->getMembers() as $member => $role) {
$normalized['developer'][] = (object) ['email' => $member, 'role' => $role];
}
- //convert to ArrayObject as symfony normalizer throws error for std object.
- //set ARRAY_AS_PROPS flag as we need entries to be accessed as properties.
- return new \ArrayObject($normalized, \ArrayObject::ARRAY_AS_PROPS);
+ // convert to ArrayObject as symfony normalizer throws error for std object.
+ // set ARRAY_AS_PROPS flag as we need entries to be accessed as properties.
+ return new ArrayObject($normalized, ArrayObject::ARRAY_AS_PROPS);
}
/**
@@ -51,4 +52,14 @@ public function supportsNormalization($data, $format = null)
{
return $data instanceof CompanyMembership;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ CompanyMembership::class => true,
+ ];
+ }
}
diff --git a/src/Api/Management/Query/StatsQuery.php b/src/Api/Management/Query/StatsQuery.php
index 7a9590276..8ee912dd1 100644
--- a/src/Api/Management/Query/StatsQuery.php
+++ b/src/Api/Management/Query/StatsQuery.php
@@ -25,14 +25,14 @@
*/
class StatsQuery implements StatsQueryInterface
{
- const SORT_ASC = 'ASC';
+ public const SORT_ASC = 'ASC';
- const SORT_DESC = 'DESC';
+ public const SORT_DESC = 'DESC';
/** @var string[] */
private $metrics = [];
- /** @var \League\Period\Period */
+ /** @var Period */
private $timeRange;
/** @var string|null */
@@ -70,7 +70,7 @@ class StatsQuery implements StatsQueryInterface
*
* @param string[] $metrics
* Metrics to be aggregated for the report.
- * @param \League\Period\Period $timeRange
+ * @param Period $timeRange
* The start and end time for the desired interval.
*/
public function __construct(array $metrics, Period $timeRange)
diff --git a/src/Api/Management/Query/StatsQueryInterface.php b/src/Api/Management/Query/StatsQueryInterface.php
index d230f23ed..82774265e 100644
--- a/src/Api/Management/Query/StatsQueryInterface.php
+++ b/src/Api/Management/Query/StatsQueryInterface.php
@@ -37,7 +37,7 @@ public function getMetrics(): array;
/**
* @param string[] $metrics
*
- * @return \Apigee\Edge\Api\Management\Query\StatsQueryInterface
+ * @return StatsQueryInterface
*/
public function setMetrics(array $metrics): StatsQueryInterface;
@@ -49,7 +49,7 @@ public function getTimeRange(): Period;
/**
* @param Period $timeRange
*
- * @return \Apigee\Edge\Api\Management\Query\StatsQueryInterface
+ * @return StatsQueryInterface
*/
public function setTimeRange(Period $timeRange): StatsQueryInterface;
@@ -61,7 +61,7 @@ public function getTimeUnit(): ?string;
/**
* @param string|null $timeUnit
*
- * @return \Apigee\Edge\Api\Management\Query\StatsQueryInterface
+ * @return StatsQueryInterface
*/
public function setTimeUnit(?string $timeUnit): StatsQueryInterface;
@@ -73,7 +73,7 @@ public function getSortBy(): ?string;
/**
* @param string|null $sortBy
*
- * @return \Apigee\Edge\Api\Management\Query\StatsQueryInterface
+ * @return StatsQueryInterface
*/
public function setSortBy(?string $sortBy): StatsQueryInterface;
@@ -85,7 +85,7 @@ public function getSort(): ?string;
/**
* @param string|null $sort
*
- * @return \Apigee\Edge\Api\Management\Query\StatsQueryInterface
+ * @return StatsQueryInterface
*/
public function setSort(?string $sort): StatsQueryInterface;
@@ -97,7 +97,7 @@ public function getTopK(): ?int;
/**
* @param int|null $topK
*
- * @return \Apigee\Edge\Api\Management\Query\StatsQueryInterface
+ * @return StatsQueryInterface
*/
public function setTopK(?int $topK): StatsQueryInterface;
@@ -109,7 +109,7 @@ public function getLimit(): ?int;
/**
* @param int|null $limit
*
- * @return \Apigee\Edge\Api\Management\Query\StatsQueryInterface
+ * @return StatsQueryInterface
*/
public function setLimit(?int $limit): StatsQueryInterface;
@@ -121,7 +121,7 @@ public function getOffset(): ?int;
/**
* @param int|null $offset
*
- * @return \Apigee\Edge\Api\Management\Query\StatsQueryInterface
+ * @return StatsQueryInterface
*/
public function setOffset(?int $offset): StatsQueryInterface;
@@ -133,7 +133,7 @@ public function getRealtime(): ?bool;
/**
* @param bool|null $realtime
*
- * @return \Apigee\Edge\Api\Management\Query\StatsQueryInterface
+ * @return StatsQueryInterface
*/
public function setRealtime(?bool $realtime): StatsQueryInterface;
@@ -145,7 +145,7 @@ public function getAccuracy(): ?int;
/**
* @param int|null $accuracy
*
- * @return \Apigee\Edge\Api\Management\Query\StatsQueryInterface
+ * @return StatsQueryInterface
*/
public function setAccuracy(?int $accuracy): StatsQueryInterface;
@@ -157,7 +157,7 @@ public function getTsAscending(): bool;
/**
* @param bool $tsAscending
*
- * @return \Apigee\Edge\Api\Management\Query\StatsQueryInterface
+ * @return StatsQueryInterface
*/
public function setTsAscending(bool $tsAscending): StatsQueryInterface;
@@ -169,7 +169,7 @@ public function getFilter(): ?string;
/**
* @param string|null $filter
*
- * @return \Apigee\Edge\Api\Management\Query\StatsQueryInterface
+ * @return StatsQueryInterface
*
* @see https://docs.apigee.com/analytics-services/reference/analytics-reference#filters
*/
diff --git a/src/Api/Management/Query/StatsQueryNormalizer.php b/src/Api/Management/Query/StatsQueryNormalizer.php
index 3578c9426..532cbf576 100644
--- a/src/Api/Management/Query/StatsQueryNormalizer.php
+++ b/src/Api/Management/Query/StatsQueryNormalizer.php
@@ -19,6 +19,7 @@
namespace Apigee\Edge\Api\Management\Query;
use Apigee\Edge\Serializer\JsonEncoder;
+use DateTimeZone;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
@@ -31,7 +32,7 @@
*/
class StatsQueryNormalizer implements NormalizerInterface
{
- const DATE_FORMAT = 'm/d/Y H:i';
+ public const DATE_FORMAT = 'm/d/Y H:i';
/** @var ObjectNormalizer */
private $objectNormalizer;
@@ -61,9 +62,9 @@ public function normalize($object, $format = null, array $context = [])
$data['select'] = implode(',', $data['metrics']);
unset($data['metrics']);
// Transform timeRange to the required format and time zone.
- $utc = new \DateTimeZone('UTC');
- $data['timeRange'] = $object->getTimeRange()->getStartDate()->setTimezone($utc)->format(self::DATE_FORMAT) . '~' .
- $object->getTimeRange()->getEndDate()->setTimezone($utc)->format(self::DATE_FORMAT);
+ $utc = new DateTimeZone('UTC');
+ $data['timeRange'] = $object->getTimeRange()->startDate->setTimezone($utc)->format(self::DATE_FORMAT) . '~' .
+ $object->getTimeRange()->endDate->setTimezone($utc)->format(self::DATE_FORMAT);
// Remove null values.
$data = array_filter($data, function ($value) {
return !is_null($value);
diff --git a/src/Api/Monetization/Builder/RatePlanRevisionBuilder.php b/src/Api/Monetization/Builder/RatePlanRevisionBuilder.php
index e14d1d7d0..ee8711d1c 100644
--- a/src/Api/Monetization/Builder/RatePlanRevisionBuilder.php
+++ b/src/Api/Monetization/Builder/RatePlanRevisionBuilder.php
@@ -41,16 +41,16 @@ final class RatePlanRevisionBuilder
* The end date of the new rate plan revision is not set even if it was
* set on the "parent" rate plan.
*
- * @param \Apigee\Edge\Api\Monetization\Entity\RatePlanInterface $ratePlan
+ * @param RatePlanInterface $ratePlan
* "Parent" rate plan.
- * @param \DateTimeImmutable $startDate
+ * @param DateTimeImmutable $startDate
* Start date of the rate plan revision.
*
- * @throws \InvalidArgumentException
+ * @throws InvalidArgumentException
* If the provided start date is earlier than the start date of the
* "parent" rate plan.
*
- * @return \Apigee\Edge\Api\Monetization\Entity\RatePlanRevisionInterface
+ * @return RatePlanRevisionInterface
* New rate plan revision.
*/
public static function buildRatePlanRevision(RatePlanInterface $ratePlan, DateTimeImmutable $startDate): RatePlanRevisionInterface
@@ -93,7 +93,7 @@ public static function buildRatePlanRevision(RatePlanInterface $ratePlan, DateTi
// array is being passed to the organization which causes failures.
// @see Apigee\Edge\Api\Monetization\Entity\OrganizationAwareEntity
// @see https://github.com/symfony/symfony/issues/28161
- /** @var \Apigee\Edge\Api\Monetization\Entity\RatePlanRevisionInterface $revision */
+ /** @var RatePlanRevisionInterface $revision */
$revision = $ratePlanSerializer->denormalize($normalized, RatePlanInterface::class, null, [ObjectNormalizer::DISABLE_TYPE_ENFORCEMENT => true]);
$revision->setStartDate($startDate);
diff --git a/src/Api/Monetization/Controller/AcceptedRatePlanController.php b/src/Api/Monetization/Controller/AcceptedRatePlanController.php
index b40c89f70..0fdc961ab 100644
--- a/src/Api/Monetization/Controller/AcceptedRatePlanController.php
+++ b/src/Api/Monetization/Controller/AcceptedRatePlanController.php
@@ -39,8 +39,8 @@ abstract class AcceptedRatePlanController extends OrganizationAwareEntityControl
* AcceptedRatePlanController constructor.
*
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
@@ -59,7 +59,7 @@ public function getAllAcceptedRatePlans(): array
/**
* {@inheritdoc}
*/
- public function getPaginatedAcceptedRatePlanList(int $limit = null, int $page = 1): array
+ public function getPaginatedAcceptedRatePlanList(?int $limit = null, int $page = 1): array
{
$query_params = [
'page' => $page,
@@ -78,7 +78,7 @@ public function getPaginatedAcceptedRatePlanList(int $limit = null, int $page =
public function acceptRatePlan(RatePlanInterface $ratePlan, DateTimeImmutable $startDate, ?DateTimeImmutable $endDate = null, ?int $quotaTarget = null, ?bool $suppressWarning = null, ?bool $waveTerminationCharge = null): AcceptedRatePlanInterface
{
$rc = new ReflectionClass($this->getEntityClass());
- /** @var \Apigee\Edge\Api\Monetization\Entity\AcceptedRatePlanInterface $acceptedRatePlan */
+ /** @var AcceptedRatePlanInterface $acceptedRatePlan */
$acceptedRatePlan = $rc->newInstance(
[
'ratePlan' => $ratePlan,
@@ -144,7 +144,7 @@ abstract protected function buildContextForEntityTransformerInCreate(): array;
* has more than one listing endpoint so getBaseEntityEndpoint() was
* enough until this time.
*
- * @return \Psr\Http\Message\UriInterface
+ * @return UriInterface
*/
abstract protected function getAcceptedRatePlansEndpoint(): UriInterface;
diff --git a/src/Api/Monetization/Controller/AcceptedRatePlanControllerInterface.php b/src/Api/Monetization/Controller/AcceptedRatePlanControllerInterface.php
index 4f976761a..c9d6eafbc 100644
--- a/src/Api/Monetization/Controller/AcceptedRatePlanControllerInterface.php
+++ b/src/Api/Monetization/Controller/AcceptedRatePlanControllerInterface.php
@@ -49,16 +49,16 @@ public function getAllAcceptedRatePlans(): array;
*
* @return \Apigee\Edge\Api\Monetization\Entity\AcceptedRatePlanInterface[]
*/
- public function getPaginatedAcceptedRatePlanList(int $limit = null, int $page = 1): array;
+ public function getPaginatedAcceptedRatePlanList(?int $limit = null, int $page = 1): array;
/**
* Accepts a rate plan.
*
- * @param \Apigee\Edge\Api\Monetization\Entity\RatePlanInterface $ratePlan
+ * @param RatePlanInterface $ratePlan
* The rate plan to be accepted.
- * @param \DateTimeImmutable $startDate
+ * @param DateTimeImmutable $startDate
* Date when the rate plan starts.
- * @param \DateTimeImmutable|null $endDate
+ * @param DateTimeImmutable|null $endDate
* Date when the rate plan ends.
* @param int|null $quotaTarget
* (This property is valid for adjustable notification rate plans only.)
@@ -71,14 +71,14 @@ public function getPaginatedAcceptedRatePlanList(int $limit = null, int $page =
* Flag that specifies whether termination fees are waved when an active
* rate plan is terminated as part of activating the new rate plan.
*
- * @return \Apigee\Edge\Api\Monetization\Entity\AcceptedRatePlanInterface
+ * @return AcceptedRatePlanInterface
*/
public function acceptRatePlan(RatePlanInterface $ratePlan, DateTimeImmutable $startDate, ?DateTimeImmutable $endDate = null, ?int $quotaTarget = null, ?bool $suppressWarning = null, ?bool $waveTerminationCharge = null): AcceptedRatePlanInterface;
/**
* Update a rate plan that has been accepted by a developer.
*
- * @param \Apigee\Edge\Api\Monetization\Entity\AcceptedRatePlanInterface $acceptedRatePlan
+ * @param AcceptedRatePlanInterface $acceptedRatePlan
* Previously accepted rate plan that should be modified.
* @param bool|null $suppressWarning
* Flag that specifies whether to suppress the error if the developer
diff --git a/src/Api/Monetization/Controller/ActiveRatePlanController.php b/src/Api/Monetization/Controller/ActiveRatePlanController.php
index b193cfa00..7134d9dd3 100644
--- a/src/Api/Monetization/Controller/ActiveRatePlanController.php
+++ b/src/Api/Monetization/Controller/ActiveRatePlanController.php
@@ -38,8 +38,8 @@ abstract class ActiveRatePlanController extends OrganizationAwareEntityControlle
* ActiveRatePlanController constructor.
*
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
@@ -75,7 +75,7 @@ public function getActiveRatePlanByApiProduct(string $apiProductName, ?bool $sho
* @param string $apiProductName
* Name of the API product.
*
- * @return \Psr\Http\Message\UriInterface
+ * @return UriInterface
*/
abstract protected function getActiveRatePlanForApiProductEndpoint(string $apiProductName): UriInterface;
diff --git a/src/Api/Monetization/Controller/ActiveRatePlanControllerInterface.php b/src/Api/Monetization/Controller/ActiveRatePlanControllerInterface.php
index d5335a36e..bf792ca76 100644
--- a/src/Api/Monetization/Controller/ActiveRatePlanControllerInterface.php
+++ b/src/Api/Monetization/Controller/ActiveRatePlanControllerInterface.php
@@ -42,7 +42,7 @@ interface ActiveRatePlanControllerInterface extends EntityControllerInterface,
* @throws \Apigee\Edge\Exception\ApiResponseException
* If no rate plan found.
*
- * @return \Apigee\Edge\Api\Monetization\Entity\RatePlanInterface
+ * @return RatePlanInterface
* Rate plan.
*/
public function getActiveRatePlanByApiProduct(string $apiProductName, ?bool $showPrivate = null): RatePlanInterface;
diff --git a/src/Api/Monetization/Controller/ApiPackageController.php b/src/Api/Monetization/Controller/ApiPackageController.php
index 96bb97af5..03044e040 100644
--- a/src/Api/Monetization/Controller/ApiPackageController.php
+++ b/src/Api/Monetization/Controller/ApiPackageController.php
@@ -41,7 +41,7 @@ class ApiPackageController extends OrganizationAwareEntityController implements
*
* @param string $organization
* @param ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
diff --git a/src/Api/Monetization/Controller/CompanyAcceptedRatePlanController.php b/src/Api/Monetization/Controller/CompanyAcceptedRatePlanController.php
index 129974147..597b0f8c8 100644
--- a/src/Api/Monetization/Controller/CompanyAcceptedRatePlanController.php
+++ b/src/Api/Monetization/Controller/CompanyAcceptedRatePlanController.php
@@ -38,8 +38,8 @@ class CompanyAcceptedRatePlanController extends AcceptedRatePlanController
*
* @param string $companyName
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $companyName, string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
diff --git a/src/Api/Monetization/Controller/CompanyActiveRatePlanController.php b/src/Api/Monetization/Controller/CompanyActiveRatePlanController.php
index e24ec8b07..03e4edb82 100644
--- a/src/Api/Monetization/Controller/CompanyActiveRatePlanController.php
+++ b/src/Api/Monetization/Controller/CompanyActiveRatePlanController.php
@@ -36,8 +36,8 @@ class CompanyActiveRatePlanController extends ActiveRatePlanController
*
* @param string $companyName
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $companyName, string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
diff --git a/src/Api/Monetization/Controller/CompanyReportDefinitionController.php b/src/Api/Monetization/Controller/CompanyReportDefinitionController.php
index a05c64676..fabcd9324 100644
--- a/src/Api/Monetization/Controller/CompanyReportDefinitionController.php
+++ b/src/Api/Monetization/Controller/CompanyReportDefinitionController.php
@@ -35,9 +35,9 @@ class CompanyReportDefinitionController extends LegalEntityReportDefinitionContr
*
* @param string $developerId
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Api\Monetization\Controller\ReportDefinitionControllerInterface|null $reportDefinitionController
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param ReportDefinitionControllerInterface|null $reportDefinitionController
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $developerId, string $organization, ClientInterface $client, ?ReportDefinitionControllerInterface $reportDefinitionController = null, ?EntitySerializerInterface $entitySerializer = null)
{
diff --git a/src/Api/Monetization/Controller/CompanyTermsAndConditionsController.php b/src/Api/Monetization/Controller/CompanyTermsAndConditionsController.php
index a19bd6b0d..50166d477 100644
--- a/src/Api/Monetization/Controller/CompanyTermsAndConditionsController.php
+++ b/src/Api/Monetization/Controller/CompanyTermsAndConditionsController.php
@@ -36,8 +36,8 @@ class CompanyTermsAndConditionsController extends LegalEntityTermsAndConditionsC
*
* @param string $companyName
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $companyName, string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
diff --git a/src/Api/Monetization/Controller/DeveloperAcceptedRatePlanController.php b/src/Api/Monetization/Controller/DeveloperAcceptedRatePlanController.php
index deb994156..63c5a5de7 100644
--- a/src/Api/Monetization/Controller/DeveloperAcceptedRatePlanController.php
+++ b/src/Api/Monetization/Controller/DeveloperAcceptedRatePlanController.php
@@ -39,8 +39,8 @@ class DeveloperAcceptedRatePlanController extends AcceptedRatePlanController
*
* @param string $developerId
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $developerId, string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
@@ -55,6 +55,7 @@ protected function getBaseEndpointUri(): UriInterface
{
// For these API endpoint:
$developerId = rawurlencode($this->developer);
+
// https://apidocs.apigee.com/monetize/apis/post/organizations/%7Borg_name%7D/developers/%7Bdeveloper_or_company_id%7D/developer-rateplans (create)
// https://apidocs.apigee.com/monetize/apis/put/organizations/%7Borg_name%7D/developers/%7Bdeveloper_id%7D/developer-rateplans/%7Bplan_id%7D (update)
// https://apidocs.apigee.com/monetize/apis/put/organizations/%7Borg_name%7D/developers/%7Bdeveloper_id%7D/developer-rateplans/%7Bplan_id%7D (load)
@@ -86,6 +87,7 @@ protected function buildContextForEntityTransformerInCreate(): array
protected function getAcceptedRatePlansEndpoint(): UriInterface
{
$developerId = rawurlencode($this->developer);
+
// For this API endpoint:
// https://apidocs.apigee.com/monetize/apis/get/organizations/%7Borg_name%7D/developers/%7Bdeveloper_id%7D/developer-accepted-rateplans
return $this->client->getUriFactory()->createUri("/mint/organizations/{$this->organization}/developers/{$developerId}/developer-accepted-rateplans");
diff --git a/src/Api/Monetization/Controller/DeveloperActiveRatePlanController.php b/src/Api/Monetization/Controller/DeveloperActiveRatePlanController.php
index 609e4a2bd..8fbf45381 100644
--- a/src/Api/Monetization/Controller/DeveloperActiveRatePlanController.php
+++ b/src/Api/Monetization/Controller/DeveloperActiveRatePlanController.php
@@ -36,8 +36,8 @@ class DeveloperActiveRatePlanController extends ActiveRatePlanController
*
* @param string $developerId
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $developerId, string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
diff --git a/src/Api/Monetization/Controller/DeveloperPrepaidBalanceController.php b/src/Api/Monetization/Controller/DeveloperPrepaidBalanceController.php
index 0f51e4ac3..a779428bc 100644
--- a/src/Api/Monetization/Controller/DeveloperPrepaidBalanceController.php
+++ b/src/Api/Monetization/Controller/DeveloperPrepaidBalanceController.php
@@ -36,8 +36,8 @@ class DeveloperPrepaidBalanceController extends PrepaidBalanceController impleme
*
* @param string $developerId
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $developerId, string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
diff --git a/src/Api/Monetization/Controller/DeveloperReportDefinitionController.php b/src/Api/Monetization/Controller/DeveloperReportDefinitionController.php
index bbc474c99..25096c5c8 100644
--- a/src/Api/Monetization/Controller/DeveloperReportDefinitionController.php
+++ b/src/Api/Monetization/Controller/DeveloperReportDefinitionController.php
@@ -35,9 +35,9 @@ class DeveloperReportDefinitionController extends LegalEntityReportDefinitionCon
*
* @param string $developerId
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Api\Monetization\Controller\ReportDefinitionControllerInterface|null $reportDefinitionController
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param ReportDefinitionControllerInterface|null $reportDefinitionController
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $developerId, string $organization, ClientInterface $client, ?ReportDefinitionControllerInterface $reportDefinitionController = null, ?EntitySerializerInterface $entitySerializer = null)
{
diff --git a/src/Api/Monetization/Controller/DeveloperTermsAndConditionsController.php b/src/Api/Monetization/Controller/DeveloperTermsAndConditionsController.php
index e4aea3794..98b4b567f 100644
--- a/src/Api/Monetization/Controller/DeveloperTermsAndConditionsController.php
+++ b/src/Api/Monetization/Controller/DeveloperTermsAndConditionsController.php
@@ -34,8 +34,8 @@ class DeveloperTermsAndConditionsController extends LegalEntityTermsAndCondition
*
* @param string $developerId
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $developerId, string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
diff --git a/src/Api/Monetization/Controller/EntityDeleteOperationControllerTrait.php b/src/Api/Monetization/Controller/EntityDeleteOperationControllerTrait.php
index 2d638570a..03d50d1e1 100644
--- a/src/Api/Monetization/Controller/EntityDeleteOperationControllerTrait.php
+++ b/src/Api/Monetization/Controller/EntityDeleteOperationControllerTrait.php
@@ -24,7 +24,7 @@
/**
* Trait EntityDeleteOperationControllerTrait.
*
- * @see \Apigee\Edge\Api\Monetization\Controller\EntityDeleteOperationControllerInterface
+ * @see EntityDeleteOperationControllerInterface
*/
trait EntityDeleteOperationControllerTrait
{
diff --git a/src/Api/Monetization/Controller/EntityListingControllerAwareTrait.php b/src/Api/Monetization/Controller/EntityListingControllerAwareTrait.php
index 0838245f2..7562abe9d 100644
--- a/src/Api/Monetization/Controller/EntityListingControllerAwareTrait.php
+++ b/src/Api/Monetization/Controller/EntityListingControllerAwareTrait.php
@@ -24,7 +24,7 @@
/**
* Trait EntityListingControllerAwareTrait.
*
- * @see \Apigee\Edge\Api\Monetization\Controller\EntityListingControllerInterface
+ * @see EntityListingControllerInterface
*/
trait EntityListingControllerAwareTrait
{
diff --git a/src/Api/Monetization/Controller/FilteredReportDefinitionsTrait.php b/src/Api/Monetization/Controller/FilteredReportDefinitionsTrait.php
index b7ebfe8aa..b4b81df44 100644
--- a/src/Api/Monetization/Controller/FilteredReportDefinitionsTrait.php
+++ b/src/Api/Monetization/Controller/FilteredReportDefinitionsTrait.php
@@ -30,7 +30,7 @@ trait FilteredReportDefinitionsTrait
*
* @return \Apigee\Edge\Api\Monetization\Entity\ReportDefinitionInterface[]
*/
- public function getFilteredEntities(int $limit = null, int $page = 1, string $sort = null): array
+ public function getFilteredEntities(?int $limit = null, int $page = 1, ?string $sort = null): array
{
$queryParams = [];
if (null !== $sort) {
diff --git a/src/Api/Monetization/Controller/LegalEntityController.php b/src/Api/Monetization/Controller/LegalEntityController.php
index cf72b2a9e..405b08007 100644
--- a/src/Api/Monetization/Controller/LegalEntityController.php
+++ b/src/Api/Monetization/Controller/LegalEntityController.php
@@ -39,8 +39,8 @@ abstract class LegalEntityController extends OrganizationAwareEntityController i
* LegalEntityController constructor.
*
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
diff --git a/src/Api/Monetization/Controller/LegalEntityReportDefinitionController.php b/src/Api/Monetization/Controller/LegalEntityReportDefinitionController.php
index 28a49c678..07fad68d3 100644
--- a/src/Api/Monetization/Controller/LegalEntityReportDefinitionController.php
+++ b/src/Api/Monetization/Controller/LegalEntityReportDefinitionController.php
@@ -45,7 +45,7 @@ abstract class LegalEntityReportDefinitionController extends OrganizationAwareEn
* @see https://apidocs.apigee.com/monetize/apis/get/organizations/%7Borg_name%7D/developers/%7Bdev_id%7D/report-definitions
* @see https://apidocs.apigee.com/monetize/apis/post/organizations/%7Borg_name%7D/developers/%7Bdev_id%7D/report-definitions
*
- * @var \Apigee\Edge\Api\Monetization\Controller\ReportDefinitionControllerInterface
+ * @var ReportDefinitionControllerInterface
*/
protected $reportDefinitionController;
@@ -53,9 +53,9 @@ abstract class LegalEntityReportDefinitionController extends OrganizationAwareEn
* LegalEntityReportDefinitionController constructor.
*
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Api\Monetization\Controller\ReportDefinitionControllerInterface|null $reportDefinitionController
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param ReportDefinitionControllerInterface|null $reportDefinitionController
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $organization, ClientInterface $client, ?ReportDefinitionControllerInterface $reportDefinitionController = null, ?EntitySerializerInterface $entitySerializer = null)
{
diff --git a/src/Api/Monetization/Controller/LegalEntityTermsAndConditionsController.php b/src/Api/Monetization/Controller/LegalEntityTermsAndConditionsController.php
index 9bf9642bb..13bc26298 100644
--- a/src/Api/Monetization/Controller/LegalEntityTermsAndConditionsController.php
+++ b/src/Api/Monetization/Controller/LegalEntityTermsAndConditionsController.php
@@ -23,6 +23,7 @@
use Apigee\Edge\ClientInterface;
use Apigee\Edge\Controller\EntityListingControllerTrait;
use Apigee\Edge\Serializer\EntitySerializerInterface;
+use DateTimeImmutable;
use Psr\Http\Message\UriInterface;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
@@ -40,8 +41,8 @@ abstract class LegalEntityTermsAndConditionsController extends OrganizationAware
* AcceptedTermsAndConditionsController constructor.
*
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
@@ -68,7 +69,7 @@ public function acceptTermsAndConditionsById(string $tncId): LegalEntityTermsAnd
// It does not matter what time we send here and in which
// timezone.
// @see \Apigee\Edge\Api\Monetization\Structure\LegalEntityTermsAndConditionsHistoryItem::$auditDate
- 'auditDate' => $this->entitySerializer->normalize(new \DateTimeImmutable('now'), null, [DateTimeNormalizer::TIMEZONE_KEY => 'UTC']),
+ 'auditDate' => $this->entitySerializer->normalize(new DateTimeImmutable('now'), null, [DateTimeNormalizer::TIMEZONE_KEY => 'UTC']),
]));
return $this->entitySerializer->deserialize(
@@ -89,7 +90,7 @@ public function declineTermsAndConditionsById(string $tncId): LegalEntityTermsAn
// It does not matter what time we send here and in which
// timezone.
// @see \Apigee\Edge\Api\Monetization\Structure\LegalEntityTermsAndConditionsHistoryItem::$auditDate
- 'auditDate' => $this->entitySerializer->normalize(new \DateTimeImmutable('now'), null, [DateTimeNormalizer::TIMEZONE_KEY => 'UTC']),
+ 'auditDate' => $this->entitySerializer->normalize(new DateTimeImmutable('now'), null, [DateTimeNormalizer::TIMEZONE_KEY => 'UTC']),
]));
return $this->entitySerializer->deserialize(
@@ -105,7 +106,7 @@ public function declineTermsAndConditionsById(string $tncId): LegalEntityTermsAn
* @param string $tncId
* Terms and Conditions ID.
*
- * @return \Psr\Http\Message\UriInterface
+ * @return UriInterface
*/
abstract protected function getAcceptTermsAndConditionsEndpoint(string $tncId): UriInterface;
diff --git a/src/Api/Monetization/Controller/LegalEntityTermsAndConditionsControllerInterface.php b/src/Api/Monetization/Controller/LegalEntityTermsAndConditionsControllerInterface.php
index 39d1165da..1b2f571c9 100644
--- a/src/Api/Monetization/Controller/LegalEntityTermsAndConditionsControllerInterface.php
+++ b/src/Api/Monetization/Controller/LegalEntityTermsAndConditionsControllerInterface.php
@@ -47,7 +47,7 @@ public function getTermsAndConditionsHistory(): array;
* @param string $tncId
* Id of a terms and conditions.
*
- * @return \Apigee\Edge\Api\Monetization\Structure\LegalEntityTermsAndConditionsHistoryItem
+ * @return LegalEntityTermsAndConditionsHistoryItem
*/
public function acceptTermsAndConditionsById(string $tncId): LegalEntityTermsAndConditionsHistoryItem;
@@ -61,7 +61,7 @@ public function acceptTermsAndConditionsById(string $tncId): LegalEntityTermsAnd
* @param string $tncId
* Id of a terms and conditions.
*
- * @return \Apigee\Edge\Api\Monetization\Structure\LegalEntityTermsAndConditionsHistoryItem
+ * @return LegalEntityTermsAndConditionsHistoryItem
*/
public function declineTermsAndConditionsById(string $tncId): LegalEntityTermsAndConditionsHistoryItem;
}
diff --git a/src/Api/Monetization/Controller/ListingHelperTrait.php b/src/Api/Monetization/Controller/ListingHelperTrait.php
index 425054323..69b41962c 100644
--- a/src/Api/Monetization/Controller/ListingHelperTrait.php
+++ b/src/Api/Monetization/Controller/ListingHelperTrait.php
@@ -34,7 +34,7 @@ protected function listEntities(UriInterface $uri): array
/**
* Returns a raw API response as an array of a listing API endpoint.
*
- * @param \Psr\Http\Message\UriInterface $uri
+ * @param UriInterface $uri
* URI of the endpoint where the request should be sent.
*
* @return array
diff --git a/src/Api/Monetization/Controller/OrganizationProfileController.php b/src/Api/Monetization/Controller/OrganizationProfileController.php
index a7b5e8100..0ed878881 100644
--- a/src/Api/Monetization/Controller/OrganizationProfileController.php
+++ b/src/Api/Monetization/Controller/OrganizationProfileController.php
@@ -36,8 +36,8 @@ class OrganizationProfileController extends EntityController implements Organiza
* OrganizationProfileController constructor.
*
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
diff --git a/src/Api/Monetization/Controller/OrganizationProfileControllerInterface.php b/src/Api/Monetization/Controller/OrganizationProfileControllerInterface.php
index 0ce22bf5f..13304db6d 100644
--- a/src/Api/Monetization/Controller/OrganizationProfileControllerInterface.php
+++ b/src/Api/Monetization/Controller/OrganizationProfileControllerInterface.php
@@ -32,7 +32,7 @@ interface OrganizationProfileControllerInterface extends EntityControllerInterfa
EntityUpdateOperationControllerInterface
{
/**
- * @return \Apigee\Edge\Api\Monetization\Entity\OrganizationProfileInterface
+ * @return OrganizationProfileInterface
*/
public function load(): OrganizationProfileInterface;
}
diff --git a/src/Api/Monetization/Controller/PaginatedEntityListingControllerAwareTrait.php b/src/Api/Monetization/Controller/PaginatedEntityListingControllerAwareTrait.php
index f47e28716..18abfbc11 100644
--- a/src/Api/Monetization/Controller/PaginatedEntityListingControllerAwareTrait.php
+++ b/src/Api/Monetization/Controller/PaginatedEntityListingControllerAwareTrait.php
@@ -23,7 +23,7 @@
/**
* Trait PaginatedEntityControllerAwareTrait.
*
- * @see \Apigee\Edge\Api\Monetization\Controller\PaginatedEntityListingControllerInterface
+ * @see PaginatedEntityListingControllerInterface
*/
trait PaginatedEntityListingControllerAwareTrait
{
@@ -44,10 +44,10 @@ public function getEntities(): array
*
* @return \Apigee\Edge\Entity\EntityInterface[]
*/
- public function getPaginatedEntityList(int $limit = null, int $page = 1): array
+ public function getPaginatedEntityList(?int $limit = null, int $page = 1): array
{
return $this->listEntitiesInRange($this->getBaseEndpointUri(), $limit, $page);
}
- abstract protected function listEntitiesInRange(UriInterface $uri, int $limit = null, int $page = 1): array;
+ abstract protected function listEntitiesInRange(UriInterface $uri, ?int $limit = null, int $page = 1): array;
}
diff --git a/src/Api/Monetization/Controller/PaginatedEntityListingControllerInterface.php b/src/Api/Monetization/Controller/PaginatedEntityListingControllerInterface.php
index 4f5a9ff07..760e271b7 100644
--- a/src/Api/Monetization/Controller/PaginatedEntityListingControllerInterface.php
+++ b/src/Api/Monetization/Controller/PaginatedEntityListingControllerInterface.php
@@ -31,5 +31,5 @@ interface PaginatedEntityListingControllerInterface extends EntityListingControl
*
* @return \Apigee\Edge\Entity\EntityInterface[]
*/
- public function getPaginatedEntityList(int $limit = null, int $page = 1): array;
+ public function getPaginatedEntityList(?int $limit = null, int $page = 1): array;
}
diff --git a/src/Api/Monetization/Controller/PaginatedListingHelperTrait.php b/src/Api/Monetization/Controller/PaginatedListingHelperTrait.php
index 8526794da..02c3c72e8 100644
--- a/src/Api/Monetization/Controller/PaginatedListingHelperTrait.php
+++ b/src/Api/Monetization/Controller/PaginatedListingHelperTrait.php
@@ -38,7 +38,7 @@ protected function listAllEntities(UriInterface $uri): array
return $this->listEntities($uri->withQuery(http_build_query($query_params)));
}
- protected function listEntitiesInRange(UriInterface $uri, int $limit = null, int $page = 1): array
+ protected function listEntitiesInRange(UriInterface $uri, ?int $limit = null, int $page = 1): array
{
// Do not lose already set query parameters.
$query_params = [];
diff --git a/src/Api/Monetization/Controller/PrepaidBalanceController.php b/src/Api/Monetization/Controller/PrepaidBalanceController.php
index de2ec83c6..797a8c579 100644
--- a/src/Api/Monetization/Controller/PrepaidBalanceController.php
+++ b/src/Api/Monetization/Controller/PrepaidBalanceController.php
@@ -27,6 +27,7 @@
use Apigee\Edge\ClientInterface;
use Apigee\Edge\Controller\EntityListingControllerTrait;
use Apigee\Edge\Serializer\EntitySerializerInterface;
+use DateTimeImmutable;
use Psr\Http\Message\UriInterface;
abstract class PrepaidBalanceController extends OrganizationAwareEntityController implements PrepaidBalanceControllerInterface
@@ -36,7 +37,7 @@ abstract class PrepaidBalanceController extends OrganizationAwareEntityControlle
use PaginatedEntityListingControllerAwareTrait;
/**
- * @var \Apigee\Edge\Serializer\EntitySerializerInterface
+ * @var EntitySerializerInterface
*/
protected $prepaidBalanceSerializer;
@@ -51,10 +52,10 @@ abstract class PrepaidBalanceController extends OrganizationAwareEntityControlle
* PrepaidBalanceController constructor.
*
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $balanceSerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $balanceSerializer
* @param string|null $prepaidBalanceClass
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $prepaidBalanceSerializer
+ * @param EntitySerializerInterface|null $prepaidBalanceSerializer
*/
public function __construct(string $organization, ClientInterface $client, ?EntitySerializerInterface $balanceSerializer = null, ?string $prepaidBalanceClass = null, ?EntitySerializerInterface $prepaidBalanceSerializer = null)
{
@@ -105,7 +106,7 @@ public function getByCurrency(string $currencyCode): ?BalanceInterface
* @param float $replenishAmount
* @param float $recurringAmount
*
- * @return \Apigee\Edge\Api\Monetization\Entity\BalanceInterface
+ * @return BalanceInterface
*/
public function setupRecurringPayments(string $currencyCode, string $paymentProviderId, float $replenishAmount, float $recurringAmount): BalanceInterface
{
@@ -132,7 +133,7 @@ public function setupRecurringPayments(string $currencyCode, string $paymentProv
* @param string $currencyCode
* @param string $paymentProviderId
*
- * @return \Apigee\Edge\Api\Monetization\Entity\BalanceInterface
+ * @return BalanceInterface
*/
public function disableRecurringPayments(string $currencyCode, string $paymentProviderId): BalanceInterface
{
@@ -154,7 +155,7 @@ public function disableRecurringPayments(string $currencyCode, string $paymentPr
/**
* {@inheritdoc}
*/
- public function getPrepaidBalance(\DateTimeImmutable $billingMonth): array
+ public function getPrepaidBalance(DateTimeImmutable $billingMonth): array
{
return $this->listPrepaidBalances($billingMonth);
}
@@ -162,7 +163,7 @@ public function getPrepaidBalance(\DateTimeImmutable $billingMonth): array
/**
* {@inheritdoc}
*/
- public function getPrepaidBalanceByCurrency(string $currencyCode, \DateTimeImmutable $billingMonth): ?PrepaidBalanceInterface
+ public function getPrepaidBalanceByCurrency(string $currencyCode, DateTimeImmutable $billingMonth): ?PrepaidBalanceInterface
{
$result = $this->listPrepaidBalances($billingMonth, $currencyCode);
@@ -187,21 +188,21 @@ protected function getEntityClass(): string
* has more than one listing endpoint so getBaseEntityEndpoint() was
* enough until this time.
*
- * @return \Psr\Http\Message\UriInterface
+ * @return UriInterface
*/
abstract protected function getPrepaidBalanceEndpoint(): UriInterface;
/**
* Helper function which returns prepaid balances..
*
- * @param \DateTimeImmutable $billingMonth
+ * @param DateTimeImmutable $billingMonth
* @param string|null $currencyCode
*
* @return \Apigee\Edge\Api\Monetization\Entity\PrepaidBalanceInterface[]
*
* @psalm-suppress PossiblyNullArrayOffset - id() does not return null here.
*/
- private function listPrepaidBalances(\DateTimeImmutable $billingMonth, ?string $currencyCode = null): array
+ private function listPrepaidBalances(DateTimeImmutable $billingMonth, ?string $currencyCode = null): array
{
$query_params = [
'billingMonth' => strtoupper($billingMonth->format('F')),
@@ -213,7 +214,7 @@ private function listPrepaidBalances(\DateTimeImmutable $billingMonth, ?string $
$balances = [];
foreach ($this->getRawList($this->getPrepaidBalanceEndpoint()->withQuery(http_build_query($query_params))) as $item) {
- /** @var \Apigee\Edge\Api\Monetization\Entity\PrepaidBalanceInterface $balance */
+ /** @var PrepaidBalanceInterface $balance */
$balance = $this->prepaidBalanceSerializer->denormalize($item, $this->prepaidBalanceClass);
$balances[$balance->id()] = $balance;
}
diff --git a/src/Api/Monetization/Controller/PrepaidBalanceControllerInterface.php b/src/Api/Monetization/Controller/PrepaidBalanceControllerInterface.php
index 71acd2580..1f8859088 100644
--- a/src/Api/Monetization/Controller/PrepaidBalanceControllerInterface.php
+++ b/src/Api/Monetization/Controller/PrepaidBalanceControllerInterface.php
@@ -21,13 +21,14 @@
use Apigee\Edge\Api\Monetization\Entity\BalanceInterface;
use Apigee\Edge\Api\Monetization\Entity\PrepaidBalanceInterface;
use Apigee\Edge\Controller\EntityControllerInterface;
+use DateTimeImmutable;
interface PrepaidBalanceControllerInterface extends EntityControllerInterface, PaginatedEntityListingControllerInterface
{
/**
* @param string $currencyCode
*
- * @return \Apigee\Edge\Api\Monetization\Entity\BalanceInterface|null
+ * @return BalanceInterface|null
*/
public function getByCurrency(string $currencyCode): ?BalanceInterface;
@@ -35,7 +36,7 @@ public function getByCurrency(string $currencyCode): ?BalanceInterface;
* @param float $amount
* @param string $currencyCode
*
- * @return \Apigee\Edge\Api\Monetization\Entity\BalanceInterface
+ * @return BalanceInterface
*/
public function topUpBalance(float $amount, string $currencyCode): BalanceInterface;
@@ -47,7 +48,7 @@ public function topUpBalance(float $amount, string $currencyCode): BalanceInterf
* @param float $replenishAmount
* @param float $recurringAmount
*
- * @return \Apigee\Edge\Api\Monetization\Entity\BalanceInterface
+ * @return BalanceInterface
*/
public function setupRecurringPayments(string $currencyCode, string $paymentProviderId, float $replenishAmount, float $recurringAmount): BalanceInterface;
@@ -57,26 +58,26 @@ public function setupRecurringPayments(string $currencyCode, string $paymentProv
* @param string $currencyCode
* @param string $paymentProviderId
*
- * @return \Apigee\Edge\Api\Monetization\Entity\BalanceInterface
+ * @return BalanceInterface
*/
public function disableRecurringPayments(string $currencyCode, string $paymentProviderId): BalanceInterface;
/**
* Gets prepaid balances.
*
- * @param \DateTimeImmutable $billingMonth
+ * @param DateTimeImmutable $billingMonth
*
* @return \Apigee\Edge\Api\Monetization\Entity\PrepaidBalanceInterface[]
*/
- public function getPrepaidBalance(\DateTimeImmutable $billingMonth): array;
+ public function getPrepaidBalance(DateTimeImmutable $billingMonth): array;
/**
* Gets prepaid balance by currency.
*
* @param string $currencyCode
- * @param \DateTimeImmutable $billingMonth
+ * @param DateTimeImmutable $billingMonth
*
- * @return \Apigee\Edge\Api\Monetization\Entity\PrepaidBalanceInterface|null
+ * @return PrepaidBalanceInterface|null
*/
- public function getPrepaidBalanceByCurrency(string $currencyCode, \DateTimeImmutable $billingMonth): ?PrepaidBalanceInterface;
+ public function getPrepaidBalanceByCurrency(string $currencyCode, DateTimeImmutable $billingMonth): ?PrepaidBalanceInterface;
}
diff --git a/src/Api/Monetization/Controller/RatePlanController.php b/src/Api/Monetization/Controller/RatePlanController.php
index 1721d1c22..148ab2e3e 100644
--- a/src/Api/Monetization/Controller/RatePlanController.php
+++ b/src/Api/Monetization/Controller/RatePlanController.php
@@ -45,8 +45,8 @@ class RatePlanController extends OrganizationAwareEntityController implements Ra
*
* @param string $apiPackage
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $apiPackage, string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
diff --git a/src/Api/Monetization/Controller/RatePlanControllerInterface.php b/src/Api/Monetization/Controller/RatePlanControllerInterface.php
index 1096a0750..2225ceead 100644
--- a/src/Api/Monetization/Controller/RatePlanControllerInterface.php
+++ b/src/Api/Monetization/Controller/RatePlanControllerInterface.php
@@ -51,7 +51,7 @@ public function getEntities(?bool $showCurrentOnly = null, ?bool $showPrivate =
/**
* Creates a new rate plan revision.
*
- * @param \Apigee\Edge\Api\Monetization\Entity\RatePlanRevisionInterface $entity
+ * @param RatePlanRevisionInterface $entity
* Rate plan revision to be created.
*/
public function createNewRevision(RatePlanRevisionInterface $entity): void;
diff --git a/src/Api/Monetization/Controller/ReportDefinitionController.php b/src/Api/Monetization/Controller/ReportDefinitionController.php
index 14cf1738e..44aa36520 100644
--- a/src/Api/Monetization/Controller/ReportDefinitionController.php
+++ b/src/Api/Monetization/Controller/ReportDefinitionController.php
@@ -41,8 +41,8 @@ class ReportDefinitionController extends OrganizationAwareEntityController imple
* ReportDefinitionController constructor.
*
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
diff --git a/src/Api/Monetization/Controller/ReportDefinitionControllerInterface.php b/src/Api/Monetization/Controller/ReportDefinitionControllerInterface.php
index 106d4f9ed..8042df4be 100644
--- a/src/Api/Monetization/Controller/ReportDefinitionControllerInterface.php
+++ b/src/Api/Monetization/Controller/ReportDefinitionControllerInterface.php
@@ -43,12 +43,12 @@ interface ReportDefinitionControllerInterface extends EntityControllerInterface,
*
* @return \Apigee\Edge\Api\Monetization\Entity\ReportDefinitionInterface[]
*/
- public function getFilteredEntities(int $limit = null, int $page = 1, string $sort = null): array;
+ public function getFilteredEntities(?int $limit = null, int $page = 1, ?string $sort = null): array;
/**
* Generate a report.
*
- * @param \Apigee\Edge\Api\Monetization\Structure\Reports\Criteria\AbstractCriteria $criteria
+ * @param AbstractCriteria $criteria
* Search criteria for the report.
*
* @return string
diff --git a/src/Api/Monetization/Controller/SupportedCurrencyController.php b/src/Api/Monetization/Controller/SupportedCurrencyController.php
index 49f1fd117..6fe2704e0 100644
--- a/src/Api/Monetization/Controller/SupportedCurrencyController.php
+++ b/src/Api/Monetization/Controller/SupportedCurrencyController.php
@@ -36,8 +36,8 @@ class SupportedCurrencyController extends OrganizationAwareEntityController impl
* SupportedCurrencyController constructor.
*
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
diff --git a/src/Api/Monetization/Controller/TermsAndConditionsController.php b/src/Api/Monetization/Controller/TermsAndConditionsController.php
index 5cd612197..9784b312c 100644
--- a/src/Api/Monetization/Controller/TermsAndConditionsController.php
+++ b/src/Api/Monetization/Controller/TermsAndConditionsController.php
@@ -35,8 +35,8 @@ class TermsAndConditionsController extends OrganizationAwareEntityController imp
* TermsAndConditionsController constructor.
*
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
@@ -47,7 +47,7 @@ public function __construct(string $organization, ClientInterface $client, ?Enti
/**
* {@inheritdoc}
*/
- public function getEntities(bool $currentOnly = null): array
+ public function getEntities(?bool $currentOnly = null): array
{
$queryParams = [];
if (null !== $currentOnly) {
@@ -60,7 +60,7 @@ public function getEntities(bool $currentOnly = null): array
/**
* {@inheritdoc}
*/
- public function getPaginatedEntityList(int $limit = null, int $page = 1, bool $currentOnly = null): array
+ public function getPaginatedEntityList(?int $limit = null, int $page = 1, ?bool $currentOnly = null): array
{
$queryParams = [];
if (null !== $currentOnly) {
diff --git a/src/Api/Monetization/Controller/TermsAndConditionsControllerInterface.php b/src/Api/Monetization/Controller/TermsAndConditionsControllerInterface.php
index c3d61236c..1f2b79aef 100644
--- a/src/Api/Monetization/Controller/TermsAndConditionsControllerInterface.php
+++ b/src/Api/Monetization/Controller/TermsAndConditionsControllerInterface.php
@@ -37,7 +37,7 @@ interface TermsAndConditionsControllerInterface extends EntityControllerInterfac
*
* @return \Apigee\Edge\Api\Monetization\Entity\TermsAndConditionsInterface[]
*/
- public function getEntities(bool $currentOnly = null): array;
+ public function getEntities(?bool $currentOnly = null): array;
/**
* Loads all terms and conditions in the provided range.
@@ -52,5 +52,5 @@ public function getEntities(bool $currentOnly = null): array;
*
* @return \Apigee\Edge\Api\Monetization\Entity\TermsAndConditionsInterface[]
*/
- public function getPaginatedEntityList(int $limit = null, int $page = 1, bool $currentOnly = null): array;
+ public function getPaginatedEntityList(?int $limit = null, int $page = 1, ?bool $currentOnly = null): array;
}
diff --git a/src/Api/Monetization/Denormalizer/AcceptedRatePlanDenormalizer.php b/src/Api/Monetization/Denormalizer/AcceptedRatePlanDenormalizer.php
index 7945c1381..a83b2cd3e 100644
--- a/src/Api/Monetization/Denormalizer/AcceptedRatePlanDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/AcceptedRatePlanDenormalizer.php
@@ -34,7 +34,7 @@ abstract class AcceptedRatePlanDenormalizer extends ObjectDenormalizer
*/
public function denormalize($data, $type, $format = null, array $context = [])
{
- /** @var \Apigee\Edge\Api\Monetization\Entity\AcceptedRatePlanInterface $denormalized */
+ /** @var AcceptedRatePlanInterface $denormalized */
$denormalized = parent::denormalize($data, $type, $format, $context);
$this->fixTimeZoneOnDenormalization($data, $denormalized, $denormalized->getRatePlan()->getPackage()->getOrganization()->getTimezone());
diff --git a/src/Api/Monetization/Denormalizer/AddressDenormalizer.php b/src/Api/Monetization/Denormalizer/AddressDenormalizer.php
index f95891946..b007a4680 100644
--- a/src/Api/Monetization/Denormalizer/AddressDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/AddressDenormalizer.php
@@ -31,10 +31,10 @@ class AddressDenormalizer extends ObjectDenormalizer
/**
* AddressDenormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Denormalizer/ApiPackageDenormalizer.php b/src/Api/Monetization/Denormalizer/ApiPackageDenormalizer.php
index 6c6fa70ee..67cc62471 100644
--- a/src/Api/Monetization/Denormalizer/ApiPackageDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/ApiPackageDenormalizer.php
@@ -31,10 +31,10 @@ class ApiPackageDenormalizer extends ObjectDenormalizer
/**
* ApiPackageDenormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Denormalizer/BalanceDenormalizer.php b/src/Api/Monetization/Denormalizer/BalanceDenormalizer.php
index 3d03327dd..1f366af61 100644
--- a/src/Api/Monetization/Denormalizer/BalanceDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/BalanceDenormalizer.php
@@ -31,10 +31,10 @@ class BalanceDenormalizer extends ObjectDenormalizer
/**
* BalanceDenormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Denormalizer/CompanyAcceptedRatePlanDenormalizer.php b/src/Api/Monetization/Denormalizer/CompanyAcceptedRatePlanDenormalizer.php
index 42e1e2dac..b0a1b5060 100644
--- a/src/Api/Monetization/Denormalizer/CompanyAcceptedRatePlanDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/CompanyAcceptedRatePlanDenormalizer.php
@@ -37,10 +37,10 @@ class CompanyAcceptedRatePlanDenormalizer extends AcceptedRatePlanDenormalizer
/**
* CompanyAcceptedRatePlanDenormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Denormalizer/CompanyPaymentTransactionDenormalizer.php b/src/Api/Monetization/Denormalizer/CompanyPaymentTransactionDenormalizer.php
index 7339a7d81..03f544616 100644
--- a/src/Api/Monetization/Denormalizer/CompanyPaymentTransactionDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/CompanyPaymentTransactionDenormalizer.php
@@ -37,10 +37,10 @@ class CompanyPaymentTransactionDenormalizer extends PaymentTransactionDenormaliz
/**
* CompanyPaymentTransactionDenormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Denormalizer/CompanyReportDefinitionDenormalizer.php b/src/Api/Monetization/Denormalizer/CompanyReportDefinitionDenormalizer.php
index 9c52f55d4..691f7519a 100644
--- a/src/Api/Monetization/Denormalizer/CompanyReportDefinitionDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/CompanyReportDefinitionDenormalizer.php
@@ -37,10 +37,10 @@ class CompanyReportDefinitionDenormalizer extends ReportDefinitionDenormalizer
/**
* CompanyReportDefinitionDenormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Denormalizer/DateTimeZoneDenormalizer.php b/src/Api/Monetization/Denormalizer/DateTimeZoneDenormalizer.php
index 3f91ed78b..049c807a7 100644
--- a/src/Api/Monetization/Denormalizer/DateTimeZoneDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/DateTimeZoneDenormalizer.php
@@ -19,6 +19,7 @@
namespace Apigee\Edge\Api\Monetization\Denormalizer;
use DateTimeZone;
+use Exception;
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
@@ -31,7 +32,7 @@ public function denormalize($data, $type, $format = null, array $context = [])
{
try {
return new DateTimeZone($data);
- } catch (\Exception $e) {
+ } catch (Exception $e) {
throw new UnexpectedValueException(sprintf('"%s" is not a valid timezone.', $data), (int) $e->getCode(), $e);
}
}
@@ -48,4 +49,14 @@ public function supportsDenormalization($data, $type, $format = null)
return DateTimeZone::class === $type || $type instanceof DateTimeZone;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ DateTimeZone::class => true,
+ ];
+ }
}
diff --git a/src/Api/Monetization/Denormalizer/LegalEntityDenormalizer.php b/src/Api/Monetization/Denormalizer/LegalEntityDenormalizer.php
index db7257b51..b547b8259 100644
--- a/src/Api/Monetization/Denormalizer/LegalEntityDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/LegalEntityDenormalizer.php
@@ -50,10 +50,10 @@ class LegalEntityDenormalizer extends ObjectDenormalizer
/**
* LegalEntityDenormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Denormalizer/OrganizationProfileDenormalizer.php b/src/Api/Monetization/Denormalizer/OrganizationProfileDenormalizer.php
index 95fa9e07a..0bfc90663 100644
--- a/src/Api/Monetization/Denormalizer/OrganizationProfileDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/OrganizationProfileDenormalizer.php
@@ -31,10 +31,10 @@ class OrganizationProfileDenormalizer extends ObjectDenormalizer
/**
* OrganizationProfileDenormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Denormalizer/PaymentTransactionDenormalizer.php b/src/Api/Monetization/Denormalizer/PaymentTransactionDenormalizer.php
index d01c8f291..843085c68 100644
--- a/src/Api/Monetization/Denormalizer/PaymentTransactionDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/PaymentTransactionDenormalizer.php
@@ -31,10 +31,10 @@ abstract class PaymentTransactionDenormalizer extends ObjectDenormalizer
/**
* PaymentTransactionDenormalizer.php constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Denormalizer/PrepaidBalanceDenormalizer.php b/src/Api/Monetization/Denormalizer/PrepaidBalanceDenormalizer.php
index b7db7f644..9c85a26cb 100644
--- a/src/Api/Monetization/Denormalizer/PrepaidBalanceDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/PrepaidBalanceDenormalizer.php
@@ -31,10 +31,10 @@ class PrepaidBalanceDenormalizer extends ObjectDenormalizer
/**
* PrepaidBalanceDenormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Denormalizer/RatePlanDenormalizer.php b/src/Api/Monetization/Denormalizer/RatePlanDenormalizer.php
index cd8a15e0a..0e570503e 100644
--- a/src/Api/Monetization/Denormalizer/RatePlanDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/RatePlanDenormalizer.php
@@ -37,10 +37,10 @@ abstract class RatePlanDenormalizer extends ObjectDenormalizer
/**
* RatePlanDenormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
@@ -56,7 +56,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
*/
public function denormalize($data, $type, $format = null, array $context = [])
{
- /** @var \Apigee\Edge\Api\Monetization\Entity\RatePlanInterface $entity */
+ /** @var RatePlanInterface $entity */
$entity = parent::denormalize($data, $type, $format, $context);
$this->fixTimeZoneOnDenormalization($data, $entity, $entity->getOrganization()->getTimezone());
diff --git a/src/Api/Monetization/Denormalizer/RatePlanDenormalizerFactory.php b/src/Api/Monetization/Denormalizer/RatePlanDenormalizerFactory.php
index 035e97c86..b425f999c 100644
--- a/src/Api/Monetization/Denormalizer/RatePlanDenormalizerFactory.php
+++ b/src/Api/Monetization/Denormalizer/RatePlanDenormalizerFactory.php
@@ -90,4 +90,14 @@ public function setSerializer(SerializerInterface $serializer): void
}
}
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ '*' => false,
+ ];
+ }
}
diff --git a/src/Api/Monetization/Denormalizer/ReportCriteriaDenormalizer.php b/src/Api/Monetization/Denormalizer/ReportCriteriaDenormalizer.php
index f79f76616..f28fea51c 100644
--- a/src/Api/Monetization/Denormalizer/ReportCriteriaDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/ReportCriteriaDenormalizer.php
@@ -27,6 +27,7 @@
use Apigee\Edge\Api\Monetization\Utility\TimezoneFixerHelperTrait;
use Apigee\Edge\Denormalizer\ObjectDenormalizer;
use Apigee\Edge\Exception\InvalidArgumentException;
+use DateTimeZone;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
@@ -44,10 +45,10 @@ class ReportCriteriaDenormalizer extends ObjectDenormalizer
/**
* ReportsCriteriaDenormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
@@ -119,7 +120,7 @@ public function denormalize($data, $type, $format = null, array $context = [])
// According to the API documentation it is always UTC.
// https://docs.apigee.com/api-platform/monetization/create-reports#createreportdefapi
- $this->fixTimeZoneOnDenormalization($data, $denormalized, new \DateTimeZone('UTC'));
+ $this->fixTimeZoneOnDenormalization($data, $denormalized, new DateTimeZone('UTC'));
return $denormalized;
}
diff --git a/src/Api/Monetization/Denormalizer/ReportDefinitionDenormalizer.php b/src/Api/Monetization/Denormalizer/ReportDefinitionDenormalizer.php
index ff1c3af76..a37f8cc9b 100644
--- a/src/Api/Monetization/Denormalizer/ReportDefinitionDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/ReportDefinitionDenormalizer.php
@@ -31,10 +31,10 @@ class ReportDefinitionDenormalizer extends ObjectDenormalizer
/**
* ReportDefinitionDenormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Denormalizer/SupportedCurrencyDenormalizer.php b/src/Api/Monetization/Denormalizer/SupportedCurrencyDenormalizer.php
index 248b22459..37e7f2eb7 100644
--- a/src/Api/Monetization/Denormalizer/SupportedCurrencyDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/SupportedCurrencyDenormalizer.php
@@ -31,10 +31,10 @@ class SupportedCurrencyDenormalizer extends ObjectDenormalizer
/**
* SupportedCurrencyDenormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Denormalizer/TermsAndConditionsDenormalizer.php b/src/Api/Monetization/Denormalizer/TermsAndConditionsDenormalizer.php
index c12eff05f..61efbe651 100644
--- a/src/Api/Monetization/Denormalizer/TermsAndConditionsDenormalizer.php
+++ b/src/Api/Monetization/Denormalizer/TermsAndConditionsDenormalizer.php
@@ -34,10 +34,10 @@ class TermsAndConditionsDenormalizer extends ObjectDenormalizer
/**
* TermsAndConditionsDenormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
@@ -53,7 +53,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
*/
public function denormalize($data, $type, $format = null, array $context = [])
{
- /** @var \Apigee\Edge\Api\Monetization\Entity\TermsAndConditionsInterface $entity */
+ /** @var TermsAndConditionsInterface $entity */
$entity = parent::denormalize($data, $type, $format, $context);
$this->fixTimeZoneOnDenormalization($data, $entity, $entity->getOrganization()->getTimezone());
diff --git a/src/Api/Monetization/Entity/AcceptedRatePlan.php b/src/Api/Monetization/Entity/AcceptedRatePlan.php
index 020f2eddb..2ff0bf360 100644
--- a/src/Api/Monetization/Entity/AcceptedRatePlan.php
+++ b/src/Api/Monetization/Entity/AcceptedRatePlan.php
@@ -20,50 +20,51 @@
use Apigee\Edge\Api\Monetization\Entity\Property\EndDatePropertyAwareTrait;
use Apigee\Edge\Api\Monetization\Entity\Property\StartDatePropertyAwareTrait;
+use DateTimeImmutable;
abstract class AcceptedRatePlan extends Entity implements AcceptedRatePlanInterface
{
use EndDatePropertyAwareTrait;
use StartDatePropertyAwareTrait;
- /** @var \DateTimeImmutable|null */
+ /** @var DateTimeImmutable|null */
protected $created;
/** @var int|null */
protected $quotaTarget;
- /** @var \Apigee\Edge\Api\Monetization\Entity\RatePlanInterface */
+ /** @var RatePlanInterface */
protected $ratePlan;
- /** @var \DateTimeImmutable|null */
+ /** @var DateTimeImmutable|null */
protected $updated;
- /** @var \DateTimeImmutable|null */
+ /** @var DateTimeImmutable|null */
protected $renewalDate;
- /** @var \DateTimeImmutable|null */
+ /** @var DateTimeImmutable|null */
protected $nextCycleStartDate;
- /** @var \DateTimeImmutable|null */
+ /** @var DateTimeImmutable|null */
protected $nextRecurringFeeDate;
- /** @var \DateTimeImmutable|null */
+ /** @var DateTimeImmutable|null */
protected $prevRecurringFeeDate;
/**
* {@inheritdoc}
*/
- public function getUpdated(): ?\DateTimeImmutable
+ public function getUpdated(): ?DateTimeImmutable
{
return $this->updated;
}
/**
- * @param \DateTimeImmutable $updated
+ * @param DateTimeImmutable $updated
*
* @internal
*/
- public function setUpdated(\DateTimeImmutable $updated): void
+ public function setUpdated(DateTimeImmutable $updated): void
{
$this->updated = $updated;
}
@@ -71,17 +72,17 @@ public function setUpdated(\DateTimeImmutable $updated): void
/**
* {@inheritdoc}
*/
- public function getCreated(): ?\DateTimeImmutable
+ public function getCreated(): ?DateTimeImmutable
{
return $this->created;
}
/**
- * @param \DateTimeImmutable $created
+ * @param DateTimeImmutable $created
*
* @internal
*/
- public function setCreated(\DateTimeImmutable $created): void
+ public function setCreated(DateTimeImmutable $created): void
{
$this->created = $created;
}
@@ -121,17 +122,17 @@ public function setRatePlan(RatePlanInterface $ratePlan): void
/**
* {@inheritdoc}
*/
- public function getRenewalDate(): ?\DateTimeImmutable
+ public function getRenewalDate(): ?DateTimeImmutable
{
return $this->renewalDate;
}
/**
- * @param \DateTimeImmutable $renewalDate
+ * @param DateTimeImmutable $renewalDate
*
* @internal
*/
- public function setRenewalDate(\DateTimeImmutable $renewalDate): void
+ public function setRenewalDate(DateTimeImmutable $renewalDate): void
{
$this->renewalDate = $renewalDate;
}
@@ -139,17 +140,17 @@ public function setRenewalDate(\DateTimeImmutable $renewalDate): void
/**
* {@inheritdoc}
*/
- public function getNextCycleStartDate(): ?\DateTimeImmutable
+ public function getNextCycleStartDate(): ?DateTimeImmutable
{
return $this->nextCycleStartDate;
}
/**
- * @param \DateTimeImmutable $nextCycleStartDate
+ * @param DateTimeImmutable $nextCycleStartDate
*
* @internal
*/
- public function setNextCycleStartDate(\DateTimeImmutable $nextCycleStartDate): void
+ public function setNextCycleStartDate(DateTimeImmutable $nextCycleStartDate): void
{
$this->nextCycleStartDate = $nextCycleStartDate;
}
@@ -157,17 +158,17 @@ public function setNextCycleStartDate(\DateTimeImmutable $nextCycleStartDate): v
/**
* {@inheritdoc}
*/
- public function getNextRecurringFeeDate(): ?\DateTimeImmutable
+ public function getNextRecurringFeeDate(): ?DateTimeImmutable
{
return $this->nextRecurringFeeDate;
}
/**
- * @param \DateTimeImmutable $nextRecurringFeeDate
+ * @param DateTimeImmutable $nextRecurringFeeDate
*
* @internal
*/
- public function setNextRecurringFeeDate(\DateTimeImmutable $nextRecurringFeeDate): void
+ public function setNextRecurringFeeDate(DateTimeImmutable $nextRecurringFeeDate): void
{
$this->nextRecurringFeeDate = $nextRecurringFeeDate;
}
@@ -175,17 +176,17 @@ public function setNextRecurringFeeDate(\DateTimeImmutable $nextRecurringFeeDate
/**
* {@inheritdoc}
*/
- public function getPrevRecurringFeeDate(): ?\DateTimeImmutable
+ public function getPrevRecurringFeeDate(): ?DateTimeImmutable
{
return $this->prevRecurringFeeDate;
}
/**
- * @param \DateTimeImmutable $prevRecurringFeeDate
+ * @param DateTimeImmutable $prevRecurringFeeDate
*
* @internal
*/
- public function setPrevRecurringFeeDate(\DateTimeImmutable $prevRecurringFeeDate): void
+ public function setPrevRecurringFeeDate(DateTimeImmutable $prevRecurringFeeDate): void
{
$this->prevRecurringFeeDate = $prevRecurringFeeDate;
}
diff --git a/src/Api/Monetization/Entity/AcceptedRatePlanInterface.php b/src/Api/Monetization/Entity/AcceptedRatePlanInterface.php
index f95f769ad..563a606ec 100644
--- a/src/Api/Monetization/Entity/AcceptedRatePlanInterface.php
+++ b/src/Api/Monetization/Entity/AcceptedRatePlanInterface.php
@@ -20,6 +20,7 @@
use Apigee\Edge\Api\Monetization\Entity\Property\EndDatePropertyInterface;
use Apigee\Edge\Api\Monetization\Entity\Property\StartDatePropertyInterface;
+use DateTimeImmutable;
interface AcceptedRatePlanInterface extends
EntityInterface,
@@ -27,14 +28,14 @@ interface AcceptedRatePlanInterface extends
StartDatePropertyInterface
{
/**
- * @return \DateTimeImmutable|null
+ * @return DateTimeImmutable|null
*/
- public function getUpdated(): ?\DateTimeImmutable;
+ public function getUpdated(): ?DateTimeImmutable;
/**
- * @return \DateTimeImmutable|null
+ * @return DateTimeImmutable|null
*/
- public function getCreated(): ?\DateTimeImmutable;
+ public function getCreated(): ?DateTimeImmutable;
/**
* @return int|null
@@ -47,32 +48,32 @@ public function getQuotaTarget(): ?int;
public function setQuotaTarget(int $quotaTarget): void;
/**
- * @return \Apigee\Edge\Api\Monetization\Entity\RatePlanInterface
+ * @return RatePlanInterface
*/
public function getRatePlan(): RatePlanInterface;
/**
- * @param \Apigee\Edge\Api\Monetization\Entity\RatePlanInterface $ratePlan
+ * @param RatePlanInterface $ratePlan
*/
public function setRatePlan(RatePlanInterface $ratePlan): void;
/**
- * @return \DateTimeImmutable|null
+ * @return DateTimeImmutable|null
*/
- public function getRenewalDate(): ?\DateTimeImmutable;
+ public function getRenewalDate(): ?DateTimeImmutable;
/**
- * @return \DateTimeImmutable|null
+ * @return DateTimeImmutable|null
*/
- public function getNextCycleStartDate(): ?\DateTimeImmutable;
+ public function getNextCycleStartDate(): ?DateTimeImmutable;
/**
- * @return \DateTimeImmutable|null
+ * @return DateTimeImmutable|null
*/
- public function getNextRecurringFeeDate(): ?\DateTimeImmutable;
+ public function getNextRecurringFeeDate(): ?DateTimeImmutable;
/**
- * @return \DateTimeImmutable|null
+ * @return DateTimeImmutable|null
*/
- public function getPrevRecurringFeeDate(): ?\DateTimeImmutable;
+ public function getPrevRecurringFeeDate(): ?DateTimeImmutable;
}
diff --git a/src/Api/Monetization/Entity/Balance.php b/src/Api/Monetization/Entity/Balance.php
index 848d09e0a..2bc272194 100644
--- a/src/Api/Monetization/Entity/Balance.php
+++ b/src/Api/Monetization/Entity/Balance.php
@@ -28,7 +28,7 @@ class Balance extends Entity implements BalanceInterface
/**
* Value of "supportedCurrency" from the API response.
*
- * @var \Apigee\Edge\Api\Monetization\Entity\SupportedCurrency
+ * @var SupportedCurrency
*/
protected $currency;
@@ -48,7 +48,7 @@ class Balance extends Entity implements BalanceInterface
/** @var float */
protected $usage;
- /** @var \Apigee\Edge\Api\Monetization\Structure\PaymentTransaction|null */
+ /** @var PaymentTransaction|null */
protected $transaction;
/**
@@ -132,7 +132,7 @@ public function getTransaction(): ?PaymentTransaction
}
/**
- * @param \Apigee\Edge\Api\Monetization\Structure\PaymentTransaction $transaction
+ * @param PaymentTransaction $transaction
*
* @internal
*/
diff --git a/src/Api/Monetization/Entity/BalanceInterface.php b/src/Api/Monetization/Entity/BalanceInterface.php
index 4e9146453..c29d485eb 100644
--- a/src/Api/Monetization/Entity/BalanceInterface.php
+++ b/src/Api/Monetization/Entity/BalanceInterface.php
@@ -49,7 +49,7 @@ public function isRecurring(): bool;
public function getUsage(): float;
/**
- * @return \Apigee\Edge\Api\Monetization\Structure\PaymentTransaction|null
+ * @return PaymentTransaction|null
*/
public function getTransaction(): ?PaymentTransaction;
}
diff --git a/src/Api/Monetization/Entity/Developer.php b/src/Api/Monetization/Entity/Developer.php
index f1095bbf6..7153835bd 100644
--- a/src/Api/Monetization/Entity/Developer.php
+++ b/src/Api/Monetization/Entity/Developer.php
@@ -30,7 +30,7 @@ class Developer extends LegalEntity implements DeveloperInterface
* Also the nested company object does not contain some information, like
* address, customAttributes, etc.
*
- * @var \Apigee\Edge\Api\Monetization\Entity\Company|null
+ * @var Company|null
*/
protected $company;
@@ -45,7 +45,7 @@ public function getCompany(): ?CompanyInterface
/**
* @internal
*
- * @param \Apigee\Edge\Api\Monetization\Entity\Company $company
+ * @param Company $company
*/
public function setCompany(Company $company): void
{
diff --git a/src/Api/Monetization/Entity/DeveloperCategoryRatePlan.php b/src/Api/Monetization/Entity/DeveloperCategoryRatePlan.php
index 915d3f1b9..0a667050a 100644
--- a/src/Api/Monetization/Entity/DeveloperCategoryRatePlan.php
+++ b/src/Api/Monetization/Entity/DeveloperCategoryRatePlan.php
@@ -20,7 +20,7 @@
class DeveloperCategoryRatePlan extends RatePlan implements DeveloperCategoryRatePlanInterface
{
- /** @var \Apigee\Edge\Api\Monetization\Entity\DeveloperCategory */
+ /** @var DeveloperCategory */
protected $developerCategory;
/**
diff --git a/src/Api/Monetization/Entity/DeveloperCategoryRatePlanInterface.php b/src/Api/Monetization/Entity/DeveloperCategoryRatePlanInterface.php
index feedf139f..34617e9ed 100644
--- a/src/Api/Monetization/Entity/DeveloperCategoryRatePlanInterface.php
+++ b/src/Api/Monetization/Entity/DeveloperCategoryRatePlanInterface.php
@@ -21,12 +21,12 @@
interface DeveloperCategoryRatePlanInterface extends RatePlanInterface
{
/**
- * @return \Apigee\Edge\Api\Monetization\Entity\DeveloperCategoryInterface
+ * @return DeveloperCategoryInterface
*/
public function getDeveloperCategory(): DeveloperCategoryInterface;
/**
- * @param \Apigee\Edge\Api\Monetization\Entity\DeveloperCategoryInterface $developerCategory
+ * @param DeveloperCategoryInterface $developerCategory
*/
public function setDeveloperCategory(DeveloperCategoryInterface $developerCategory): void;
}
diff --git a/src/Api/Monetization/Entity/DeveloperRatePlanInterface.php b/src/Api/Monetization/Entity/DeveloperRatePlanInterface.php
index 3b6d1306e..0cc59111c 100644
--- a/src/Api/Monetization/Entity/DeveloperRatePlanInterface.php
+++ b/src/Api/Monetization/Entity/DeveloperRatePlanInterface.php
@@ -23,7 +23,7 @@
interface DeveloperRatePlanInterface extends RatePlanInterface, DeveloperPropertyInterface
{
/**
- * @param \Apigee\Edge\Api\Monetization\Entity\DeveloperInterface $developer
+ * @param DeveloperInterface $developer
*/
public function setDeveloper(DeveloperInterface $developer): void;
}
diff --git a/src/Api/Monetization/Entity/LegalEntity.php b/src/Api/Monetization/Entity/LegalEntity.php
index af6ebdae0..2a223f886 100644
--- a/src/Api/Monetization/Entity/LegalEntity.php
+++ b/src/Api/Monetization/Entity/LegalEntity.php
@@ -187,7 +187,7 @@ public function getDeveloperCategory(): ?DeveloperCategory
}
/**
- * @param \Apigee\Edge\Api\Monetization\Entity\DeveloperCategory $developerCategory
+ * @param DeveloperCategory $developerCategory
*
* @internal
*/
diff --git a/src/Api/Monetization/Entity/LegalEntityInterface.php b/src/Api/Monetization/Entity/LegalEntityInterface.php
index d00c8abeb..541250207 100644
--- a/src/Api/Monetization/Entity/LegalEntityInterface.php
+++ b/src/Api/Monetization/Entity/LegalEntityInterface.php
@@ -77,7 +77,7 @@ public function getPhone(): ?string;
public function getRegistrationId(): ?string;
/**
- * @return \Apigee\Edge\Api\Monetization\Entity\DeveloperCategory|null
+ * @return DeveloperCategory|null
*/
public function getDeveloperCategory(): ?DeveloperCategory;
diff --git a/src/Api/Monetization/Entity/OrganizationProfile.php b/src/Api/Monetization/Entity/OrganizationProfile.php
index eb67116e3..2b10de63e 100644
--- a/src/Api/Monetization/Entity/OrganizationProfile.php
+++ b/src/Api/Monetization/Entity/OrganizationProfile.php
@@ -98,7 +98,7 @@ class OrganizationProfile extends Entity implements OrganizationProfileInterface
/** @var string|null */
protected $transactionRelayURL;
- /** @var \DateTimeZone */
+ /** @var DateTimeZone */
protected $timezone;
/**
diff --git a/src/Api/Monetization/Entity/OrganizationProfileInterface.php b/src/Api/Monetization/Entity/OrganizationProfileInterface.php
index 85186383c..0192dcbdd 100755
--- a/src/Api/Monetization/Entity/OrganizationProfileInterface.php
+++ b/src/Api/Monetization/Entity/OrganizationProfileInterface.php
@@ -253,12 +253,12 @@ public function getTransactionRelayURL(): ?string;
public function setTransactionRelayURL(string $transactionRelayURL): void;
/**
- * @return \DateTimeZone
+ * @return DateTimeZone
*/
public function getTimezone(): DateTimeZone;
/**
- * @param \DateTimeZone $timezone
+ * @param DateTimeZone $timezone
*/
public function setTimezone(DateTimeZone $timezone): void;
diff --git a/src/Api/Monetization/Entity/PrepaidBalance.php b/src/Api/Monetization/Entity/PrepaidBalance.php
index 4cb16f282..44fe41e94 100644
--- a/src/Api/Monetization/Entity/PrepaidBalance.php
+++ b/src/Api/Monetization/Entity/PrepaidBalance.php
@@ -40,7 +40,7 @@ class PrepaidBalance extends Entity implements PrepaidBalanceInterface
/**
* Value of "supportedCurrency" from the API response.
*
- * @var \Apigee\Edge\Api\Monetization\Entity\SupportedCurrency
+ * @var SupportedCurrency
*/
protected $currency;
diff --git a/src/Api/Monetization/Entity/Property/AddressesPropertyAwareTrait.php b/src/Api/Monetization/Entity/Property/AddressesPropertyAwareTrait.php
index 472abd2e3..084f3aaf9 100644
--- a/src/Api/Monetization/Entity/Property/AddressesPropertyAwareTrait.php
+++ b/src/Api/Monetization/Entity/Property/AddressesPropertyAwareTrait.php
@@ -23,7 +23,7 @@
/**
* Trait AddressesPropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\Monetization\Entity\Property\AddressesPropertyInterface
+ * @see AddressesPropertyInterface
*/
trait AddressesPropertyAwareTrait
{
diff --git a/src/Api/Monetization/Entity/Property/AddressesPropertyInterface.php b/src/Api/Monetization/Entity/Property/AddressesPropertyInterface.php
index 433ba6277..948858569 100644
--- a/src/Api/Monetization/Entity/Property/AddressesPropertyInterface.php
+++ b/src/Api/Monetization/Entity/Property/AddressesPropertyInterface.php
@@ -28,7 +28,7 @@ interface AddressesPropertyInterface
public function getAddresses(): array;
/**
- * @param \Apigee\Edge\Api\Monetization\Structure\Address ...$addresses
+ * @param Address ...$addresses
*/
public function setAddresses(Address ...$addresses): void;
}
diff --git a/src/Api/Monetization/Entity/Property/ApiProductsPropertyAwareTrait.php b/src/Api/Monetization/Entity/Property/ApiProductsPropertyAwareTrait.php
index b03dd283f..788498c0b 100644
--- a/src/Api/Monetization/Entity/Property/ApiProductsPropertyAwareTrait.php
+++ b/src/Api/Monetization/Entity/Property/ApiProductsPropertyAwareTrait.php
@@ -23,7 +23,7 @@
/**
* Trait ApiProductsPropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\Monetization\Entity\Property\ApiProductsPropertyInterface
+ * @see ApiProductsPropertyInterface
*/
trait ApiProductsPropertyAwareTrait
{
@@ -43,7 +43,7 @@ public function getApiProducts(): array
/**
* Sets API products associated with this API package.
*
- * @param \Apigee\Edge\Api\Monetization\Entity\ApiProductInterface ...$products
+ * @param ApiProductInterface ...$products
*
* @internal
*/
diff --git a/src/Api/Monetization/Entity/Property/BrokerPropertyAwareTrait.php b/src/Api/Monetization/Entity/Property/BrokerPropertyAwareTrait.php
index 67ffa1808..5a776dd16 100644
--- a/src/Api/Monetization/Entity/Property/BrokerPropertyAwareTrait.php
+++ b/src/Api/Monetization/Entity/Property/BrokerPropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait BrokerPropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\Monetization\Entity\Property\BrokerPropertyInterface
+ * @see BrokerPropertyInterface
*/
trait BrokerPropertyAwareTrait
{
diff --git a/src/Api/Monetization/Entity/Property/CompanyPropertyAwareTrait.php b/src/Api/Monetization/Entity/Property/CompanyPropertyAwareTrait.php
index f218f5b76..2f53c0ba2 100644
--- a/src/Api/Monetization/Entity/Property/CompanyPropertyAwareTrait.php
+++ b/src/Api/Monetization/Entity/Property/CompanyPropertyAwareTrait.php
@@ -23,14 +23,14 @@
/**
* Trait CompanyPropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\Monetization\Entity\Property\CompanyPropertyInterface
+ * @see CompanyPropertyInterface
*/
trait CompanyPropertyAwareTrait
{
/**
* Value of "developer" from the API response.
*
- * @var \Apigee\Edge\Api\Monetization\Entity\CompanyInterface|null
+ * @var CompanyInterface|null
*/
protected $company;
diff --git a/src/Api/Monetization/Entity/Property/CompanyPropertyInterface.php b/src/Api/Monetization/Entity/Property/CompanyPropertyInterface.php
index 9e4e20ddb..babaea8f0 100644
--- a/src/Api/Monetization/Entity/Property/CompanyPropertyInterface.php
+++ b/src/Api/Monetization/Entity/Property/CompanyPropertyInterface.php
@@ -23,7 +23,7 @@
interface CompanyPropertyInterface
{
/**
- * @return \Apigee\Edge\Api\Monetization\Entity\CompanyInterface|null
+ * @return CompanyInterface|null
* It can be null only when a new entity is created.
*/
public function getCompany(): ?CompanyInterface;
diff --git a/src/Api/Monetization/Entity/Property/CurrencyPropertyAwareTrait.php b/src/Api/Monetization/Entity/Property/CurrencyPropertyAwareTrait.php
index 53cd90bf5..293b71405 100644
--- a/src/Api/Monetization/Entity/Property/CurrencyPropertyAwareTrait.php
+++ b/src/Api/Monetization/Entity/Property/CurrencyPropertyAwareTrait.php
@@ -23,7 +23,7 @@
/**
* Trait CurrencyPropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\Monetization\Entity\Property\CurrencyPropertyInterface
+ * @see CurrencyPropertyInterface
*/
trait CurrencyPropertyAwareTrait
{
diff --git a/src/Api/Monetization/Entity/Property/CurrencyPropertyInterface.php b/src/Api/Monetization/Entity/Property/CurrencyPropertyInterface.php
index ee42cdea5..520e45427 100644
--- a/src/Api/Monetization/Entity/Property/CurrencyPropertyInterface.php
+++ b/src/Api/Monetization/Entity/Property/CurrencyPropertyInterface.php
@@ -23,12 +23,12 @@
interface CurrencyPropertyInterface
{
/**
- * @return \Apigee\Edge\Api\Monetization\Entity\SupportedCurrencyInterface
+ * @return SupportedCurrencyInterface
*/
public function getCurrency(): SupportedCurrencyInterface;
/**
- * @param \Apigee\Edge\Api\Monetization\Entity\SupportedCurrencyInterface $currency
+ * @param SupportedCurrencyInterface $currency
*/
public function setCurrency(SupportedCurrencyInterface $currency): void;
}
diff --git a/src/Api/Monetization/Entity/Property/DeveloperPropertyAwareTrait.php b/src/Api/Monetization/Entity/Property/DeveloperPropertyAwareTrait.php
index d17711353..42906ad30 100644
--- a/src/Api/Monetization/Entity/Property/DeveloperPropertyAwareTrait.php
+++ b/src/Api/Monetization/Entity/Property/DeveloperPropertyAwareTrait.php
@@ -23,11 +23,11 @@
/**
* Trait DeveloperPropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\Monetization\Entity\Property\DeveloperPropertyInterface
+ * @see DeveloperPropertyInterface
*/
trait DeveloperPropertyAwareTrait
{
- /** @var \Apigee\Edge\Api\Monetization\Entity\DeveloperInterface|null */
+ /** @var DeveloperInterface|null */
protected $developer;
/**
diff --git a/src/Api/Monetization/Entity/Property/DeveloperPropertyInterface.php b/src/Api/Monetization/Entity/Property/DeveloperPropertyInterface.php
index b4b79b142..fb046c5e2 100644
--- a/src/Api/Monetization/Entity/Property/DeveloperPropertyInterface.php
+++ b/src/Api/Monetization/Entity/Property/DeveloperPropertyInterface.php
@@ -23,7 +23,7 @@
interface DeveloperPropertyInterface
{
/**
- * @return \Apigee\Edge\Api\Monetization\Entity\DeveloperInterface|null
+ * @return DeveloperInterface|null
* It can be null only when a new entity is created.
*/
public function getDeveloper(): ?DeveloperInterface;
diff --git a/src/Api/Monetization/Entity/Property/EndDatePropertyAwareTrait.php b/src/Api/Monetization/Entity/Property/EndDatePropertyAwareTrait.php
index dac462567..d794c68d1 100644
--- a/src/Api/Monetization/Entity/Property/EndDatePropertyAwareTrait.php
+++ b/src/Api/Monetization/Entity/Property/EndDatePropertyAwareTrait.php
@@ -18,22 +18,24 @@
namespace Apigee\Edge\Api\Monetization\Entity\Property;
+use DateTimeImmutable;
+
/**
* Trait EndDatePropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\Monetization\Entity\Property\EndDatePropertyInterface
+ * @see EndDatePropertyInterface
*/
trait EndDatePropertyAwareTrait
{
/**
- * @var \DateTimeImmutable|null
+ * @var DateTimeImmutable|null
*/
protected $endDate;
/**
* {@inheritdoc}
*/
- public function getEndDate(): ?\DateTimeImmutable
+ public function getEndDate(): ?DateTimeImmutable
{
return $this->endDate;
}
@@ -41,7 +43,7 @@ public function getEndDate(): ?\DateTimeImmutable
/**
* {@inheritdoc}
*/
- public function setEndDate(?\DateTimeImmutable $endDate): void
+ public function setEndDate(?DateTimeImmutable $endDate): void
{
$this->endDate = $endDate;
}
diff --git a/src/Api/Monetization/Entity/Property/EndDatePropertyInterface.php b/src/Api/Monetization/Entity/Property/EndDatePropertyInterface.php
index 92f279005..8586304ad 100644
--- a/src/Api/Monetization/Entity/Property/EndDatePropertyInterface.php
+++ b/src/Api/Monetization/Entity/Property/EndDatePropertyInterface.php
@@ -18,15 +18,17 @@
namespace Apigee\Edge\Api\Monetization\Entity\Property;
+use DateTimeImmutable;
+
interface EndDatePropertyInterface
{
/**
- * @return \DateTimeImmutable|null
+ * @return DateTimeImmutable|null
*/
- public function getEndDate(): ?\DateTimeImmutable;
+ public function getEndDate(): ?DateTimeImmutable;
/**
- * @param \DateTimeImmutable|null $endDate
+ * @param DateTimeImmutable|null $endDate
*/
- public function setEndDate(?\DateTimeImmutable $endDate): void;
+ public function setEndDate(?DateTimeImmutable $endDate): void;
}
diff --git a/src/Api/Monetization/Entity/Property/FreemiumPropertiesAwareTrait.php b/src/Api/Monetization/Entity/Property/FreemiumPropertiesAwareTrait.php
index c1b2556b0..cadbed0c2 100644
--- a/src/Api/Monetization/Entity/Property/FreemiumPropertiesAwareTrait.php
+++ b/src/Api/Monetization/Entity/Property/FreemiumPropertiesAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait FreemiumDurationPropertiesAwareTrait.
*
- * @see \Apigee\Edge\Api\Monetization\Entity\Property\FreemiumPropertiesInterface
+ * @see FreemiumPropertiesInterface
*/
trait FreemiumPropertiesAwareTrait
{
diff --git a/src/Api/Monetization/Entity/Property/IdPropertyAwareTrait.php b/src/Api/Monetization/Entity/Property/IdPropertyAwareTrait.php
index 198eed705..34e14a796 100644
--- a/src/Api/Monetization/Entity/Property/IdPropertyAwareTrait.php
+++ b/src/Api/Monetization/Entity/Property/IdPropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait IdPropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\Monetization\Entity\Property\IdPropertyInterface
+ * @see IdPropertyInterface
*/
trait IdPropertyAwareTrait
{
diff --git a/src/Api/Monetization/Entity/Property/KeepOriginalStartDatePropertyAwareTrait.php b/src/Api/Monetization/Entity/Property/KeepOriginalStartDatePropertyAwareTrait.php
index 56a902dea..c6c18ef19 100644
--- a/src/Api/Monetization/Entity/Property/KeepOriginalStartDatePropertyAwareTrait.php
+++ b/src/Api/Monetization/Entity/Property/KeepOriginalStartDatePropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait KeepOriginalStartDatePropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\Monetization\Entity\Property\KeepOriginalStartDatePropertyInterface
+ * @see KeepOriginalStartDatePropertyInterface
*/
trait KeepOriginalStartDatePropertyAwareTrait
{
diff --git a/src/Api/Monetization/Entity/Property/OrganizationPropertyAwareTrait.php b/src/Api/Monetization/Entity/Property/OrganizationPropertyAwareTrait.php
index da61a52c7..954bad600 100644
--- a/src/Api/Monetization/Entity/Property/OrganizationPropertyAwareTrait.php
+++ b/src/Api/Monetization/Entity/Property/OrganizationPropertyAwareTrait.php
@@ -23,7 +23,7 @@
/**
* Trait OrganizationPropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\Monetization\Entity\OrganizationProfileInterface
+ * @see OrganizationProfileInterface
*/
trait OrganizationPropertyAwareTrait
{
diff --git a/src/Api/Monetization/Entity/Property/OrganizationPropertyInterface.php b/src/Api/Monetization/Entity/Property/OrganizationPropertyInterface.php
index 0c9fe077d..758b8a32c 100644
--- a/src/Api/Monetization/Entity/Property/OrganizationPropertyInterface.php
+++ b/src/Api/Monetization/Entity/Property/OrganizationPropertyInterface.php
@@ -25,7 +25,7 @@ interface OrganizationPropertyInterface
/**
* Returns the organization that this entity belongs.
*
- * @return \Apigee\Edge\Api\Monetization\Entity\OrganizationProfileInterface|null
+ * @return OrganizationProfileInterface|null
*/
public function getOrganization(): ?OrganizationProfileInterface;
}
diff --git a/src/Api/Monetization/Entity/Property/PaymentDueDaysPropertyAwareTrait.php b/src/Api/Monetization/Entity/Property/PaymentDueDaysPropertyAwareTrait.php
index 81df1fb7e..459efea01 100644
--- a/src/Api/Monetization/Entity/Property/PaymentDueDaysPropertyAwareTrait.php
+++ b/src/Api/Monetization/Entity/Property/PaymentDueDaysPropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait PaymentDueDaysPropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\Monetization\Entity\Property\PaymentDueDaysPropertyInterface
+ * @see PaymentDueDaysPropertyInterface
*/
trait PaymentDueDaysPropertyAwareTrait
{
diff --git a/src/Api/Monetization/Entity/Property/PreviousRatePlanRevisionPropertyAwareTrait.php b/src/Api/Monetization/Entity/Property/PreviousRatePlanRevisionPropertyAwareTrait.php
index 0a1648ae0..f416a93f9 100644
--- a/src/Api/Monetization/Entity/Property/PreviousRatePlanRevisionPropertyAwareTrait.php
+++ b/src/Api/Monetization/Entity/Property/PreviousRatePlanRevisionPropertyAwareTrait.php
@@ -25,7 +25,7 @@ trait PreviousRatePlanRevisionPropertyAwareTrait
/**
* Value of "parentRatePlan" from the Apigee Edge API response.
*
- * @var \Apigee\Edge\Api\Monetization\Entity\RatePlanInterface|\Apigee\Edge\Api\Monetization\Entity\RatePlanRevisionInterface
+ * @var RatePlanInterface|\Apigee\Edge\Api\Monetization\Entity\RatePlanRevisionInterface
*/
protected $previousRatePlanRevision;
@@ -38,7 +38,7 @@ public function getPreviousRatePlanRevision(): RatePlanInterface
}
/**
- * @param \Apigee\Edge\Api\Monetization\Entity\RatePlanInterface|\Apigee\Edge\Api\Monetization\Entity\RatePlanRevisionInterface $previousRatePlanRevision
+ * @param RatePlanInterface|\Apigee\Edge\Api\Monetization\Entity\RatePlanRevisionInterface $previousRatePlanRevision
*
* @internal
*/
diff --git a/src/Api/Monetization/Entity/Property/PreviousRatePlanRevisionPropertyInterface.php b/src/Api/Monetization/Entity/Property/PreviousRatePlanRevisionPropertyInterface.php
index a2db89003..0379e7172 100644
--- a/src/Api/Monetization/Entity/Property/PreviousRatePlanRevisionPropertyInterface.php
+++ b/src/Api/Monetization/Entity/Property/PreviousRatePlanRevisionPropertyInterface.php
@@ -23,7 +23,7 @@
interface PreviousRatePlanRevisionPropertyInterface
{
/**
- * @return \Apigee\Edge\Api\Monetization\Entity\RatePlanInterface|\Apigee\Edge\Api\Monetization\Entity\RatePlanRevisionInterface
+ * @return RatePlanInterface|\Apigee\Edge\Api\Monetization\Entity\RatePlanRevisionInterface
*/
public function getPreviousRatePlanRevision(): RatePlanInterface;
}
diff --git a/src/Api/Monetization/Entity/Property/ProductPropertyAwareTrait.php b/src/Api/Monetization/Entity/Property/ProductPropertyAwareTrait.php
index 7c1b2ff06..0d1cc3b69 100644
--- a/src/Api/Monetization/Entity/Property/ProductPropertyAwareTrait.php
+++ b/src/Api/Monetization/Entity/Property/ProductPropertyAwareTrait.php
@@ -23,12 +23,12 @@
/**
* Trait ProductPropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\Monetization\Entity\Property\ProductPropertyInterface
+ * @see ProductPropertyInterface
*/
trait ProductPropertyAwareTrait
{
- /** @var \Apigee\Edge\Api\Monetization\Entity\ApiProduct|null */
- protected $product = null;
+ /** @var ApiProduct|null */
+ protected $product;
/**
* {@inheritdoc}
@@ -41,7 +41,7 @@ public function getProduct(): ?ApiProduct
/**
* Sets the product information.
*
- * @param \Apigee\Edge\Api\Monetization\Entity\ApiProduct $product
+ * @param ApiProduct $product
*
* @internal
*/
diff --git a/src/Api/Monetization/Entity/Property/ProductPropertyInterface.php b/src/Api/Monetization/Entity/Property/ProductPropertyInterface.php
index d58f03970..10a3ea7b1 100644
--- a/src/Api/Monetization/Entity/Property/ProductPropertyInterface.php
+++ b/src/Api/Monetization/Entity/Property/ProductPropertyInterface.php
@@ -25,7 +25,7 @@ interface ProductPropertyInterface
/**
* Returns the apiproduct information included in rateplan detials.
*
- * @return \Apigee\Edge\Api\Monetization\Entity\ApiProduct
+ * @return ApiProduct
*/
public function getProduct(): ?ApiProduct;
}
diff --git a/src/Api/Monetization/Entity/Property/RatePropertyAwareTrait.php b/src/Api/Monetization/Entity/Property/RatePropertyAwareTrait.php
index 236da694a..a3eeff5ce 100644
--- a/src/Api/Monetization/Entity/Property/RatePropertyAwareTrait.php
+++ b/src/Api/Monetization/Entity/Property/RatePropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait RatePropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\Monetization\Entity\Property\RatePropertyInterface
+ * @see RatePropertyInterface
*/
trait RatePropertyAwareTrait
{
diff --git a/src/Api/Monetization/Entity/Property/StartDatePropertyAwareTrait.php b/src/Api/Monetization/Entity/Property/StartDatePropertyAwareTrait.php
index 4f3c0b2a5..76d0b8ec6 100644
--- a/src/Api/Monetization/Entity/Property/StartDatePropertyAwareTrait.php
+++ b/src/Api/Monetization/Entity/Property/StartDatePropertyAwareTrait.php
@@ -18,22 +18,24 @@
namespace Apigee\Edge\Api\Monetization\Entity\Property;
+use DateTimeImmutable;
+
/**
* Trait StartDatePropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\Monetization\Entity\Property\StartDatePropertyInterface
+ * @see StartDatePropertyInterface
*/
trait StartDatePropertyAwareTrait
{
/**
- * @var \DateTimeImmutable
+ * @var DateTimeImmutable
*/
protected $startDate;
/**
* {@inheritdoc}
*/
- public function getStartDate(): \DateTimeImmutable
+ public function getStartDate(): DateTimeImmutable
{
return $this->startDate;
}
@@ -41,7 +43,7 @@ public function getStartDate(): \DateTimeImmutable
/**
* {@inheritdoc}
*/
- public function setStartDate(\DateTimeImmutable $startDate): void
+ public function setStartDate(DateTimeImmutable $startDate): void
{
$this->startDate = $startDate;
}
diff --git a/src/Api/Monetization/Entity/Property/StartDatePropertyInterface.php b/src/Api/Monetization/Entity/Property/StartDatePropertyInterface.php
index 747175cc2..d1f8f805d 100644
--- a/src/Api/Monetization/Entity/Property/StartDatePropertyInterface.php
+++ b/src/Api/Monetization/Entity/Property/StartDatePropertyInterface.php
@@ -18,15 +18,17 @@
namespace Apigee\Edge\Api\Monetization\Entity\Property;
+use DateTimeImmutable;
+
interface StartDatePropertyInterface
{
/**
- * @return \DateTimeImmutable
+ * @return DateTimeImmutable
*/
- public function getStartDate(): \DateTimeImmutable;
+ public function getStartDate(): DateTimeImmutable;
/**
- * @param \DateTimeImmutable $startDate
+ * @param DateTimeImmutable $startDate
*/
- public function setStartDate(\DateTimeImmutable $startDate): void;
+ public function setStartDate(DateTimeImmutable $startDate): void;
}
diff --git a/src/Api/Monetization/Entity/Property/VirtualCurrencyPropertyAwareTrait.php b/src/Api/Monetization/Entity/Property/VirtualCurrencyPropertyAwareTrait.php
index 2d080bf99..263a5434f 100644
--- a/src/Api/Monetization/Entity/Property/VirtualCurrencyPropertyAwareTrait.php
+++ b/src/Api/Monetization/Entity/Property/VirtualCurrencyPropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait VirtualCurrencyPropertyAwareTrait.
*
- * @see \Apigee\Edge\Api\Monetization\Entity\Property\VirtualCurrencyPropertyInterface
+ * @see VirtualCurrencyPropertyInterface
*/
trait VirtualCurrencyPropertyAwareTrait
{
diff --git a/src/Api/Monetization/Entity/RatePlan.php b/src/Api/Monetization/Entity/RatePlan.php
index 86c49ff7d..d69328875 100644
--- a/src/Api/Monetization/Entity/RatePlan.php
+++ b/src/Api/Monetization/Entity/RatePlan.php
@@ -76,7 +76,7 @@ abstract class RatePlan extends OrganizationAwareEntity implements RatePlanInter
*
* It can be null when a new rate plan is created.
*
- * @var \Apigee\Edge\Api\Monetization\Entity\ApiPackage|null
+ * @var ApiPackage|null
*/
protected $package;
diff --git a/src/Api/Monetization/Entity/RatePlanInterface.php b/src/Api/Monetization/Entity/RatePlanInterface.php
index 6622da084..7058c7b6e 100644
--- a/src/Api/Monetization/Entity/RatePlanInterface.php
+++ b/src/Api/Monetization/Entity/RatePlanInterface.php
@@ -130,12 +130,12 @@ public function setPrivate(bool $private): void;
/**
* It could be null only when a rate plan is created.
*
- * @return \Apigee\Edge\Api\Monetization\Entity\ApiPackageInterface|null
+ * @return ApiPackageInterface|null
*/
public function getPackage(): ?ApiPackageInterface;
/**
- * @param \Apigee\Edge\Api\Monetization\Entity\ApiPackageInterface $package
+ * @param ApiPackageInterface $package
*/
public function setPackage(ApiPackageInterface $package): void;
@@ -165,7 +165,7 @@ public function setPublished(bool $published): void;
public function getRatePlanDetails(): array;
/**
- * @param \Apigee\Edge\Api\Monetization\Structure\RatePlanDetail ...$ratePlanDetails
+ * @param RatePlanDetail ...$ratePlanDetails
*/
public function setRatePlanDetails(RatePlanDetail ...$ratePlanDetails): void;
diff --git a/src/Api/Monetization/Entity/ReportDefinition.php b/src/Api/Monetization/Entity/ReportDefinition.php
index e6e9638f2..26ea5bd80 100644
--- a/src/Api/Monetization/Entity/ReportDefinition.php
+++ b/src/Api/Monetization/Entity/ReportDefinition.php
@@ -22,6 +22,7 @@
use Apigee\Edge\Api\Monetization\Structure\Reports\Criteria\AbstractCriteria;
use Apigee\Edge\Entity\Property\DescriptionPropertyAwareTrait;
use Apigee\Edge\Entity\Property\NamePropertyAwareTrait;
+use DateTimeImmutable;
class ReportDefinition extends Entity implements ReportDefinitionInterface
{
@@ -29,11 +30,11 @@ class ReportDefinition extends Entity implements ReportDefinitionInterface
use DescriptionPropertyAwareTrait;
use OrganizationPropertyAwareTrait;
- /** @var \Apigee\Edge\Api\Monetization\Structure\Reports\Criteria\AbstractCriteria */
+ /** @var AbstractCriteria */
protected $criteria;
/**
- * @var \DateTimeImmutable|null
+ * @var DateTimeImmutable|null
*/
protected $lastModified;
@@ -56,7 +57,7 @@ public function setCriteria(AbstractCriteria $criteria): void
/**
* {@inheritdoc}
*/
- public function getLastModified(): ?\DateTimeImmutable
+ public function getLastModified(): ?DateTimeImmutable
{
return $this->lastModified;
}
@@ -66,7 +67,7 @@ public function getLastModified(): ?\DateTimeImmutable
*
* @internal
*/
- public function setLastModified(\DateTimeImmutable $lastModified): void
+ public function setLastModified(DateTimeImmutable $lastModified): void
{
$this->lastModified = $lastModified;
}
diff --git a/src/Api/Monetization/Entity/ReportDefinitionInterface.php b/src/Api/Monetization/Entity/ReportDefinitionInterface.php
index dd3d80f1a..01d97fbee 100644
--- a/src/Api/Monetization/Entity/ReportDefinitionInterface.php
+++ b/src/Api/Monetization/Entity/ReportDefinitionInterface.php
@@ -22,6 +22,7 @@
use Apigee\Edge\Api\Monetization\Structure\Reports\Criteria\AbstractCriteria;
use Apigee\Edge\Entity\Property\DescriptionPropertyInterface;
use Apigee\Edge\Entity\Property\NamePropertyInterface;
+use DateTimeImmutable;
interface ReportDefinitionInterface extends EntityInterface, NamePropertyInterface, DescriptionPropertyInterface, OrganizationPropertyInterface
{
@@ -30,7 +31,7 @@ interface ReportDefinitionInterface extends EntityInterface, NamePropertyInterfa
public const TYPE_REVENUE = 'REVENUE';
/**
- * @param \Apigee\Edge\Api\Monetization\Structure\Reports\Criteria\AbstractCriteria $criteria
+ * @param AbstractCriteria $criteria
*/
public function setCriteria(AbstractCriteria $criteria): void;
@@ -40,12 +41,12 @@ public function setCriteria(AbstractCriteria $criteria): void;
* Also, the API endpoint does not return the "lastModified" property in the
* response body until a definition has been modified..
*
- * @return \DateTimeImmutable|null
+ * @return DateTimeImmutable|null
*/
- public function getLastModified(): ?\DateTimeImmutable;
+ public function getLastModified(): ?DateTimeImmutable;
/**
- * @return \Apigee\Edge\Api\Monetization\Structure\Reports\Criteria\AbstractCriteria
+ * @return AbstractCriteria
*/
public function getCriteria(): AbstractCriteria;
}
diff --git a/src/Api/Monetization/NameConverter/CompanyAcceptedRatePlanNameConverter.php b/src/Api/Monetization/NameConverter/CompanyAcceptedRatePlanNameConverter.php
index aa349dfff..9e08b3a9e 100644
--- a/src/Api/Monetization/NameConverter/CompanyAcceptedRatePlanNameConverter.php
+++ b/src/Api/Monetization/NameConverter/CompanyAcceptedRatePlanNameConverter.php
@@ -35,7 +35,7 @@ class CompanyAcceptedRatePlanNameConverter extends NameConverterBase implements
protected function getExternalToLocalMapping(): array
{
return [
- 'developer' => 'company',
- ];
+ 'developer' => 'company',
+ ];
}
}
diff --git a/src/Api/Monetization/NameConverter/CompanyPaymentTransactionNameConverter.php b/src/Api/Monetization/NameConverter/CompanyPaymentTransactionNameConverter.php
index dd917c820..9072b43c1 100644
--- a/src/Api/Monetization/NameConverter/CompanyPaymentTransactionNameConverter.php
+++ b/src/Api/Monetization/NameConverter/CompanyPaymentTransactionNameConverter.php
@@ -27,6 +27,6 @@ protected function getExternalToLocalMapping(): array
{
return parent::getExternalToLocalMapping() + [
'developer' => 'company',
- ];
+ ];
}
}
diff --git a/src/Api/Monetization/NameConverter/CompanyRatePlanNameConverter.php b/src/Api/Monetization/NameConverter/CompanyRatePlanNameConverter.php
index a43812be9..21a203fea 100644
--- a/src/Api/Monetization/NameConverter/CompanyRatePlanNameConverter.php
+++ b/src/Api/Monetization/NameConverter/CompanyRatePlanNameConverter.php
@@ -28,7 +28,7 @@ class CompanyRatePlanNameConverter extends RatePlanNameConverter implements Name
protected function getExternalToLocalMapping(): array
{
return parent::getExternalToLocalMapping() + [
- 'developer' => 'company',
- ];
+ 'developer' => 'company',
+ ];
}
}
diff --git a/src/Api/Monetization/NameConverter/CompanyReportDefinitionNameConverter.php b/src/Api/Monetization/NameConverter/CompanyReportDefinitionNameConverter.php
index 89f1f5454..88c9a7786 100644
--- a/src/Api/Monetization/NameConverter/CompanyReportDefinitionNameConverter.php
+++ b/src/Api/Monetization/NameConverter/CompanyReportDefinitionNameConverter.php
@@ -32,7 +32,7 @@ class CompanyReportDefinitionNameConverter extends ReportDefinitionNameConverter
protected function getExternalToLocalMapping(): array
{
return parent::getExternalToLocalMapping() + [
- 'developer' => 'company',
- ];
+ 'developer' => 'company',
+ ];
}
}
diff --git a/src/Api/Monetization/Normalizer/AcceptedRatePlanNormalizer.php b/src/Api/Monetization/Normalizer/AcceptedRatePlanNormalizer.php
index d8a0fad38..85242c3b1 100644
--- a/src/Api/Monetization/Normalizer/AcceptedRatePlanNormalizer.php
+++ b/src/Api/Monetization/Normalizer/AcceptedRatePlanNormalizer.php
@@ -33,7 +33,7 @@ class AcceptedRatePlanNormalizer extends EntityNormalizer
*/
public function normalize($object, $format = null, array $context = [])
{
- /** @var \Apigee\Edge\Api\Monetization\Entity\AcceptedRatePlanInterface $object */
+ /** @var AcceptedRatePlanInterface $object */
/** @var object $normalized */
$normalized = parent::normalize($object, $format, $context);
$this->fixTimeZoneOnNormalization($object, $normalized, $object->getRatePlan()->getPackage()->getOrganization()->getTimezone());
diff --git a/src/Api/Monetization/Normalizer/AddressNormalizer.php b/src/Api/Monetization/Normalizer/AddressNormalizer.php
index cc580dd53..952074d7b 100644
--- a/src/Api/Monetization/Normalizer/AddressNormalizer.php
+++ b/src/Api/Monetization/Normalizer/AddressNormalizer.php
@@ -31,10 +31,10 @@ class AddressNormalizer extends ObjectNormalizer
/**
* AddressNormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Normalizer/ApiPackageNormalizer.php b/src/Api/Monetization/Normalizer/ApiPackageNormalizer.php
index 5a30f3d90..1be6dfb4e 100644
--- a/src/Api/Monetization/Normalizer/ApiPackageNormalizer.php
+++ b/src/Api/Monetization/Normalizer/ApiPackageNormalizer.php
@@ -30,10 +30,10 @@ class ApiPackageNormalizer extends EntityNormalizer
/**
* ApiPackageNormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Normalizer/BalanceNormalizer.php b/src/Api/Monetization/Normalizer/BalanceNormalizer.php
index 68cade78c..caf718baf 100644
--- a/src/Api/Monetization/Normalizer/BalanceNormalizer.php
+++ b/src/Api/Monetization/Normalizer/BalanceNormalizer.php
@@ -30,10 +30,10 @@ class BalanceNormalizer extends EntityNormalizer
/**
* BalanceNormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Normalizer/CompanyAcceptedRatePlanNormalizer.php b/src/Api/Monetization/Normalizer/CompanyAcceptedRatePlanNormalizer.php
index 8f0a4a09b..c1331400d 100644
--- a/src/Api/Monetization/Normalizer/CompanyAcceptedRatePlanNormalizer.php
+++ b/src/Api/Monetization/Normalizer/CompanyAcceptedRatePlanNormalizer.php
@@ -30,10 +30,10 @@ class CompanyAcceptedRatePlanNormalizer extends AcceptedRatePlanNormalizer
/**
* CompanyAcceptedRatePlanNormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Normalizer/CompanyPaymentTransactionNormalizer.php b/src/Api/Monetization/Normalizer/CompanyPaymentTransactionNormalizer.php
index d23c97ba4..f86a78d6a 100644
--- a/src/Api/Monetization/Normalizer/CompanyPaymentTransactionNormalizer.php
+++ b/src/Api/Monetization/Normalizer/CompanyPaymentTransactionNormalizer.php
@@ -30,10 +30,10 @@ class CompanyPaymentTransactionNormalizer extends PaymentTransactionNormalizer
/**
* CompanyPaymentTransactionNormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Normalizer/CompanyRatePlanNormalizer.php b/src/Api/Monetization/Normalizer/CompanyRatePlanNormalizer.php
index a1e2cb228..cfc5eaab3 100644
--- a/src/Api/Monetization/Normalizer/CompanyRatePlanNormalizer.php
+++ b/src/Api/Monetization/Normalizer/CompanyRatePlanNormalizer.php
@@ -30,10 +30,10 @@ class CompanyRatePlanNormalizer extends LegalEntityRatePlanNormalizer
/**
* CompanyRatePlanNormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Normalizer/CompanyReportDefinitionNormalizer.php b/src/Api/Monetization/Normalizer/CompanyReportDefinitionNormalizer.php
index bef783346..3c155635d 100644
--- a/src/Api/Monetization/Normalizer/CompanyReportDefinitionNormalizer.php
+++ b/src/Api/Monetization/Normalizer/CompanyReportDefinitionNormalizer.php
@@ -30,10 +30,10 @@ class CompanyReportDefinitionNormalizer extends LegalEntityReportDefinitionNorma
/**
* CompanyReportDefinitionNormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Normalizer/DateTimeZoneNormalizer.php b/src/Api/Monetization/Normalizer/DateTimeZoneNormalizer.php
index bbd72c381..8eba9f357 100644
--- a/src/Api/Monetization/Normalizer/DateTimeZoneNormalizer.php
+++ b/src/Api/Monetization/Normalizer/DateTimeZoneNormalizer.php
@@ -38,4 +38,14 @@ public function supportsNormalization($data, $format = null)
{
return $data instanceof DateTimeZone;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ DateTimeZone::class => true,
+ ];
+ }
}
diff --git a/src/Api/Monetization/Normalizer/EntityNormalizer.php b/src/Api/Monetization/Normalizer/EntityNormalizer.php
index f3124a9ba..cbae260c7 100644
--- a/src/Api/Monetization/Normalizer/EntityNormalizer.php
+++ b/src/Api/Monetization/Normalizer/EntityNormalizer.php
@@ -20,6 +20,7 @@
use Apigee\Edge\Api\Monetization\Structure\NestedObjectReferenceInterface;
use Apigee\Edge\Normalizer\ObjectNormalizer;
+use ReflectionObject;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
@@ -38,17 +39,17 @@ class EntityNormalizer extends ObjectNormalizer
public const MINT_ENTITY_REFERENCE_PROPERTY_VALUES = 'mint_entity_reference_values';
/**
- * @var \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null
+ * @var NameConverterInterface|null
*/
protected $nameConverter;
/**
* EntityNormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
@@ -60,6 +61,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
* {@inheritdoc}
*
* @psalm-suppress InvalidReturnType stdClass is also an object.
+ * @psalm-suppress InvalidPropertyFetch.
*/
public function normalize($object, $format = null, array $context = [])
{
@@ -73,7 +75,7 @@ public function normalize($object, $format = null, array $context = [])
// only the referenced entity id.
if (isset($normalized[$normalizedProperty]->apiProduct)) {
$normalized = [
- 'apiproduct' => $normalized[$normalizedProperty]->apiProduct,
+ 'apiproduct' => $normalized[$normalizedProperty]->apiProduct,
];
} elseif (isset($normalized[$normalizedProperty]->id)) {
$normalized[$normalizedProperty] = [
@@ -123,7 +125,7 @@ public function normalize($object, $format = null, array $context = [])
protected function getNestedObjectProperties($object): array
{
$entityReferenceProperties = [];
- $ro = new \ReflectionObject($object);
+ $ro = new ReflectionObject($object);
foreach ($ro->getProperties() as $property) {
$property->setAccessible(true);
$value = $property->getValue($object);
diff --git a/src/Api/Monetization/Normalizer/LegalEntityNormalizer.php b/src/Api/Monetization/Normalizer/LegalEntityNormalizer.php
index 7255437bd..3259c4e6c 100644
--- a/src/Api/Monetization/Normalizer/LegalEntityNormalizer.php
+++ b/src/Api/Monetization/Normalizer/LegalEntityNormalizer.php
@@ -32,10 +32,10 @@ class LegalEntityNormalizer extends EntityNormalizer
/**
* LegalEntityNormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Normalizer/OrganizationProfileNormalizer.php b/src/Api/Monetization/Normalizer/OrganizationProfileNormalizer.php
index 7f486a29a..fdde13ac0 100644
--- a/src/Api/Monetization/Normalizer/OrganizationProfileNormalizer.php
+++ b/src/Api/Monetization/Normalizer/OrganizationProfileNormalizer.php
@@ -30,10 +30,10 @@ class OrganizationProfileNormalizer extends EntityNormalizer
/**
* OrganizationProfileNormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Normalizer/PaymentTransactionNormalizer.php b/src/Api/Monetization/Normalizer/PaymentTransactionNormalizer.php
index 98031d014..065f868db 100644
--- a/src/Api/Monetization/Normalizer/PaymentTransactionNormalizer.php
+++ b/src/Api/Monetization/Normalizer/PaymentTransactionNormalizer.php
@@ -31,10 +31,10 @@ abstract class PaymentTransactionNormalizer extends ObjectNormalizer
/**
* PaymentTransactionNormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Normalizer/PrepaidBalanceNormalizer.php b/src/Api/Monetization/Normalizer/PrepaidBalanceNormalizer.php
index fdd3893c0..0cbc4557b 100644
--- a/src/Api/Monetization/Normalizer/PrepaidBalanceNormalizer.php
+++ b/src/Api/Monetization/Normalizer/PrepaidBalanceNormalizer.php
@@ -30,10 +30,10 @@ class PrepaidBalanceNormalizer extends EntityNormalizer
/**
* PrepaidBalanceNormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Normalizer/RatePlanNormalizer.php b/src/Api/Monetization/Normalizer/RatePlanNormalizer.php
index e03288290..95b008f4a 100644
--- a/src/Api/Monetization/Normalizer/RatePlanNormalizer.php
+++ b/src/Api/Monetization/Normalizer/RatePlanNormalizer.php
@@ -34,10 +34,10 @@ abstract class RatePlanNormalizer extends EntityNormalizer
/**
* RatePlanNormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
@@ -58,7 +58,7 @@ public function normalize($object, $format = null, array $context = [])
// Fix the start- and end date of the rate plan if the organization's
// timezone is different from the default PHP timezone.
- /** @var \Apigee\Edge\Api\Monetization\Entity\RatePlanInterface $object */
+ /** @var RatePlanInterface $object */
if (null === $object->getPackage()) {
throw new UninitializedPropertyException($object, 'package', 'Apigee\Edge\Api\Monetization\Entity\ApiPackageInterface');
}
diff --git a/src/Api/Monetization/Normalizer/RatePlanNormalizerFactory.php b/src/Api/Monetization/Normalizer/RatePlanNormalizerFactory.php
index ff21c8bf4..0af7aff6b 100644
--- a/src/Api/Monetization/Normalizer/RatePlanNormalizerFactory.php
+++ b/src/Api/Monetization/Normalizer/RatePlanNormalizerFactory.php
@@ -90,4 +90,14 @@ public function setSerializer(SerializerInterface $serializer): void
}
}
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ '*' => false,
+ ];
+ }
}
diff --git a/src/Api/Monetization/Normalizer/ReportCriteriaNormalizer.php b/src/Api/Monetization/Normalizer/ReportCriteriaNormalizer.php
index eb28d0b57..ff81fbd40 100644
--- a/src/Api/Monetization/Normalizer/ReportCriteriaNormalizer.php
+++ b/src/Api/Monetization/Normalizer/ReportCriteriaNormalizer.php
@@ -22,6 +22,7 @@
use Apigee\Edge\Api\Monetization\Structure\Reports\Criteria\AbstractCriteria;
use Apigee\Edge\Api\Monetization\Utility\TimezoneFixerHelperTrait;
use Apigee\Edge\Normalizer\ObjectNormalizer;
+use DateTimeZone;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
@@ -40,10 +41,10 @@ class ReportCriteriaNormalizer extends ObjectNormalizer
* ReportsCriteriaNormalizer constructor.
*
* @param string $organization
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(string $organization, ?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
@@ -74,12 +75,12 @@ public function normalize($object, $format = null, array $context = [])
// According to the API documentation it is always UTC.
// https://docs.apigee.com/api-platform/monetization/create-reports#createreportdefapi
- $this->fixTimeZoneOnNormalization($object, $normalized, new \DateTimeZone('UTC'));
+ $this->fixTimeZoneOnNormalization($object, $normalized, new DateTimeZone('UTC'));
$arr_empty = [];
// Just in case, do not send empty array values either to this API.
foreach ($normalized as $property => $value) {
if (is_array($value) && empty($value)) {
- //Get all the array which is empty
+ // Get all the array which is empty
$arr_empty[] = $property;
}
}
diff --git a/src/Api/Monetization/Normalizer/ReportDefinitionNormalizer.php b/src/Api/Monetization/Normalizer/ReportDefinitionNormalizer.php
index 4c7f4e231..2cf265362 100644
--- a/src/Api/Monetization/Normalizer/ReportDefinitionNormalizer.php
+++ b/src/Api/Monetization/Normalizer/ReportDefinitionNormalizer.php
@@ -33,10 +33,10 @@ class ReportDefinitionNormalizer extends EntityNormalizer
/**
* ReportDefinitionNormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
@@ -52,7 +52,7 @@ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory
*/
public function normalize($object, $format = null, array $context = [])
{
- /** @var \Apigee\Edge\Api\Monetization\Entity\ReportDefinitionInterface $object */
+ /** @var ReportDefinitionInterface $object */
/** @var object $normalized */
$normalized = parent::normalize($object, $format, $context);
diff --git a/src/Api/Monetization/Normalizer/SupportedCurrencyNormalizer.php b/src/Api/Monetization/Normalizer/SupportedCurrencyNormalizer.php
index 20e978f1c..13e36e4f8 100644
--- a/src/Api/Monetization/Normalizer/SupportedCurrencyNormalizer.php
+++ b/src/Api/Monetization/Normalizer/SupportedCurrencyNormalizer.php
@@ -30,10 +30,10 @@ class SupportedCurrencyNormalizer extends EntityNormalizer
/**
* SupportedCurrencyNormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
diff --git a/src/Api/Monetization/Normalizer/TermsAndConditionsNormalizer.php b/src/Api/Monetization/Normalizer/TermsAndConditionsNormalizer.php
index d412d5145..80d5c8d10 100644
--- a/src/Api/Monetization/Normalizer/TermsAndConditionsNormalizer.php
+++ b/src/Api/Monetization/Normalizer/TermsAndConditionsNormalizer.php
@@ -34,10 +34,10 @@ class TermsAndConditionsNormalizer extends EntityNormalizer
/**
* TermsAndConditionsNormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
@@ -59,7 +59,7 @@ public function normalize($object, $format = null, array $context = [])
// Fix the start- and end date of the terms and conditions
// if the organization's timezone is different from the default
// PHP timezone.
- /** @var \Apigee\Edge\Api\Monetization\Entity\TermsAndConditionsInterface $object */
+ /** @var TermsAndConditionsInterface $object */
if (null === $object->getOrganization()) {
throw new UninitializedPropertyException($object, 'organization', 'Apigee\Edge\Api\Monetization\Entity\OrganizationProfileInterface');
}
diff --git a/src/Api/Monetization/Serializer/EntitySerializer.php b/src/Api/Monetization/Serializer/EntitySerializer.php
index c8e7434df..d36d65bda 100644
--- a/src/Api/Monetization/Serializer/EntitySerializer.php
+++ b/src/Api/Monetization/Serializer/EntitySerializer.php
@@ -23,6 +23,7 @@
use Apigee\Edge\Api\Monetization\Normalizer\DateTimeZoneNormalizer;
use Apigee\Edge\Api\Monetization\Normalizer\EntityNormalizer;
use Apigee\Edge\Serializer\EntitySerializer as BaseEntitySerializer;
+use DateTimeZone;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
class EntitySerializer extends BaseEntitySerializer
@@ -40,7 +41,7 @@ public function __construct($normalizers = [])
[
// Apigee Edge's default timezone is UTC, let's pass it as
// timezone instead of user's current timezone.
- new DateTimeNormalizer([DateTimeNormalizer::FORMAT_KEY => EntityInterface::DATE_FORMAT, DateTimeNormalizer::TIMEZONE_KEY => new \DateTimeZone('UTC')]),
+ new DateTimeNormalizer([DateTimeNormalizer::FORMAT_KEY => EntityInterface::DATE_FORMAT, DateTimeNormalizer::TIMEZONE_KEY => new DateTimeZone('UTC')]),
new DateTimeZoneDenormalizer(),
new DateTimeZoneNormalizer(),
new EntityNormalizer(),
diff --git a/src/Api/Monetization/Structure/LegalEntityTermsAndConditionsHistoryItem.php b/src/Api/Monetization/Structure/LegalEntityTermsAndConditionsHistoryItem.php
index 05b388b66..33df0f577 100644
--- a/src/Api/Monetization/Structure/LegalEntityTermsAndConditionsHistoryItem.php
+++ b/src/Api/Monetization/Structure/LegalEntityTermsAndConditionsHistoryItem.php
@@ -22,6 +22,7 @@
use Apigee\Edge\Api\Monetization\Entity\Property\IdPropertyInterface;
use Apigee\Edge\Api\Monetization\Entity\TermsAndConditionsInterface;
use Apigee\Edge\Structure\BaseObject;
+use DateTimeImmutable;
/**
* Represents an accepted or declined terms & conditions by a developer- or
@@ -44,7 +45,7 @@ final class LegalEntityTermsAndConditionsHistoryItem extends BaseObject implemen
* no matter what is being sent in the payload - even if the
* auditDate is a required parameter at this moment.
*
- * @var \DateTimeImmutable
+ * @var DateTimeImmutable
*/
private $auditDate;
@@ -52,25 +53,25 @@ final class LegalEntityTermsAndConditionsHistoryItem extends BaseObject implemen
private $tnc;
/**
- * @return \DateTimeImmutable
+ * @return DateTimeImmutable
*/
- public function getAuditDate(): \DateTimeImmutable
+ public function getAuditDate(): DateTimeImmutable
{
return $this->auditDate;
}
/**
- * @param \DateTimeImmutable $auditDate
+ * @param DateTimeImmutable $auditDate
*
* @internal
*/
- public function setAuditDate(\DateTimeImmutable $auditDate): void
+ public function setAuditDate(DateTimeImmutable $auditDate): void
{
$this->auditDate = $auditDate;
}
/**
- * @return \Apigee\Edge\Api\Monetization\Entity\TermsAndConditionsInterface
+ * @return TermsAndConditionsInterface
*/
public function getTnc(): TermsAndConditionsInterface
{
@@ -78,7 +79,7 @@ public function getTnc(): TermsAndConditionsInterface
}
/**
- * @param \Apigee\Edge\Api\Monetization\Entity\TermsAndConditionsInterface $tnc
+ * @param TermsAndConditionsInterface $tnc
*/
public function setTnc(TermsAndConditionsInterface $tnc): void
{
diff --git a/src/Api/Monetization/Structure/PaymentTransaction.php b/src/Api/Monetization/Structure/PaymentTransaction.php
index ee4ece72d..ff3dd5491 100644
--- a/src/Api/Monetization/Structure/PaymentTransaction.php
+++ b/src/Api/Monetization/Structure/PaymentTransaction.php
@@ -31,6 +31,7 @@
use Apigee\Edge\Entity\Property\StatusPropertyAwareTrait;
use Apigee\Edge\Entity\Property\StatusPropertyInterface;
use Apigee\Edge\Structure\BaseObject;
+use DateTimeImmutable;
/**
* @internal
@@ -58,7 +59,7 @@ class PaymentTransaction extends BaseObject implements
*
* TODO Can this be null?
*
- * @var \DateTimeImmutable|null
+ * @var DateTimeImmutable|null
*/
protected $endDate;
@@ -68,7 +69,7 @@ class PaymentTransaction extends BaseObject implements
* According to engineering, utcStartTime = startTime so we do not parse
* the first one from the API response.
*
- * @var \DateTimeImmutable
+ * @var DateTimeImmutable
*/
protected $startDate;
diff --git a/src/Api/Monetization/Structure/RatePlanDetail.php b/src/Api/Monetization/Structure/RatePlanDetail.php
index e664971b8..7c001bd89 100644
--- a/src/Api/Monetization/Structure/RatePlanDetail.php
+++ b/src/Api/Monetization/Structure/RatePlanDetail.php
@@ -207,7 +207,7 @@ public function getRatePlanRates(): array
}
/**
- * @param \Apigee\Edge\Api\Monetization\Structure\RatePlanRate ...$ratePlanRates
+ * @param RatePlanRate ...$ratePlanRates
*/
public function setRatePlanRates(RatePlanRate ...$ratePlanRates): void
{
diff --git a/src/Api/Monetization/Structure/Reports/Criteria/AbstractBillingCriteria.php b/src/Api/Monetization/Structure/Reports/Criteria/AbstractBillingCriteria.php
index c9ba2101f..15f453031 100644
--- a/src/Api/Monetization/Structure/Reports/Criteria/AbstractBillingCriteria.php
+++ b/src/Api/Monetization/Structure/Reports/Criteria/AbstractBillingCriteria.php
@@ -54,7 +54,7 @@ public function __construct(string $billingMonth, int $billingYear)
/**
* @param string $billingMonth
*
- * @return \self
+ * @return self
*/
public function setBillingMonth(string $billingMonth): self
{
@@ -66,7 +66,7 @@ public function setBillingMonth(string $billingMonth): self
/**
* @param int $billingYear
*
- * @return \self
+ * @return self
*/
public function setBillingYear(int $billingYear): self
{
diff --git a/src/Api/Monetization/Structure/Reports/Criteria/AbstractCriteria.php b/src/Api/Monetization/Structure/Reports/Criteria/AbstractCriteria.php
index 5d5ecb4b4..2c75f4cb5 100644
--- a/src/Api/Monetization/Structure/Reports/Criteria/AbstractCriteria.php
+++ b/src/Api/Monetization/Structure/Reports/Criteria/AbstractCriteria.php
@@ -23,12 +23,6 @@
/**
* Base class for all supported Monetization reports.
*
- * Boolean getters must be prefixed with "get" instead of "is" because
- * property accessor tries to call property name (without prefix) earlier
- * than "is" . ucfirst('propertyName') - which is a setter method here.
- *
- * @see https://github.com/symfony/property-access/blob/v4.2.5/PropertyAccessor.php#L433-L435
- *
* @internal
*
* @see https://docs.apigee.com/api-platform/monetization/create-reports#repdefconfigapi
@@ -125,9 +119,24 @@ public function getApps(): array
/**
* @param string ...$appIds
*
- * @return \self
+ * @return self
+ *
+ * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed.
+ * https://github.com/apigee/apigee-client-php/issues/373
*/
public function apps(string ...$appIds): self
+ {
+ trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setApps() instead.', E_USER_DEPRECATED);
+
+ return $this->setApps(...$appIds);
+ }
+
+ /**
+ * @param string ...$appIds
+ *
+ * @return self
+ */
+ public function setApps(string ...$appIds): self
{
$this->apps = $appIds;
@@ -145,9 +154,24 @@ public function getCurrencies(): array
/**
* @param string ...$currencyIds
*
- * @return \self
+ * @return self
+ *
+ * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed.
+ * https://github.com/apigee/apigee-client-php/issues/373
*/
public function currencies(string ...$currencyIds): self
+ {
+ trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setCurrencies() instead.', E_USER_DEPRECATED);
+
+ return $this->setCurrencies(...$currencyIds);
+ }
+
+ /**
+ * @param string ...$currencyIds
+ *
+ * @return self
+ */
+ public function setCurrencies(string ...$currencyIds): self
{
$this->currencies = $currencyIds;
@@ -165,9 +189,26 @@ public function getCurrencyOption(): ?string
/**
* @param string|null $currencyOption
*
- * @return \self
+ * @return self
+ *
+ * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed.
+ * https://github.com/apigee/apigee-client-php/issues/373
*/
public function currencyOption(?string $currencyOption): self
+ {
+ // This tweak allows to reset the previously configured currency option
+ // by calling this method with an empty string or null.
+ trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setCurrencyOption() instead.', E_USER_DEPRECATED);
+
+ return $this->setCurrencyOption($currencyOption);
+ }
+
+ /**
+ * @param string|null $currencyOption
+ *
+ * @return self
+ */
+ public function setCurrencyOption(?string $currencyOption): self
{
// This tweak allows to reset the previously configured currency option
// by calling this method with an empty string or null.
@@ -179,9 +220,24 @@ public function currencyOption(?string $currencyOption): self
/**
* @param string ...$developerIds
*
- * @return \self
+ * @return self
+ *
+ * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed.
+ * https://github.com/apigee/apigee-client-php/issues/373
*/
public function developers(string ...$developerIds): self
+ {
+ trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setDevelopers() instead.', E_USER_DEPRECATED);
+
+ return $this->setDevelopers(...$developerIds);
+ }
+
+ /**
+ * @param string ...$developerIds
+ *
+ * @return self
+ */
+ public function setDevelopers(string ...$developerIds): self
{
$this->developers = $developerIds;
@@ -207,9 +263,24 @@ public function getApiPackages(): array
/**
* @param string ...$apiPackageIds
*
- * @return \self
+ * @return self
+ *
+ * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed.
+ * https://github.com/apigee/apigee-client-php/issues/373
*/
public function apiPackages(string ...$apiPackageIds): self
+ {
+ trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setApiPackages() instead.', E_USER_DEPRECATED);
+
+ return $this->setApiPackages(...$apiPackageIds);
+ }
+
+ /**
+ * @param string ...$apiPackageIds
+ *
+ * @return self
+ */
+ public function setApiPackages(string ...$apiPackageIds): self
{
$this->apiPackages = $apiPackageIds;
@@ -227,9 +298,24 @@ public function getApiProducts(): array
/**
* @param string ...$apiProductIds
*
- * @return \self
+ * @return self
+ *
+ * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed.
+ * https://github.com/apigee/apigee-client-php/issues/373
*/
public function apiProducts(string ...$apiProductIds): self
+ {
+ trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setApiProducts() instead.', E_USER_DEPRECATED);
+
+ return $this->setApiProducts(...$apiProductIds);
+ }
+
+ /**
+ * @param string ...$apiProductIds
+ *
+ * @return self
+ */
+ public function setApiProducts(string ...$apiProductIds): self
{
$this->apiProducts = $apiProductIds;
@@ -247,9 +333,24 @@ public function getPricingTypes(): array
/**
* @param string ...$pricingTypes
*
- * @return \self
+ * @return self
+ *
+ * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed.
+ * https://github.com/apigee/apigee-client-php/issues/373
*/
public function pricingTypes(string ...$pricingTypes): self
+ {
+ trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setPricingTypes() instead.', E_USER_DEPRECATED);
+
+ return $this->setPricingTypes(...$pricingTypes);
+ }
+
+ /**
+ * @param string ...$pricingTypes
+ *
+ * @return self
+ */
+ public function setPricingTypes(string ...$pricingTypes): self
{
$this->pricingTypes = $pricingTypes;
@@ -267,9 +368,24 @@ public function getRatePlanLevels(): array
/**
* @param string ...$ratePlanLevels
*
- * @return \self
+ * @return self
+ *
+ * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed.
+ * https://github.com/apigee/apigee-client-php/issues/373
*/
public function ratePlanLevels(string ...$ratePlanLevels): self
+ {
+ trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setRatePlanLevels() instead.', E_USER_DEPRECATED);
+
+ return $this->setRatePlanLevels(...$ratePlanLevels);
+ }
+
+ /**
+ * @param string ...$ratePlanLevels
+ *
+ * @return self
+ */
+ public function setRatePlanLevels(string ...$ratePlanLevels): self
{
$this->ratePlanLevels = $ratePlanLevels;
@@ -311,9 +427,24 @@ public function getShowTransactionType(): bool
/**
* @param bool $show
*
- * @return \self
+ * @return self
+ *
+ * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed.
+ * https://github.com/apigee/apigee-client-php/issues/373
*/
public function showRevenueSharePercentage(bool $show): self
+ {
+ trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setShowRevenueSharePercentage() instead.', E_USER_DEPRECATED);
+
+ return $this->setShowRevenueSharePercentage($show);
+ }
+
+ /**
+ * @param bool $show
+ *
+ * @return self
+ */
+ public function setShowRevenueSharePercentage(bool $show): self
{
$this->showRevenueSharePercentage = $show;
@@ -323,9 +454,24 @@ public function showRevenueSharePercentage(bool $show): self
/**
* @param bool $show
*
- * @return \self
+ * @return self
+ *
+ * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed.
+ * https://github.com/apigee/apigee-client-php/issues/373
*/
public function showSummary(bool $show): self
+ {
+ trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setShowSummary() instead.', E_USER_DEPRECATED);
+
+ return $this->setShowSummary($show);
+ }
+
+ /**
+ * @param bool $show
+ *
+ * @return self
+ */
+ public function setShowSummary(bool $show): self
{
$this->showSummary = $show;
@@ -335,9 +481,24 @@ public function showSummary(bool $show): self
/**
* @param bool $show
*
- * @return \self
+ * @return self
+ *
+ * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed.
+ * https://github.com/apigee/apigee-client-php/issues/373
*/
public function showTransactionDetail(bool $show): self
+ {
+ trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setShowTransactionDetail() instead.', E_USER_DEPRECATED);
+
+ return $this->setShowTransactionDetail($show);
+ }
+
+ /**
+ * @param bool $show
+ *
+ * @return self
+ */
+ public function setShowTransactionDetail(bool $show): self
{
$this->showTransactionDetail = $show;
@@ -347,9 +508,24 @@ public function showTransactionDetail(bool $show): self
/**
* @param bool $show
*
- * @return \self
+ * @return self
+ *
+ * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed.
+ * https://github.com/apigee/apigee-client-php/issues/373
*/
public function showTransactionType(bool $show): self
+ {
+ trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setShowTransactionType() instead.', E_USER_DEPRECATED);
+
+ return $this->setShowTransactionType($show);
+ }
+
+ /**
+ * @param bool $show
+ *
+ * @return self
+ */
+ public function setShowTransactionType(bool $show): self
{
$this->showTransactionType = $show;
diff --git a/src/Api/Monetization/Structure/Reports/Criteria/GroupByCriteriaTrait.php b/src/Api/Monetization/Structure/Reports/Criteria/GroupByCriteriaTrait.php
index 3029f3724..26a626abd 100644
--- a/src/Api/Monetization/Structure/Reports/Criteria/GroupByCriteriaTrait.php
+++ b/src/Api/Monetization/Structure/Reports/Criteria/GroupByCriteriaTrait.php
@@ -34,9 +34,24 @@ public function getGroupBy(): array
/**
* @param string ...$groupBy
*
- * @return \self
+ * @return self
+ *
+ * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed.
+ * https://github.com/apigee/apigee-client-php/issues/373
*/
public function groupBy(string ...$groupBy): self
+ {
+ trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setGroupBy() instead.', E_USER_DEPRECATED);
+
+ return $this->setGroupBy(...$groupBy);
+ }
+
+ /**
+ * @param string ...$groupBy
+ *
+ * @return self
+ */
+ public function setGroupBy(string ...$groupBy): self
{
$this->groupBy = $groupBy;
diff --git a/src/Api/Monetization/Structure/Reports/Criteria/RevenueReportCriteria.php b/src/Api/Monetization/Structure/Reports/Criteria/RevenueReportCriteria.php
index 33174897b..2e6d94c4f 100644
--- a/src/Api/Monetization/Structure/Reports/Criteria/RevenueReportCriteria.php
+++ b/src/Api/Monetization/Structure/Reports/Criteria/RevenueReportCriteria.php
@@ -18,18 +18,20 @@
namespace Apigee\Edge\Api\Monetization\Structure\Reports\Criteria;
+use DateTimeImmutable;
+
final class RevenueReportCriteria extends AbstractCriteria
{
use GroupByCriteriaTrait;
use TransactionTypesCriteriaTrait;
/**
- * @var \DateTimeImmutable
+ * @var DateTimeImmutable
*/
private $fromDate;
/**
- * @var \DateTimeImmutable|null
+ * @var DateTimeImmutable|null
*/
private $toDate;
@@ -58,27 +60,27 @@ final class RevenueReportCriteria extends AbstractCriteria
/**
* RevenueReportCriteria constructor.
*
- * @param \DateTimeImmutable $fromDate
- * @param \DateTimeImmutable|null $toDate
+ * @param DateTimeImmutable $fromDate
+ * @param DateTimeImmutable|null $toDate
*/
- public function __construct(\DateTimeImmutable $fromDate, ?\DateTimeImmutable $toDate = null)
+ public function __construct(DateTimeImmutable $fromDate, ?DateTimeImmutable $toDate = null)
{
$this->fromDate = $fromDate;
$this->toDate = $toDate;
}
/**
- * @return \DateTimeImmutable
+ * @return DateTimeImmutable
*/
- public function getFromDate(): \DateTimeImmutable
+ public function getFromDate(): DateTimeImmutable
{
return $this->fromDate;
}
/**
- * @return \DateTimeImmutable|null
+ * @return DateTimeImmutable|null
*/
- public function getToDate(): ?\DateTimeImmutable
+ public function getToDate(): ?DateTimeImmutable
{
return $this->toDate;
}
@@ -113,7 +115,7 @@ public function getTransactionAttributes(): array
/**
* @param string ...$transactionAttributes
*
- * @return \self
+ * @return self
*/
public function transactionAttributes(string ...$transactionAttributes): self
{
diff --git a/src/Api/Monetization/Structure/Reports/Criteria/TransactionTypesCriteriaTrait.php b/src/Api/Monetization/Structure/Reports/Criteria/TransactionTypesCriteriaTrait.php
index c1a074f69..2a3238714 100644
--- a/src/Api/Monetization/Structure/Reports/Criteria/TransactionTypesCriteriaTrait.php
+++ b/src/Api/Monetization/Structure/Reports/Criteria/TransactionTypesCriteriaTrait.php
@@ -36,9 +36,24 @@ public function getTransactionTypes(): array
/**
* @param string ...$transactionTypes
*
- * @return \self
+ * @return self
+ *
+ * @deprecated in 3.0.7, will be removed in 4.0.0. No longer needed.
+ * https://github.com/apigee/apigee-client-php/issues/373
*/
public function transactionTypes(string ...$transactionTypes): self
+ {
+ trigger_error(__METHOD__ . ' is deprecated in 3.0.7, will be removed in 4.0.0: use setTransactionTypes() instead.', E_USER_DEPRECATED);
+
+ return $this->setTransactionTypes(...$transactionTypes);
+ }
+
+ /**
+ * @param string ...$transactionTypes
+ *
+ * @return self
+ */
+ public function setTransactionTypes(string ...$transactionTypes): self
{
$this->transactionTypes = $transactionTypes;
diff --git a/src/Api/Monetization/Utility/ReportTypeFromCriteriaHelperTrait.php b/src/Api/Monetization/Utility/ReportTypeFromCriteriaHelperTrait.php
index cb79c60f5..64d5ddb83 100644
--- a/src/Api/Monetization/Utility/ReportTypeFromCriteriaHelperTrait.php
+++ b/src/Api/Monetization/Utility/ReportTypeFromCriteriaHelperTrait.php
@@ -30,7 +30,7 @@ trait ReportTypeFromCriteriaHelperTrait
/**
* Gets the type of a report definition based on the criteria in it.
*
- * @param \Apigee\Edge\Api\Monetization\Structure\Reports\Criteria\AbstractCriteria $criteria
+ * @param AbstractCriteria $criteria
*
* @throws \Apigee\Edge\Exception\RuntimeException
* If report type could not be identified.
@@ -38,7 +38,7 @@ trait ReportTypeFromCriteriaHelperTrait
* @return string
* The type of a report.
*
- * @see \Apigee\Edge\Api\Monetization\Entity\ReportDefinitionInterface
+ * @see ReportDefinitionInterface
*/
final protected function getReportTypeFromCriteria(AbstractCriteria $criteria): string
{
diff --git a/src/Api/Monetization/Utility/TimezoneFixerHelperTrait.php b/src/Api/Monetization/Utility/TimezoneFixerHelperTrait.php
index 4160c46e8..5fdc04e80 100644
--- a/src/Api/Monetization/Utility/TimezoneFixerHelperTrait.php
+++ b/src/Api/Monetization/Utility/TimezoneFixerHelperTrait.php
@@ -19,6 +19,9 @@
namespace Apigee\Edge\Api\Monetization\Utility;
use Apigee\Edge\Api\Monetization\Entity\EntityInterface;
+use DateTimeImmutable;
+use DateTimeZone;
+use ReflectionObject;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
/**
@@ -37,21 +40,21 @@ trait TimezoneFixerHelperTrait
* The object that has been normalized.
* @param $normalized
* The normalized object.
- * @param \DateTimeZone $orgTimezone
+ * @param DateTimeZone $orgTimezone
* Timezone of the organization retrieved from the organization profile.
*/
- protected function fixTimeZoneOnNormalization($object, $normalized, \DateTimeZone $orgTimezone): void
+ protected function fixTimeZoneOnNormalization($object, $normalized, DateTimeZone $orgTimezone): void
{
// Change timezone of all normalized dates to organization's current
// timezone if it is different than the default PHP timezone.
if (date_default_timezone_get() !== $orgTimezone->getName()) {
- $ro = new \ReflectionObject($object);
+ $ro = new ReflectionObject($object);
$dateDenormalizer = new DateTimeNormalizer([DateTimeNormalizer::FORMAT_KEY => EntityInterface::DATE_FORMAT, DateTimeNormalizer::TIMEZONE_KEY => $orgTimezone]);
foreach ($ro->getProperties() as $property) {
$property->setAccessible(true);
$value = $property->getValue($object);
- if ($value instanceof \DateTimeImmutable) {
- $normalized->{$property->getName()} = $dateDenormalizer->normalize($value, \DateTimeImmutable::class);
+ if ($value instanceof DateTimeImmutable) {
+ $normalized->{$property->getName()} = $dateDenormalizer->normalize($value, DateTimeImmutable::class);
}
}
}
@@ -68,16 +71,16 @@ protected function fixTimeZoneOnNormalization($object, $normalized, \DateTimeZon
* The object that got denormalized.
* @param object $denormalized
* The denormalized object.
- * @param \DateTimeZone $orgTimezone
+ * @param DateTimeZone $orgTimezone
* Timezone of the organization retrieved from the organization profile.
*/
- protected function fixTimeZoneOnDenormalization($object, $denormalized, \DateTimeZone $orgTimezone): void
+ protected function fixTimeZoneOnDenormalization($object, $denormalized, DateTimeZone $orgTimezone): void
{
// Change timezone of all date objects to organization's current
// timezone if it is different than the default PHP timezone.
if (date_default_timezone_get() !== $orgTimezone->getName()) {
- $ro = new \ReflectionObject($denormalized);
+ $ro = new ReflectionObject($denormalized);
$dateDenormalizer = new DateTimeNormalizer([DateTimeNormalizer::FORMAT_KEY => EntityInterface::DATE_FORMAT, DateTimeNormalizer::TIMEZONE_KEY => $orgTimezone]);
foreach ($object as $prop_name => $prop_value) {
@@ -85,8 +88,8 @@ protected function fixTimeZoneOnDenormalization($object, $denormalized, \DateTim
$property = $ro->getProperty($prop_name);
$property->setAccessible(true);
$value = $property->getValue($denormalized);
- if ($value instanceof \DateTimeImmutable) {
- $property->setValue($denormalized, $dateDenormalizer->denormalize($prop_value, \DateTimeImmutable::class));
+ if ($value instanceof DateTimeImmutable) {
+ $property->setValue($denormalized, $dateDenormalizer->denormalize($prop_value, DateTimeImmutable::class));
}
}
}
diff --git a/src/Client.php b/src/Client.php
index 8268e5723..71e953742 100644
--- a/src/Client.php
+++ b/src/Client.php
@@ -66,7 +66,7 @@ class Client implements ClientInterface
public const CONFIG_RETRY_PLUGIN_CONFIG = 'retry_plugin_config';
- /** @var \Http\Message\UriFactory */
+ /** @var UriFactory */
private $uriFactory;
/** @var string|null */
@@ -79,7 +79,7 @@ class Client implements ClientInterface
*/
private $endpoint;
- /** @var \Http\Message\Authentication */
+ /** @var Authentication */
private $authentication;
/**
@@ -89,7 +89,7 @@ class Client implements ClientInterface
*/
private $httpClientBuilder;
- /** @var \Apigee\Edge\HttpClient\Utility\JournalInterface */
+ /** @var JournalInterface */
private $journal;
/** @var bool */
@@ -111,7 +111,7 @@ class Client implements ClientInterface
/**
* Client constructor.
*
- * @param \Http\Message\Authentication $authentication
+ * @param Authentication $authentication
* Authentication plugin.
* @param string|null $endpoint
* The Apigee Edge API endpoint, including API version. Ex.: https://api.enterprise.apigee.com/v1 (which is the
@@ -136,8 +136,8 @@ class Client implements ClientInterface
*/
public function __construct(
Authentication $authentication,
- string $endpoint = null,
- array $options = []
+ ?string $endpoint = null,
+ array $options = [],
) {
$this->authentication = $authentication;
$this->endpoint = $endpoint ?: self::EDGE_ENDPOINT;
@@ -248,7 +248,7 @@ public function sendRequest(RequestInterface $request): ResponseInterface
/**
* Sets default for supported configuration options.
*
- * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver
+ * @param OptionsResolver $resolver
* Option resolver.
*/
protected function configureOptions(OptionsResolver $resolver): void
@@ -387,7 +387,7 @@ private function resolveConfiguration(array $options = []): void
/**
* {@inheritdoc}
*
- * @throws \Http\Client\Exception
+ * @throws Exception
*/
private function send($method, $uri, array $headers = [], $body = null): ResponseInterface
{
@@ -397,7 +397,7 @@ private function send($method, $uri, array $headers = [], $body = null): Respons
/**
* Returns Apigee Edge endpoint as an URI.
*
- * @return \Psr\Http\Message\UriInterface
+ * @return UriInterface
*/
private function getBaseUri(): UriInterface
{
diff --git a/src/ClientInterface.php b/src/ClientInterface.php
index 75a4ff56a..1f29f0d22 100644
--- a/src/ClientInterface.php
+++ b/src/ClientInterface.php
@@ -19,7 +19,6 @@
namespace Apigee\Edge;
use Apigee\Edge\HttpClient\Utility\JournalInterface;
-use Http\Message\UriFactory;
use Psr\Http\Client\ClientInterface as HttpClient;
use Psr\Http\Message\ResponseInterface;
@@ -64,19 +63,23 @@ interface ClientInterface extends HttpClient
*/
public const APIGEE_ON_GCP_ENDPOINT = 'https://apigee.googleapis.com/v1';
- public const VERSION = '3.0.0';
+ public const VERSION = '3.0.9';
/**
* Allows access to the last request, response and exception.
*
- * @return \Apigee\Edge\HttpClient\Utility\JournalInterface
+ * @return JournalInterface
*/
public function getJournal(): JournalInterface;
/**
* Returns the URI factory used by the Client.
+ *
+ * @return \Http\Message\UriFactory|\Psr\Http\Message\UriFactoryInterface
+ *
+ * @todo Restore native return type as \Psr\Http\Message\UriFactoryInterface in 4.0.0.
*/
- public function getUriFactory(): UriFactory;
+ public function getUriFactory();
/**
* Returns the version of the API client.
@@ -105,10 +108,10 @@ public function getEndpoint(): string;
* @param \Psr\Http\Message\UriInterface|string $uri
* @param array $headers
*
- * @throws \Apigee\Edge\Exception\ApiException
+ * @throws Exception\ApiException
* @throws \Http\Client\Exception
*
- * @return \Psr\Http\Message\ResponseInterface
+ * @return ResponseInterface
*/
public function get($uri, array $headers = []): ResponseInterface;
@@ -118,10 +121,10 @@ public function get($uri, array $headers = []): ResponseInterface;
* @param \Psr\Http\Message\UriInterface|string $uri
* @param array $headers
*
- * @throws \Apigee\Edge\Exception\ApiException
+ * @throws Exception\ApiException
* @throws \Http\Client\Exception
*
- * @return \Psr\Http\Message\ResponseInterface
+ * @return ResponseInterface
*/
public function head($uri, array $headers = []): ResponseInterface;
@@ -132,10 +135,10 @@ public function head($uri, array $headers = []): ResponseInterface;
* @param \Psr\Http\Message\StreamInterface|resource|string|null $body
* @param array $headers
*
- * @throws \Apigee\Edge\Exception\ApiException
+ * @throws Exception\ApiException
* @throws \Http\Client\Exception
*
- * @return \Psr\Http\Message\ResponseInterface
+ * @return ResponseInterface
*/
public function post($uri, $body = null, array $headers = []): ResponseInterface;
@@ -146,10 +149,10 @@ public function post($uri, $body = null, array $headers = []): ResponseInterface
* @param \Psr\Http\Message\StreamInterface|resource|string|null $body
* @param array $headers
*
- * @throws \Apigee\Edge\Exception\ApiException
+ * @throws Exception\ApiException
* @throws \Http\Client\Exception
*
- * @return \Psr\Http\Message\ResponseInterface
+ * @return ResponseInterface
*/
public function put($uri, $body = null, array $headers = []): ResponseInterface;
@@ -160,10 +163,10 @@ public function put($uri, $body = null, array $headers = []): ResponseInterface;
* @param \Psr\Http\Message\StreamInterface|resource|string|null $body
* @param array $headers
*
- * @throws \Apigee\Edge\Exception\ApiException
+ * @throws Exception\ApiException
* @throws \Http\Client\Exception
*
- * @return \Psr\Http\Message\ResponseInterface
+ * @return ResponseInterface
*/
public function delete($uri, $body = null, array $headers = []): ResponseInterface;
}
diff --git a/src/Controller/AbstractController.php b/src/Controller/AbstractController.php
index 79ad943fc..7c093c604 100644
--- a/src/Controller/AbstractController.php
+++ b/src/Controller/AbstractController.php
@@ -38,17 +38,17 @@ abstract class AbstractController
/**
* Client interface that should be used for communication.
*
- * @var \Apigee\Edge\ClientInterface
+ * @var ClientInterface
*/
protected $client;
- /** @var \Symfony\Component\Serializer\Encoder\JsonDecode */
+ /** @var JsonDecode */
protected $jsonDecoder;
/**
* AbstractController constructor.
*
- * @param \Apigee\Edge\ClientInterface $client
+ * @param ClientInterface $client
*/
public function __construct(ClientInterface $client)
{
diff --git a/src/Controller/AbstractEntityController.php b/src/Controller/AbstractEntityController.php
index d03d5a995..df485a595 100644
--- a/src/Controller/AbstractEntityController.php
+++ b/src/Controller/AbstractEntityController.php
@@ -36,16 +36,16 @@ abstract class AbstractEntityController extends AbstractController
use EntityClassAwareTrait;
/**
- * @var \Apigee\Edge\Serializer\EntitySerializerInterface
+ * @var EntitySerializerInterface
*/
protected $entitySerializer;
/**
* AbstractEntityController constructor.
*
- * @param \Apigee\Edge\ClientInterface $client
+ * @param ClientInterface $client
* Apigee Edge API client.
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
diff --git a/src/Controller/BaseEndpointAwareControllerTrait.php b/src/Controller/BaseEndpointAwareControllerTrait.php
index d8cf6936f..bc857eccb 100644
--- a/src/Controller/BaseEndpointAwareControllerTrait.php
+++ b/src/Controller/BaseEndpointAwareControllerTrait.php
@@ -27,7 +27,7 @@ trait BaseEndpointAwareControllerTrait
*
* In case of an entity that belongs to an organisation it should return organization/[orgName]/[endpoint].
*
- * @return \Psr\Http\Message\UriInterface
+ * @return UriInterface
*/
abstract protected function getBaseEndpointUri(): UriInterface;
}
diff --git a/src/Controller/ClientAwareControllerTrait.php b/src/Controller/ClientAwareControllerTrait.php
index e593c30c4..403cd5747 100644
--- a/src/Controller/ClientAwareControllerTrait.php
+++ b/src/Controller/ClientAwareControllerTrait.php
@@ -32,7 +32,7 @@ trait ClientAwareControllerTrait
/**
* The API client.
*
- * @return \Apigee\Edge\ClientInterface
+ * @return ClientInterface
*/
abstract protected function getClient(): ClientInterface;
}
diff --git a/src/Controller/EntityController.php b/src/Controller/EntityController.php
index 7a967048e..ba1d56846 100644
--- a/src/Controller/EntityController.php
+++ b/src/Controller/EntityController.php
@@ -36,15 +36,15 @@ abstract class EntityController extends AbstractEntityController
*
* @param string $organization
* Name of the organization that the entities belongs to.
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
*
* @psalm-suppress InvalidArgument - There is no issue with the arguments.
*/
public function __construct(
string $organization,
ClientInterface $client,
- ?EntitySerializerInterface $entitySerializer = null
+ ?EntitySerializerInterface $entitySerializer = null,
) {
$this->organization = $organization;
parent::__construct($client, $entitySerializer);
diff --git a/src/Controller/EntityCreateOperationControllerInterface.php b/src/Controller/EntityCreateOperationControllerInterface.php
index 597c3ed8a..1e689f049 100644
--- a/src/Controller/EntityCreateOperationControllerInterface.php
+++ b/src/Controller/EntityCreateOperationControllerInterface.php
@@ -25,7 +25,7 @@ interface EntityCreateOperationControllerInterface
/**
* Creates an entity in Apigee Edge.
*
- * @param \Apigee\Edge\Entity\EntityInterface $entity
+ * @param EntityInterface $entity
*/
public function create(EntityInterface $entity): void;
}
diff --git a/src/Controller/EntityCreateOperationControllerTrait.php b/src/Controller/EntityCreateOperationControllerTrait.php
index d2bdc172f..02af982f2 100644
--- a/src/Controller/EntityCreateOperationControllerTrait.php
+++ b/src/Controller/EntityCreateOperationControllerTrait.php
@@ -23,7 +23,7 @@
/**
* Trait EntityCreateOperationControllerTrait.
*
- * @see \Apigee\Edge\Controller\EntityCreateOperationControllerInterface
+ * @see EntityCreateOperationControllerInterface
*/
trait EntityCreateOperationControllerTrait
{
@@ -45,7 +45,7 @@ public function create(EntityInterface $entity): void
/**
* Serializes the entity to a JSON payload for the request.
*
- * @param \Apigee\Edge\Entity\EntityInterface $entity
+ * @param EntityInterface $entity
* Entity to be serialized.
* @param array $context
* Context for the serializer.
diff --git a/src/Controller/EntityCrudOperationsControllerTrait.php b/src/Controller/EntityCrudOperationsControllerTrait.php
index 4948caf23..818087217 100644
--- a/src/Controller/EntityCrudOperationsControllerTrait.php
+++ b/src/Controller/EntityCrudOperationsControllerTrait.php
@@ -21,7 +21,7 @@
/**
* Trait EntityCrudOperationsControllerTrait.
*
- * @see \Apigee\Edge\Controller\EntityCrudOperationsControllerInterface
+ * @see EntityCrudOperationsControllerInterface
*/
trait EntityCrudOperationsControllerTrait
{
diff --git a/src/Controller/EntityDeleteOperationControllerInterface.php b/src/Controller/EntityDeleteOperationControllerInterface.php
index d237b8b4e..c8f868e6b 100644
--- a/src/Controller/EntityDeleteOperationControllerInterface.php
+++ b/src/Controller/EntityDeleteOperationControllerInterface.php
@@ -28,7 +28,7 @@ interface EntityDeleteOperationControllerInterface
* @param string $entityId
* ID of the entity to be deleted.
*
- * @return \Apigee\Edge\Entity\EntityInterface
+ * @return EntityInterface
* The deleted entity.
*/
public function delete(string $entityId): EntityInterface;
diff --git a/src/Controller/EntityDeleteOperationControllerTrait.php b/src/Controller/EntityDeleteOperationControllerTrait.php
index d70840ed0..22815161d 100644
--- a/src/Controller/EntityDeleteOperationControllerTrait.php
+++ b/src/Controller/EntityDeleteOperationControllerTrait.php
@@ -23,7 +23,7 @@
/**
* Trait EntityDeleteOperationControllerTrait.
*
- * @see \Apigee\Edge\Controller\EntityDeleteOperationControllerInterface
+ * @see EntityDeleteOperationControllerInterface
*/
trait EntityDeleteOperationControllerTrait
{
diff --git a/src/Controller/EntityEndpointAwareControllerTrait.php b/src/Controller/EntityEndpointAwareControllerTrait.php
index b7ecdd840..0466e1f77 100644
--- a/src/Controller/EntityEndpointAwareControllerTrait.php
+++ b/src/Controller/EntityEndpointAwareControllerTrait.php
@@ -27,7 +27,7 @@ trait EntityEndpointAwareControllerTrait
*
* @param string $entityId
*
- * @return \Psr\Http\Message\UriInterface
+ * @return UriInterface
*/
abstract protected function getEntityEndpointUri(string $entityId): UriInterface;
}
diff --git a/src/Controller/EntityListingControllerTrait.php b/src/Controller/EntityListingControllerTrait.php
index f095c623d..dcabaa42d 100644
--- a/src/Controller/EntityListingControllerTrait.php
+++ b/src/Controller/EntityListingControllerTrait.php
@@ -44,7 +44,7 @@ protected function responseArrayToArrayOfEntities(array $responseArray, string $
$entities = [];
foreach ($responseArray as $item) {
- //Adding id for ApigeeX.
+ // Adding id for ApigeeX.
if (!isset($item->id)) {
$item->id = $item->name ?? null;
}
diff --git a/src/Controller/EntityLoadOperationControllerInterface.php b/src/Controller/EntityLoadOperationControllerInterface.php
index 14860eb91..1ca3b84fd 100644
--- a/src/Controller/EntityLoadOperationControllerInterface.php
+++ b/src/Controller/EntityLoadOperationControllerInterface.php
@@ -28,7 +28,7 @@ interface EntityLoadOperationControllerInterface
* @param string $entityId
* Id of the entity.
*
- * @return \Apigee\Edge\Entity\EntityInterface
+ * @return EntityInterface
* Entity object.
*/
public function load(string $entityId): EntityInterface;
diff --git a/src/Controller/EntityLoadOperationControllerTrait.php b/src/Controller/EntityLoadOperationControllerTrait.php
index e4e86817c..f26036a0a 100644
--- a/src/Controller/EntityLoadOperationControllerTrait.php
+++ b/src/Controller/EntityLoadOperationControllerTrait.php
@@ -23,7 +23,7 @@
/**
* Trait EntityLoadOperationControllerTrait.
*
- * @see \Apigee\Edge\Controller\EntityLoadOperationControllerInterface
+ * @see EntityLoadOperationControllerInterface
*/
trait EntityLoadOperationControllerTrait
{
diff --git a/src/Controller/EntitySerializerAwareTrait.php b/src/Controller/EntitySerializerAwareTrait.php
index 085b79ef5..1a12e485f 100644
--- a/src/Controller/EntitySerializerAwareTrait.php
+++ b/src/Controller/EntitySerializerAwareTrait.php
@@ -30,7 +30,7 @@
trait EntitySerializerAwareTrait
{
/**
- * @return \Apigee\Edge\Serializer\EntitySerializerInterface
+ * @return EntitySerializerInterface
*/
abstract protected function getEntitySerializer(): EntitySerializerInterface;
}
diff --git a/src/Controller/EntityUpdateOperationControllerInterface.php b/src/Controller/EntityUpdateOperationControllerInterface.php
index 07c30bd5a..1d40b2399 100644
--- a/src/Controller/EntityUpdateOperationControllerInterface.php
+++ b/src/Controller/EntityUpdateOperationControllerInterface.php
@@ -25,7 +25,7 @@ interface EntityUpdateOperationControllerInterface
/**
* Updates an entity in Apigee Edge.
*
- * @param \Apigee\Edge\Entity\EntityInterface $entity
+ * @param EntityInterface $entity
* Entity object with changes.
*/
public function update(EntityInterface $entity): void;
diff --git a/src/Controller/EntityUpdateOperationControllerTrait.php b/src/Controller/EntityUpdateOperationControllerTrait.php
index 6e6ff25b1..3cb402432 100644
--- a/src/Controller/EntityUpdateOperationControllerTrait.php
+++ b/src/Controller/EntityUpdateOperationControllerTrait.php
@@ -23,7 +23,7 @@
/**
* Trait EntityUpdateOperationControllerTrait.
*
- * @see \Apigee\Edge\Controller\EntityUpdateOperationControllerInterface
+ * @see EntityUpdateOperationControllerInterface
*/
trait EntityUpdateOperationControllerTrait
{
diff --git a/src/Controller/NonPaginatedEntityIdListingControllerTrait.php b/src/Controller/NonPaginatedEntityIdListingControllerTrait.php
index 3817259b8..7ece5a5ca 100644
--- a/src/Controller/NonPaginatedEntityIdListingControllerTrait.php
+++ b/src/Controller/NonPaginatedEntityIdListingControllerTrait.php
@@ -24,7 +24,7 @@
/**
* Trait NonPaginatedEntityIdListingControllerTrait.
*
- * @see \Apigee\Edge\Controller\NonPaginatedEntityIdListingControllerInterface
+ * @see NonPaginatedEntityIdListingControllerInterface
*/
trait NonPaginatedEntityIdListingControllerTrait
{
@@ -41,7 +41,8 @@ public function getEntityIds(): array
];
$uri = $this->getBaseEndpointUri()->withQuery(http_build_query($query_params));
$response = $this->getClient()->get($uri);
- $expandCompatibility = (ClientInterface::APIGEE_ON_GCP_ENDPOINT === $this->getClient()->getEndpoint());
+ $baseDomain = str_replace('https://', '', ClientInterface::APIGEE_ON_GCP_ENDPOINT);
+ $expandCompatibility = str_ends_with($this->getClient()->getEndpoint(), $baseDomain);
return $this->responseToArray($response, $expandCompatibility);
}
diff --git a/src/Controller/NonPaginatedEntityListingControllerTrait.php b/src/Controller/NonPaginatedEntityListingControllerTrait.php
index 807302b50..1a14f446f 100644
--- a/src/Controller/NonPaginatedEntityListingControllerTrait.php
+++ b/src/Controller/NonPaginatedEntityListingControllerTrait.php
@@ -23,7 +23,7 @@
/**
* Trait NonPaginatedEntityListingControllerTrait.
*
- * @see \Apigee\Edge\Controller\NonPaginatedEntityListingControllerInterface
+ * @see NonPaginatedEntityListingControllerInterface
*/
trait NonPaginatedEntityListingControllerTrait
{
@@ -43,6 +43,9 @@ public function getEntities(): array
$uri = $this->getBaseEndpointUri()->withQuery(http_build_query($query_params));
$response = $this->getClient()->get($uri);
$responseArray = $this->responseToArray($response);
+ if ([] === $responseArray) {
+ return [];
+ }
// Ignore entity type key from response, ex.: apiProduct.
$responseArray = reset($responseArray);
diff --git a/src/Controller/OrganizationControllerAwareTrait.php b/src/Controller/OrganizationControllerAwareTrait.php
index 4af96c22a..5ef27ada4 100644
--- a/src/Controller/OrganizationControllerAwareTrait.php
+++ b/src/Controller/OrganizationControllerAwareTrait.php
@@ -32,7 +32,7 @@ trait OrganizationControllerAwareTrait
/**
* Returns a configured organization controller.
*
- * @return \Apigee\Edge\Api\Management\Controller\OrganizationControllerInterface
+ * @return OrganizationControllerInterface
*/
abstract protected function getOrganizationController(): OrganizationControllerInterface;
}
diff --git a/src/Controller/PaginatedEntityController.php b/src/Controller/PaginatedEntityController.php
index e8f293ee5..7ac1a2579 100644
--- a/src/Controller/PaginatedEntityController.php
+++ b/src/Controller/PaginatedEntityController.php
@@ -26,28 +26,28 @@
/**
* Class PaginatedEntityController.
*
- * @see \Apigee\Edge\Controller\PaginatedEntityControllerInterface
+ * @see PaginatedEntityControllerInterface
*/
abstract class PaginatedEntityController extends EntityController implements PaginatedEntityControllerInterface
{
use OrganizationControllerAwareTrait;
- /** @var \Apigee\Edge\Api\Management\Controller\OrganizationControllerInterface */
+ /** @var OrganizationControllerInterface */
protected $organizationController;
/**
* PaginatedEntityController constructor.
*
* @param string $organization
- * @param \Apigee\Edge\ClientInterface $client
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $entitySerializer
+ * @param ClientInterface $client
+ * @param EntitySerializerInterface|null $entitySerializer
* @param OrganizationControllerInterface|null $organizationController
*/
public function __construct(
string $organization,
ClientInterface $client,
?EntitySerializerInterface $entitySerializer = null,
- OrganizationControllerInterface $organizationController = null
+ ?OrganizationControllerInterface $organizationController = null,
) {
parent::__construct($organization, $client, $entitySerializer);
$this->organizationController = $organizationController ?: new OrganizationController($client);
diff --git a/src/Controller/PaginatedEntityControllerInterface.php b/src/Controller/PaginatedEntityControllerInterface.php
index 6de8cb829..64d02e2e2 100644
--- a/src/Controller/PaginatedEntityControllerInterface.php
+++ b/src/Controller/PaginatedEntityControllerInterface.php
@@ -44,7 +44,7 @@ interface PaginatedEntityControllerInterface
* @throws \Apigee\Edge\Exception\CpsNotEnabledException
* If CPS is not enabled on the organization.
*
- * @return \Apigee\Edge\Structure\PagerInterface
+ * @return PagerInterface
* The pager object.
*/
public function createPager(int $limit = 0, ?string $startKey = null): PagerInterface;
diff --git a/src/Controller/PaginatedEntityIdListingControllerInterface.php b/src/Controller/PaginatedEntityIdListingControllerInterface.php
index 611884f79..4730c1dd3 100644
--- a/src/Controller/PaginatedEntityIdListingControllerInterface.php
+++ b/src/Controller/PaginatedEntityIdListingControllerInterface.php
@@ -39,10 +39,10 @@ interface PaginatedEntityIdListingControllerInterface extends PaginatedEntityCon
* If you do not actually need _all_ entities of a type then always set
* a limit to reduce memory usage and increase speed.
*
- * @param \Apigee\Edge\Structure\PagerInterface|null $pager
+ * @param PagerInterface|null $pager
* Pager.
*
* @return array
*/
- public function getEntityIds(PagerInterface $pager = null): array;
+ public function getEntityIds(?PagerInterface $pager = null): array;
}
diff --git a/src/Controller/PaginatedEntityIdListingControllerTrait.php b/src/Controller/PaginatedEntityIdListingControllerTrait.php
index 663a758e5..29ed065ce 100644
--- a/src/Controller/PaginatedEntityIdListingControllerTrait.php
+++ b/src/Controller/PaginatedEntityIdListingControllerTrait.php
@@ -23,14 +23,14 @@
/**
* Trait PaginatedEntityIdListingControllerTrait.
*
- * @see \Apigee\Edge\Controller\PaginatedEntityIdListingControllerInterface
+ * @see PaginatedEntityIdListingControllerInterface
*/
trait PaginatedEntityIdListingControllerTrait
{
/**
* {@inheritdoc}
*/
- public function getEntityIds(PagerInterface $pager = null): array
+ public function getEntityIds(?PagerInterface $pager = null): array
{
return $this->listEntityIds($pager);
}
@@ -38,5 +38,5 @@ public function getEntityIds(PagerInterface $pager = null): array
/**
* {@inheritdoc}
*/
- abstract protected function listEntityIds(PagerInterface $pager = null, array $query_params = []): array;
+ abstract protected function listEntityIds(?PagerInterface $pager = null, array $query_params = []): array;
}
diff --git a/src/Controller/PaginatedEntityListingControllerInterface.php b/src/Controller/PaginatedEntityListingControllerInterface.php
index 82852cacc..6c3b542a3 100644
--- a/src/Controller/PaginatedEntityListingControllerInterface.php
+++ b/src/Controller/PaginatedEntityListingControllerInterface.php
@@ -39,12 +39,12 @@ interface PaginatedEntityListingControllerInterface extends PaginatedEntityContr
* If you do not actually need _all_ entities of a type then always set
* a limit to reduce memory usage and increase speed.
*
- * @param \Apigee\Edge\Structure\PagerInterface|null $pager
+ * @param PagerInterface|null $pager
* Pager.
* @param string $key_provider
* Getter method on the entity that should provide a unique array key.
*
* @return \Apigee\Edge\Entity\EntityInterface[]
*/
- public function getEntities(PagerInterface $pager = null, string $key_provider = 'id'): array;
+ public function getEntities(?PagerInterface $pager = null, string $key_provider = 'id'): array;
}
diff --git a/src/Controller/PaginatedEntityListingControllerTrait.php b/src/Controller/PaginatedEntityListingControllerTrait.php
index bba35ed23..deeebbd44 100644
--- a/src/Controller/PaginatedEntityListingControllerTrait.php
+++ b/src/Controller/PaginatedEntityListingControllerTrait.php
@@ -23,7 +23,7 @@
/**
* Trait PaginatedEntityListingControllerTrait.
*
- * @see \Apigee\Edge\Controller\PaginatedEntityListingControllerInterface
+ * @see PaginatedEntityListingControllerInterface
*/
trait PaginatedEntityListingControllerTrait
{
@@ -32,7 +32,7 @@ trait PaginatedEntityListingControllerTrait
*
* @return \Apigee\Edge\Entity\EntityInterface[]
*/
- public function getEntities(PagerInterface $pager = null, string $key_provider = 'id'): array
+ public function getEntities(?PagerInterface $pager = null, string $key_provider = 'id'): array
{
return $this->listEntities($pager, [], $key_provider);
}
@@ -40,5 +40,5 @@ public function getEntities(PagerInterface $pager = null, string $key_provider =
/**
* {@inheritdoc}
*/
- abstract protected function listEntities(PagerInterface $pager = null, array $query_params = [], string $key_provider = 'id'): array;
+ abstract protected function listEntities(?PagerInterface $pager = null, array $query_params = [], string $key_provider = 'id'): array;
}
diff --git a/src/Controller/PaginationHelperTrait.php b/src/Controller/PaginationHelperTrait.php
index 0db6a6979..4ceccf8d2 100644
--- a/src/Controller/PaginationHelperTrait.php
+++ b/src/Controller/PaginationHelperTrait.php
@@ -27,7 +27,7 @@
/**
* Utility methods for those controllers that supports paginated listing.
*
- * @see \Apigee\Edge\Controller\PaginatedEntityListingControllerInterface
+ * @see PaginatedEntityListingControllerInterface
*/
trait PaginationHelperTrait
{
@@ -43,7 +43,7 @@ public function createPager(int $limit = 0, ?string $startKey = null): PagerInte
{
// Create an anonymous class here because this class should not exist and be in use
// in those controllers that do not work with entities that belongs to an organization.
- $pager = new class() implements PagerInterface {
+ $pager = new class implements PagerInterface {
protected $startKey;
protected $limit;
@@ -94,7 +94,7 @@ public function setLimit(int $limit): int
/**
* Loads paginated list of entities from Apigee Edge.
*
- * @param \Apigee\Edge\Structure\PagerInterface|null $pager
+ * @param PagerInterface|null $pager
* Pager.
* @param array $query_params
* Additional query parameters.
@@ -104,7 +104,7 @@ public function setLimit(int $limit): int
* @return \Apigee\Edge\Entity\EntityInterface[]
* Array of entity objects.
*/
- protected function listEntities(PagerInterface $pager = null, array $query_params = [], string $key_provider = 'id'): array
+ protected function listEntities(?PagerInterface $pager = null, array $query_params = [], string $key_provider = 'id'): array
{
/** @var \Apigee\Edge\Api\Management\Entity\OrganizationInterface $organization */
$organization = $this->getOrganizationController()->load($this->getOrganisationName());
@@ -121,7 +121,7 @@ protected function listEntities(PagerInterface $pager = null, array $query_param
/**
* Loads entity ids from Apigee Edge.
*
- * @param \Apigee\Edge\Structure\PagerInterface|null $pager
+ * @param PagerInterface|null $pager
* Pager.
* @param array $query_params
* Additional query parameters.
@@ -129,7 +129,7 @@ protected function listEntities(PagerInterface $pager = null, array $query_param
* @return string[]
* Array of entity ids.
*/
- protected function listEntityIds(PagerInterface $pager = null, array $query_params = []): array
+ protected function listEntityIds(?PagerInterface $pager = null, array $query_params = []): array
{
/** @var \Apigee\Edge\Api\Management\Entity\OrganizationInterface $organization */
$organization = $this->getOrganizationController()->load($this->getOrganisationName());
@@ -156,7 +156,7 @@ abstract protected function responseArrayToArrayOfEntities(array $responseArray,
/**
* Real paginated entity listing on organization with CPS support.
*
- * @param \Apigee\Edge\Structure\PagerInterface|null $pager
+ * @param PagerInterface|null $pager
* Pager.
* @param array $query_params
* Additional query parameters.
@@ -168,11 +168,11 @@ abstract protected function responseArrayToArrayOfEntities(array $responseArray,
*
* @psalm-suppress PossiblyNullArrayOffset $tmp->id() is always not null here.
*/
- private function listEntitiesWithCps(PagerInterface $pager = null, array $query_params = [], string $key_provider = 'id'): array
+ private function listEntitiesWithCps(?PagerInterface $pager = null, array $query_params = [], string $key_provider = 'id'): array
{
$query_params = [
- 'expand' => 'true',
- ] + $query_params;
+ 'expand' => 'true',
+ ] + $query_params;
if ($pager) {
$responseArray = $this->getResultsInRange($pager, $query_params);
@@ -225,7 +225,7 @@ private function listEntitiesWithCps(PagerInterface $pager = null, array $query_
*
* For example, on on-prem installations.
*
- * @param \Apigee\Edge\Structure\PagerInterface|null $pager
+ * @param PagerInterface|null $pager
* Pager.
* @param array $query_params
* Additional query parameters.
@@ -235,11 +235,11 @@ private function listEntitiesWithCps(PagerInterface $pager = null, array $query_
* @return \Apigee\Edge\Entity\EntityInterface[]
* Array of entity objects.
*/
- private function listEntitiesWithoutCps(PagerInterface $pager = null, array $query_params = [], string $key_provider = 'id'): array
+ private function listEntitiesWithoutCps(?PagerInterface $pager = null, array $query_params = [], string $key_provider = 'id'): array
{
$query_params = [
- 'expand' => 'true',
- ] + $query_params;
+ 'expand' => 'true',
+ ] + $query_params;
$uri = $this->getBaseEndpointUri()->withQuery(http_build_query($query_params));
$response = $this->getClient()->get($uri);
@@ -257,7 +257,7 @@ private function listEntitiesWithoutCps(PagerInterface $pager = null, array $que
*
* This method for organizations with CPS enabled.
*
- * @param \Apigee\Edge\Structure\PagerInterface $pager
+ * @param PagerInterface $pager
* CPS limit object with configured startKey and limit.
* @param array $query_params
* Query parameters for the API call.
@@ -286,10 +286,10 @@ private function getResultsInRange(PagerInterface $pager, array $query_params, b
/**
* Triggers an E_USER_NOTICE if pagination is used in a non-CPS org.
*
- * @param \Apigee\Edge\Structure\PagerInterface|null $pager
+ * @param PagerInterface|null $pager
* Pager.
*/
- private function triggerCpsSimulationNotice(PagerInterface $pager = null): void
+ private function triggerCpsSimulationNotice(?PagerInterface $pager = null): void
{
// Trigger an E_USER_NOTICE error if pagination feature needs to
// be simulated on an organization without CPS to let developers
@@ -305,7 +305,7 @@ private function triggerCpsSimulationNotice(PagerInterface $pager = null): void
/**
* Real paginated entity id listing on organization with CPS support.
*
- * @param \Apigee\Edge\Structure\PagerInterface|null $pager
+ * @param PagerInterface|null $pager
* Pager.
* @param array $query_params
* Additional query parameters.
@@ -313,12 +313,13 @@ private function triggerCpsSimulationNotice(PagerInterface $pager = null): void
* @return string[]
* Array of entity ids.
*/
- private function listEntityIdsWithCps(PagerInterface $pager = null, array $query_params = []): array
+ private function listEntityIdsWithCps(?PagerInterface $pager = null, array $query_params = []): array
{
$query_params = [
- 'expand' => 'false',
- ] + $query_params;
- $expandCompatibility = (ClientInterface::APIGEE_ON_GCP_ENDPOINT === $this->getClient()->getEndpoint());
+ 'expand' => 'false',
+ ] + $query_params;
+ $baseDomain = str_replace('https://', '', ClientInterface::APIGEE_ON_GCP_ENDPOINT);
+ $expandCompatibility = str_ends_with($this->getClient()->getEndpoint(), $baseDomain);
if ($pager) {
return $this->getResultsInRange($pager, $query_params, $expandCompatibility);
} else {
@@ -350,7 +351,7 @@ private function listEntityIdsWithCps(PagerInterface $pager = null, array $query
/**
* Simulates paginated entity id listing on organization without CPS.
*
- * @param \Apigee\Edge\Structure\PagerInterface|null $pager
+ * @param PagerInterface|null $pager
* Pager.
* @param array $query_params
* Additional query parameters.
@@ -358,16 +359,16 @@ private function listEntityIdsWithCps(PagerInterface $pager = null, array $query
* @return string[]
* Array of entity ids.
*/
- private function listEntityIdsWithoutCps(PagerInterface $pager = null, array $query_params = []): array
+ private function listEntityIdsWithoutCps(?PagerInterface $pager = null, array $query_params = []): array
{
$query_params = [
- 'expand' => 'false',
- ] + $query_params;
+ 'expand' => 'false',
+ ] + $query_params;
$uri = $this->getBaseEndpointUri()->withQuery(http_build_query($query_params));
$response = $this->getClient()->get($uri);
- $expandCompatibility = (ClientInterface::APIGEE_ON_GCP_ENDPOINT === $this->getClient()->getEndpoint());
-
+ $baseDomain = str_replace('https://', '', ClientInterface::APIGEE_ON_GCP_ENDPOINT);
+ $expandCompatibility = str_ends_with($this->getClient()->getEndpoint(), $baseDomain);
$ids = $this->responseToArray($response, $expandCompatibility);
// Re-key the array from 0 if CPS had to be simulated.
@@ -377,7 +378,7 @@ private function listEntityIdsWithoutCps(PagerInterface $pager = null, array $qu
/**
* Simulates paginated response on an organization without CPS.
*
- * @param \Apigee\Edge\Structure\PagerInterface $pager
+ * @param PagerInterface $pager
* Pager.
* @param array $result
* The non-paginated result returned by the API.
@@ -388,7 +389,7 @@ private function listEntityIdsWithoutCps(PagerInterface $pager = null, array $qu
* @return array
* The paginated result.
*/
- private function simulateCpsPagination(PagerInterface $pager, array $result, array $array_search_haystack = null): array
+ private function simulateCpsPagination(PagerInterface $pager, array $result, ?array $array_search_haystack = null): array
{
$array_search_haystack = $array_search_haystack ?? $result;
// If start key is null let's set it to the first key in the
@@ -404,6 +405,7 @@ private function simulateCpsPagination(PagerInterface $pager, array $result, arr
if (false === $offset) {
throw new RuntimeException(sprintf('CPS simulation error: "%s" does not exist.', $start_key));
}
+
// The default pagination limit (aka. "count") on CPS supported
// listing endpoints varies. When this script was written it was
// 1000 on two endpoints and 100 on two app related endpoints,
diff --git a/src/Controller/StatusAwareEntityControllerTrait.php b/src/Controller/StatusAwareEntityControllerTrait.php
index ecc0c611f..28d7dc49c 100644
--- a/src/Controller/StatusAwareEntityControllerTrait.php
+++ b/src/Controller/StatusAwareEntityControllerTrait.php
@@ -21,7 +21,7 @@
/**
* Trait StatusAwareEntityControllerTrait.
*
- * @see \Apigee\Edge\Controller\StatusAwareEntityControllerInterface
+ * @see StatusAwareEntityControllerInterface
*/
trait StatusAwareEntityControllerTrait
{
diff --git a/src/Denormalizer/AttributesPropertyDenormalizer.php b/src/Denormalizer/AttributesPropertyDenormalizer.php
index 90299901f..72b204ed4 100644
--- a/src/Denormalizer/AttributesPropertyDenormalizer.php
+++ b/src/Denormalizer/AttributesPropertyDenormalizer.php
@@ -63,4 +63,14 @@ public function denormalize($data, $type, $format = null, array $context = [])
return parent::denormalize($data, $type, $format, $context);
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ AttributesProperty::class => true,
+ ];
+ }
}
diff --git a/src/Denormalizer/CredentialProductDenormalizer.php b/src/Denormalizer/CredentialProductDenormalizer.php
index 34dd04408..43cd89de2 100644
--- a/src/Denormalizer/CredentialProductDenormalizer.php
+++ b/src/Denormalizer/CredentialProductDenormalizer.php
@@ -47,4 +47,14 @@ public function denormalize($data, $type, $format = null, array $context = [])
{
return new CredentialProduct($data->apiproduct, $data->status);
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ CredentialProductInterface::class => true,
+ ];
+ }
}
diff --git a/src/Denormalizer/EdgeDateDenormalizer.php b/src/Denormalizer/EdgeDateDenormalizer.php
index a87dfc619..6366e0444 100644
--- a/src/Denormalizer/EdgeDateDenormalizer.php
+++ b/src/Denormalizer/EdgeDateDenormalizer.php
@@ -18,6 +18,10 @@
namespace Apigee\Edge\Denormalizer;
+use DateTime;
+use DateTimeImmutable;
+use DateTimeInterface;
+use DateTimeZone;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
@@ -27,12 +31,12 @@
class EdgeDateDenormalizer implements DenormalizerInterface
{
private static $supportedTypes = [
- \DateTimeInterface::class => true,
- \DateTimeImmutable::class => true,
- \DateTime::class => true,
+ DateTimeInterface::class => true,
+ DateTimeImmutable::class => true,
+ DateTime::class => true,
];
- /** @var \Symfony\Component\Serializer\Normalizer\DateTimeNormalizer */
+ /** @var DateTimeNormalizer */
private $normalizer;
/**
@@ -58,9 +62,9 @@ public function denormalize($data, $type, $format = null, array $context = [])
return null;
}
$context[$this->normalizer::FORMAT_KEY] = 'U';
- $context[$this->normalizer::TIMEZONE_KEY] = new \DateTimeZone('UTC');
+ $context[$this->normalizer::TIMEZONE_KEY] = new DateTimeZone('UTC');
- //convert data in string format for denormalizer.
+ // convert data in string format for denormalizer.
$data = (string) intval($data / 1000);
return $this->normalizer->denormalize($data, $type, $format, $context);
@@ -73,4 +77,14 @@ public function supportsDenormalization($data, $type, $format = null)
{
return isset(self::$supportedTypes[$type]);
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ '*' => false,
+ ];
+ }
}
diff --git a/src/Denormalizer/KeyValueMapDenormalizer.php b/src/Denormalizer/KeyValueMapDenormalizer.php
index af17052b6..cdc0027f4 100644
--- a/src/Denormalizer/KeyValueMapDenormalizer.php
+++ b/src/Denormalizer/KeyValueMapDenormalizer.php
@@ -46,4 +46,14 @@ public function supportsDenormalization($data, $type, $format = null)
return KeyValueMapInterface::class === $type || $type instanceof KeyValueMapInterface || in_array(KeyValueMapInterface::class, class_implements($type));
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ KeyValueMapInterface::class => true,
+ ];
+ }
}
diff --git a/src/Denormalizer/ObjectDenormalizer.php b/src/Denormalizer/ObjectDenormalizer.php
index 4aaf0200f..6f4e415f4 100644
--- a/src/Denormalizer/ObjectDenormalizer.php
+++ b/src/Denormalizer/ObjectDenormalizer.php
@@ -39,10 +39,10 @@
*/
class ObjectDenormalizer implements DenormalizerInterface, SerializerAwareInterface
{
- /** @var \Symfony\Component\Serializer\Normalizer\ObjectNormalizer */
+ /** @var BaseObjectNormalizer */
private $objectNormalizer;
- /** @var \Symfony\Component\Serializer\SerializerInterface */
+ /** @var SerializerInterface */
private $serializer;
/**
@@ -55,12 +55,12 @@ class ObjectDenormalizer implements DenormalizerInterface, SerializerAwareInterf
/**
* EntityDenormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
- public function __construct(ClassMetadataFactoryInterface $classMetadataFactory = null, NameConverterInterface $nameConverter = null, PropertyAccessorInterface $propertyAccessor = null, PropertyTypeExtractorInterface $propertyTypeExtractor = null)
+ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
if (null === $propertyTypeExtractor) {
$reflectionExtractor = new ReflectionExtractor();
@@ -133,4 +133,14 @@ public function setSerializer(SerializerInterface $serializer): void
$this->serializer = $serializer;
$this->objectNormalizer->setSerializer($this->serializer);
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ '*' => false,
+ ];
+ }
}
diff --git a/src/Denormalizer/PropertiesPropertyDenormalizer.php b/src/Denormalizer/PropertiesPropertyDenormalizer.php
index 9910d7128..32d02590f 100644
--- a/src/Denormalizer/PropertiesPropertyDenormalizer.php
+++ b/src/Denormalizer/PropertiesPropertyDenormalizer.php
@@ -53,4 +53,14 @@ public function denormalize($data, $type, $format = null, array $context = [])
return parent::denormalize($data, $type, $format, $context);
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ PropertiesProperty::class => true,
+ ];
+ }
}
diff --git a/src/Entity/CommonEntityPropertiesAwareTrait.php b/src/Entity/CommonEntityPropertiesAwareTrait.php
index 091e8e262..fe0ad3583 100644
--- a/src/Entity/CommonEntityPropertiesAwareTrait.php
+++ b/src/Entity/CommonEntityPropertiesAwareTrait.php
@@ -18,6 +18,8 @@
namespace Apigee\Edge\Entity;
+use DateTimeImmutable;
+
/**
* Trait CommonEntityPropertiesAwareTrait.
*
@@ -30,7 +32,7 @@
trait CommonEntityPropertiesAwareTrait
{
/**
- * @var \DateTimeImmutable|null
+ * @var DateTimeImmutable|null
*/
protected $createdAt;
@@ -45,7 +47,7 @@ trait CommonEntityPropertiesAwareTrait
protected $createdBy;
/**
- * @var \DateTimeImmutable|null
+ * @var DateTimeImmutable|null
*/
protected $lastModifiedAt;
@@ -62,7 +64,7 @@ trait CommonEntityPropertiesAwareTrait
/**
* {@inheritdoc}
*/
- public function getCreatedAt(): ?\DateTimeImmutable
+ public function getCreatedAt(): ?DateTimeImmutable
{
return $this->createdAt;
}
@@ -70,11 +72,11 @@ public function getCreatedAt(): ?\DateTimeImmutable
/**
* Set creation date of an entity from an Edge API response.
*
- * @param \DateTimeImmutable $date
+ * @param DateTimeImmutable $date
*
* @internal
*/
- public function setCreatedAt(\DateTimeImmutable $date): void
+ public function setCreatedAt(DateTimeImmutable $date): void
{
$this->createdAt = $date;
}
@@ -106,7 +108,7 @@ public function setCreatedBy(string $email): void
/**
* {@inheritdoc}
*/
- public function getLastModifiedAt(): ?\DateTimeImmutable
+ public function getLastModifiedAt(): ?DateTimeImmutable
{
return $this->lastModifiedAt;
}
@@ -114,11 +116,11 @@ public function getLastModifiedAt(): ?\DateTimeImmutable
/**
* Set the last modification date of an entity from an Edge API response.
*
- * @param \DateTimeImmutable $date
+ * @param DateTimeImmutable $date
*
* @internal
*/
- public function setLastModifiedAt(\DateTimeImmutable $date): void
+ public function setLastModifiedAt(DateTimeImmutable $date): void
{
$this->lastModifiedAt = $date;
}
diff --git a/src/Entity/CommonEntityPropertiesInterface.php b/src/Entity/CommonEntityPropertiesInterface.php
index 70c69001d..bf7fcbee9 100644
--- a/src/Entity/CommonEntityPropertiesInterface.php
+++ b/src/Entity/CommonEntityPropertiesInterface.php
@@ -18,6 +18,8 @@
namespace Apigee\Edge\Entity;
+use DateTimeImmutable;
+
/**
* Interface CommonEntityPropertiesInterface.
*
@@ -30,9 +32,9 @@ interface CommonEntityPropertiesInterface
/**
* Returns creation date of entity.
*
- * @return \DateTimeImmutable|null
+ * @return DateTimeImmutable|null
*/
- public function getCreatedAt(): ?\DateTimeImmutable;
+ public function getCreatedAt(): ?DateTimeImmutable;
/**
* Returns the email address of the user/developer who created the entity.
@@ -47,9 +49,9 @@ public function getCreatedBy(): ?string;
/**
* Returns last modification date of entity.
*
- * @return \DateTimeImmutable|null
+ * @return DateTimeImmutable|null
*/
- public function getLastModifiedAt(): ?\DateTimeImmutable;
+ public function getLastModifiedAt(): ?DateTimeImmutable;
/**
* Returns the email address of the user/developer who modified the entity the last time.
diff --git a/src/Entity/Property/AppsPropertyAwareTrait.php b/src/Entity/Property/AppsPropertyAwareTrait.php
index 949916361..dd8a6d01c 100644
--- a/src/Entity/Property/AppsPropertyAwareTrait.php
+++ b/src/Entity/Property/AppsPropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait AppsPropertyAwareTrait.
*
- * @see \Apigee\Edge\Entity\Property\AppsPropertyInterface
+ * @see AppsPropertyInterface
*/
trait AppsPropertyAwareTrait
{
diff --git a/src/Entity/Property/AttributesPropertyAwareTrait.php b/src/Entity/Property/AttributesPropertyAwareTrait.php
index e7f8214ed..e443f8fec 100644
--- a/src/Entity/Property/AttributesPropertyAwareTrait.php
+++ b/src/Entity/Property/AttributesPropertyAwareTrait.php
@@ -23,17 +23,17 @@
/**
* Trait AttributesPropertyAwareTrait.
*
- * @see \Apigee\Edge\Entity\Property\AttributesPropertyInterface
+ * @see AttributesPropertyInterface
*/
trait AttributesPropertyAwareTrait
{
- /** @var \Apigee\Edge\Structure\AttributesProperty */
+ /** @var AttributesProperty */
protected $attributes;
/**
* {@inheritdoc}
*/
- public function getAttributes(): AttributesProperty
+ public function getAttributes(): ?AttributesProperty
{
return $this->attributes;
}
diff --git a/src/Entity/Property/AttributesPropertyInterface.php b/src/Entity/Property/AttributesPropertyInterface.php
index 67f5d1215..438db722d 100644
--- a/src/Entity/Property/AttributesPropertyInterface.php
+++ b/src/Entity/Property/AttributesPropertyInterface.php
@@ -28,12 +28,12 @@
interface AttributesPropertyInterface
{
/**
- * @return \Apigee\Edge\Structure\AttributesProperty
+ * @return AttributesProperty
*/
- public function getAttributes(): AttributesProperty;
+ public function getAttributes(): ?AttributesProperty;
/**
- * @param \Apigee\Edge\Structure\AttributesProperty $attributes
+ * @param AttributesProperty $attributes
*/
public function setAttributes(AttributesProperty $attributes): void;
diff --git a/src/Entity/Property/DescriptionPropertyAwareTrait.php b/src/Entity/Property/DescriptionPropertyAwareTrait.php
index 32d799236..1a0d42347 100644
--- a/src/Entity/Property/DescriptionPropertyAwareTrait.php
+++ b/src/Entity/Property/DescriptionPropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait DescriptionPropertyAwareTrait.
*
- * @see \Apigee\Edge\Entity\Property\DescriptionPropertyInterface
+ * @see DescriptionPropertyInterface
*/
trait DescriptionPropertyAwareTrait
{
diff --git a/src/Entity/Property/DeveloperIdPropertyAwareTrait.php b/src/Entity/Property/DeveloperIdPropertyAwareTrait.php
index a76bb4a07..9530612ad 100644
--- a/src/Entity/Property/DeveloperIdPropertyAwareTrait.php
+++ b/src/Entity/Property/DeveloperIdPropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait DeveloperIdPropertyAwareTrait.
*
- * @see \Apigee\Edge\Entity\Property\DeveloperIdPropertyInterface
+ * @see DeveloperIdPropertyInterface
*/
trait DeveloperIdPropertyAwareTrait
{
diff --git a/src/Entity/Property/OrganizationNamePropertyAwareTrait.php b/src/Entity/Property/OrganizationNamePropertyAwareTrait.php
index cd88a9c60..045d6ae9e 100755
--- a/src/Entity/Property/OrganizationNamePropertyAwareTrait.php
+++ b/src/Entity/Property/OrganizationNamePropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait OrganizationNamePropertyAwareTrait.
*
- * @see \Apigee\Edge\Entity\Property\OrganizationNamePropertyInterface
+ * @see OrganizationNamePropertyInterface
*/
trait OrganizationNamePropertyAwareTrait
{
diff --git a/src/Entity/Property/PropertiesPropertyAwareTrait.php b/src/Entity/Property/PropertiesPropertyAwareTrait.php
index 402f7668d..a948f135a 100644
--- a/src/Entity/Property/PropertiesPropertyAwareTrait.php
+++ b/src/Entity/Property/PropertiesPropertyAwareTrait.php
@@ -25,7 +25,7 @@
*/
trait PropertiesPropertyAwareTrait
{
- /** @var \Apigee\Edge\Structure\PropertiesProperty */
+ /** @var PropertiesProperty */
protected $properties;
/**
diff --git a/src/Entity/Property/PropertiesPropertyInterface.php b/src/Entity/Property/PropertiesPropertyInterface.php
index 2c1bd5b4a..9cad26bf3 100644
--- a/src/Entity/Property/PropertiesPropertyInterface.php
+++ b/src/Entity/Property/PropertiesPropertyInterface.php
@@ -26,7 +26,7 @@
interface PropertiesPropertyInterface
{
/**
- * @return \Apigee\Edge\Structure\PropertiesProperty
+ * @return PropertiesProperty
*/
public function getProperties(): PropertiesProperty;
diff --git a/src/Entity/Property/RuntimeTypeAwareTrait.php b/src/Entity/Property/RuntimeTypeAwareTrait.php
index a4c00a629..4d2e4f8a4 100644
--- a/src/Entity/Property/RuntimeTypeAwareTrait.php
+++ b/src/Entity/Property/RuntimeTypeAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait RuntimeTypeAwareTrait.
*
- * @see \Apigee\Edge\Entity\Property\RuntimeTypeInterface
+ * @see RuntimeTypeInterface
*/
trait RuntimeTypeAwareTrait
{
diff --git a/src/Entity/Property/ScopesPropertyAwareTrait.php b/src/Entity/Property/ScopesPropertyAwareTrait.php
index 3f8b1a28a..3937547fc 100644
--- a/src/Entity/Property/ScopesPropertyAwareTrait.php
+++ b/src/Entity/Property/ScopesPropertyAwareTrait.php
@@ -21,7 +21,7 @@
/**
* Trait ScopesPropertyAwareTrait.
*
- * @see \Apigee\Edge\Entity\Property\ScopesPropertyInterface
+ * @see ScopesPropertyInterface
*/
trait ScopesPropertyAwareTrait
{
diff --git a/src/Entity/Property/StatusPropertyAwareTrait.php b/src/Entity/Property/StatusPropertyAwareTrait.php
index b316d1c5f..0b59267c5 100755
--- a/src/Entity/Property/StatusPropertyAwareTrait.php
+++ b/src/Entity/Property/StatusPropertyAwareTrait.php
@@ -45,7 +45,7 @@ public function getStatus(): ?string
* @param string $status
* Status of the entity.
*
- * @see \Apigee\Edge\Entity\Property\StatusPropertyInterface
+ * @see StatusPropertyInterface
*
* @internal
*/
diff --git a/src/Exception/ApiRequestException.php b/src/Exception/ApiRequestException.php
index 8bea9e563..0e8c14aa8 100644
--- a/src/Exception/ApiRequestException.php
+++ b/src/Exception/ApiRequestException.php
@@ -21,6 +21,7 @@
use Http\Message\Formatter;
use Http\Message\Formatter\FullHttpMessageFormatter;
use Psr\Http\Message\RequestInterface;
+use Throwable;
/**
* Exception for when a request failed, providing access to the failed request.
@@ -30,27 +31,27 @@
*/
class ApiRequestException extends ApiException
{
- /** @var \Psr\Http\Message\RequestInterface */
+ /** @var RequestInterface */
protected $request;
- /** @var \Http\Message\Formatter */
+ /** @var Formatter */
protected $formatter;
/**
* ApiException constructor.
*
- * @param \Psr\Http\Message\RequestInterface $request
+ * @param RequestInterface $request
* @param string $message
* @param int $code
- * @param \Throwable|null $previous
- * @param \Http\Message\Formatter|null $formatter
+ * @param Throwable|null $previous
+ * @param Formatter|null $formatter
*/
public function __construct(
RequestInterface $request,
string $message = '',
int $code = 0,
- \Throwable $previous = null,
- Formatter $formatter = null
+ ?Throwable $previous = null,
+ ?Formatter $formatter = null,
) {
$this->request = $request;
$this->formatter = $formatter ?: new FullHttpMessageFormatter();
@@ -72,7 +73,7 @@ public function __toString(): string
}
/**
- * @return \Psr\Http\Message\RequestInterface
+ * @return RequestInterface
*/
public function getRequest(): RequestInterface
{
@@ -80,7 +81,7 @@ public function getRequest(): RequestInterface
}
/**
- * @return \Http\Message\Formatter
+ * @return Formatter
*/
public function getFormatter(): Formatter
{
diff --git a/src/Exception/ApiResponseException.php b/src/Exception/ApiResponseException.php
index ee4a9e26a..2cd800487 100644
--- a/src/Exception/ApiResponseException.php
+++ b/src/Exception/ApiResponseException.php
@@ -21,13 +21,14 @@
use Http\Message\Formatter;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
+use Throwable;
/**
* Thrown when a response was received but the request itself failed.
*/
class ApiResponseException extends ApiRequestException
{
- /** @var \Psr\Http\Message\ResponseInterface */
+ /** @var ResponseInterface */
private $response;
/** @var string|null */
@@ -36,20 +37,20 @@ class ApiResponseException extends ApiRequestException
/**
* ApiResponseException constructor.
*
- * @param \Psr\Http\Message\ResponseInterface $response
- * @param \Psr\Http\Message\RequestInterface $request
+ * @param ResponseInterface $response
+ * @param RequestInterface $request
* @param string $message
* @param int $code
- * @param \Throwable|null $previous
- * @param \Http\Message\Formatter|null $formatter
+ * @param Throwable|null $previous
+ * @param Formatter|null $formatter
*/
public function __construct(
ResponseInterface $response,
RequestInterface $request,
string $message = '',
int $code = 0,
- \Throwable $previous = null,
- Formatter $formatter = null
+ ?Throwable $previous = null,
+ ?Formatter $formatter = null,
) {
$this->response = $response;
$message = $message ?: $response->getReasonPhrase();
@@ -76,7 +77,7 @@ public function __toString(): string
}
/**
- * @return \Psr\Http\Message\ResponseInterface
+ * @return ResponseInterface
*/
public function getResponse(): ResponseInterface
{
@@ -94,7 +95,7 @@ public function getEdgeErrorCode(): ?string
/**
* Tries to extract Apigee Edge error code and message from a response.
*
- * @param \Psr\Http\Message\ResponseInterface $response
+ * @param ResponseInterface $response
* API response.
*
* @return array
diff --git a/src/Exception/CpsNotEnabledException.php b/src/Exception/CpsNotEnabledException.php
index 078355ac6..adb337f1b 100644
--- a/src/Exception/CpsNotEnabledException.php
+++ b/src/Exception/CpsNotEnabledException.php
@@ -18,6 +18,7 @@
namespace Apigee\Edge\Exception;
+use RuntimeException;
use Throwable;
/**
@@ -29,7 +30,7 @@
* @see https://docs.apigee.com/api-services/content/api-reference-getting-started#cps
* @deprecated Since 2.0.1, https://github.com/apigee/apigee-client-php/pull/43/files
*/
-class CpsNotEnabledException extends \RuntimeException
+class CpsNotEnabledException extends RuntimeException
{
/**
* @var string
@@ -43,7 +44,7 @@ class CpsNotEnabledException extends \RuntimeException
* @param int $code
* @param Throwable|null $previous
*/
- public function __construct(string $organization, $code = 0, Throwable $previous = null)
+ public function __construct(string $organization, $code = 0, ?Throwable $previous = null)
{
$this->organization = $organization;
}
diff --git a/src/Exception/InvalidJsonException.php b/src/Exception/InvalidJsonException.php
index 57509a272..97e574cc7 100644
--- a/src/Exception/InvalidJsonException.php
+++ b/src/Exception/InvalidJsonException.php
@@ -21,6 +21,7 @@
use Http\Message\Formatter;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
+use Throwable;
/**
* Class InvalidJsonException.
@@ -37,14 +38,14 @@ class InvalidJsonException extends ApiResponseException
* @param ResponseInterface $response
* @param RequestInterface $request
* @param Formatter|null $formatter
- * @param \Throwable|null $previous
+ * @param Throwable|null $previous
*/
public function __construct(
string $jsonErrorMessage,
ResponseInterface $response,
RequestInterface $request,
- Formatter $formatter = null,
- \Throwable $previous = null
+ ?Formatter $formatter = null,
+ ?Throwable $previous = null,
) {
$this->jsonErrorMessage = $jsonErrorMessage;
parent::__construct($response, $request, $jsonErrorMessage, 0, $previous, $formatter);
diff --git a/src/Exception/UninitializedPropertyException.php b/src/Exception/UninitializedPropertyException.php
index 787fd4ec6..70b6db6fb 100644
--- a/src/Exception/UninitializedPropertyException.php
+++ b/src/Exception/UninitializedPropertyException.php
@@ -18,6 +18,8 @@
namespace Apigee\Edge\Exception;
+use LogicException;
+
/**
* Thrown when a property has not been initialized.
*
@@ -26,7 +28,7 @@
*
* @see \Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize()
*/
-class UninitializedPropertyException extends \LogicException implements ApiClientException
+class UninitializedPropertyException extends LogicException implements ApiClientException
{
/**
* UninitializedPropertyException constructor.
diff --git a/src/HttpClient/Plugin/AddPathPlugin.php b/src/HttpClient/Plugin/AddPathPlugin.php
index 6bfac13cd..1713e653a 100644
--- a/src/HttpClient/Plugin/AddPathPlugin.php
+++ b/src/HttpClient/Plugin/AddPathPlugin.php
@@ -41,14 +41,14 @@ final class AddPathPlugin implements Plugin
/**
* The URI.
*
- * @var \Psr\Http\Message\UriInterface
+ * @var UriInterface
*/
private $uri;
/**
* AddPathPlugin constructor.
*
- * @param \Psr\Http\Message\UriInterface $uri
+ * @param UriInterface $uri
* The URI.
*/
public function __construct(UriInterface $uri)
diff --git a/src/HttpClient/Plugin/Authentication/AbstractOauth.php b/src/HttpClient/Plugin/Authentication/AbstractOauth.php
index 5175e6772..aa2febb6b 100644
--- a/src/HttpClient/Plugin/Authentication/AbstractOauth.php
+++ b/src/HttpClient/Plugin/Authentication/AbstractOauth.php
@@ -32,7 +32,7 @@ abstract class AbstractOauth implements Authentication
use DeprecatedPropertyTrait;
/**
- * @var \Apigee\Edge\HttpClient\Plugin\Authentication\OauthTokenStorageInterface
+ * @var OauthTokenStorageInterface
*/
protected $tokenStorage;
@@ -49,7 +49,7 @@ abstract class AbstractOauth implements Authentication
/**
* Constructor.
*
- * @param \Apigee\Edge\HttpClient\Plugin\Authentication\OauthTokenStorageInterface $tokenStorage
+ * @param OauthTokenStorageInterface $tokenStorage
* Storage where access token gets saved.
* @param string $authServer
* Authentication server.
@@ -83,7 +83,7 @@ public function authenticate(RequestInterface $request)
/**
* Returns the token storage.
*
- * @return \Apigee\Edge\HttpClient\Plugin\Authentication\OauthTokenStorageInterface
+ * @return OauthTokenStorageInterface
*/
public function getTokenStorage(): OauthTokenStorageInterface
{
@@ -103,7 +103,7 @@ protected function getAuthServer(): string
/**
* Returns a pre-configured client for authorization API calls.
*
- * @return \Apigee\Edge\ClientInterface
+ * @return ClientInterface
*/
abstract protected function authClient(): ClientInterface;
diff --git a/src/HttpClient/Plugin/Authentication/ApigeeOnGcpOauth2.php b/src/HttpClient/Plugin/Authentication/ApigeeOnGcpOauth2.php
index 15b57fae8..8dc50bb95 100644
--- a/src/HttpClient/Plugin/Authentication/ApigeeOnGcpOauth2.php
+++ b/src/HttpClient/Plugin/Authentication/ApigeeOnGcpOauth2.php
@@ -76,7 +76,7 @@ class ApigeeOnGcpOauth2 extends AbstractOauth
* The service account email.
* @param string $privateKey
* The service account private key.
- * @param \Apigee\Edge\HttpClient\Plugin\Authentication\OauthTokenStorageInterface $tokenStorage
+ * @param OauthTokenStorageInterface $tokenStorage
* Storage where access token gets saved.
* @param string|null $authServer
* Authentication server.
diff --git a/src/HttpClient/Plugin/Authentication/GceServiceAccount.php b/src/HttpClient/Plugin/Authentication/GceServiceAccount.php
index f23c90441..c23b8735a 100644
--- a/src/HttpClient/Plugin/Authentication/GceServiceAccount.php
+++ b/src/HttpClient/Plugin/Authentication/GceServiceAccount.php
@@ -21,8 +21,9 @@
use Apigee\Edge\Client;
use Apigee\Edge\ClientInterface;
use Apigee\Edge\Exception\ApigeeOnGcpOauth2AuthenticationException;
-use Http\Client\Exception;
use Http\Message\Authentication\Header;
+use Psr\Http\Client\ClientExceptionInterface;
+use Psr\Http\Client\NetworkExceptionInterface;
/**
* GCE Service Account authentication plugin for authenticating to Google
@@ -37,7 +38,7 @@ class GceServiceAccount extends AbstractOauth
/**
* GceServiceAccountAuthentication constructor.
*
- * @param \Apigee\Edge\HttpClient\Plugin\Authentication\OauthTokenStorageInterface $tokenStorage
+ * @param OauthTokenStorageInterface $tokenStorage
* Storage where access token gets saved.
*/
public function __construct(OauthTokenStorageInterface $tokenStorage)
@@ -61,7 +62,7 @@ public function isAvailable(): bool
$this->authClient()->get('');
return true;
- } catch (Exception $e) {
+ } catch (NetworkExceptionInterface $e) {
return false;
}
}
@@ -85,7 +86,7 @@ protected function getAccessToken(): void
$response = $this->authClient()->get('');
$decoded_token = json_decode((string) $response->getBody(), true);
$this->tokenStorage->saveToken($decoded_token);
- } catch (Exception $e) {
+ } catch (ClientExceptionInterface $e) {
throw new ApigeeOnGcpOauth2AuthenticationException($e->getMessage(), $e->getCode(), $e);
}
}
@@ -93,7 +94,7 @@ protected function getAccessToken(): void
/**
* Return the Auth Header required by GCE Access token endpoint.
*
- * @return \Http\Message\Authentication\Header
+ * @return Header
*/
protected function getAuthHeader(): Header
{
diff --git a/src/HttpClient/Plugin/Authentication/HybridOauth2.php b/src/HttpClient/Plugin/Authentication/HybridOauth2.php
index 7e0cc34c0..a85e46a54 100644
--- a/src/HttpClient/Plugin/Authentication/HybridOauth2.php
+++ b/src/HttpClient/Plugin/Authentication/HybridOauth2.php
@@ -78,7 +78,7 @@ class HybridOauth2 extends AbstractOauth
* The service account email.
* @param string $privateKey
* The service account private key.
- * @param \Apigee\Edge\HttpClient\Plugin\Authentication\OauthTokenStorageInterface $tokenStorage
+ * @param OauthTokenStorageInterface $tokenStorage
* Storage where access token gets saved.
* @param string|null $authServer
* Authentication server.
diff --git a/src/HttpClient/Plugin/Authentication/Oauth.php b/src/HttpClient/Plugin/Authentication/Oauth.php
index 3a41a8c79..b97d2182f 100644
--- a/src/HttpClient/Plugin/Authentication/Oauth.php
+++ b/src/HttpClient/Plugin/Authentication/Oauth.php
@@ -75,7 +75,7 @@ class Oauth extends AbstractOauth
* Apigee Edge username (email).
* @param string $password
* Apigee Edge password.
- * @param \Apigee\Edge\HttpClient\Plugin\Authentication\OauthTokenStorageInterface $tokenStorage
+ * @param OauthTokenStorageInterface $tokenStorage
* Storage where access token gets saved.
* @param string|null $mfaToken
* One-time multi-factor authentication code.
diff --git a/src/HttpClient/Plugin/Authentication/OauthTokenStorageInterface.php b/src/HttpClient/Plugin/Authentication/OauthTokenStorageInterface.php
index 8044e627c..af2126db9 100644
--- a/src/HttpClient/Plugin/Authentication/OauthTokenStorageInterface.php
+++ b/src/HttpClient/Plugin/Authentication/OauthTokenStorageInterface.php
@@ -21,7 +21,7 @@
/**
* Describes a storage that is used by the Oauth authentication plugin for storing and returning access token data.
*
- * @see \Apigee\Edge\HttpClient\Plugin\Authentication\Oauth
+ * @see Oauth
*/
interface OauthTokenStorageInterface
{
diff --git a/src/HttpClient/Plugin/ResponseHandlerPlugin.php b/src/HttpClient/Plugin/ResponseHandlerPlugin.php
index 7209c9025..88747bedf 100644
--- a/src/HttpClient/Plugin/ResponseHandlerPlugin.php
+++ b/src/HttpClient/Plugin/ResponseHandlerPlugin.php
@@ -40,15 +40,15 @@
*/
final class ResponseHandlerPlugin implements Plugin
{
- /** @var \Http\Message\Formatter */
+ /** @var Formatter */
private $formatter;
/**
* ResponseHandlerPlugin constructor.
*
- * @param \Http\Message\Formatter|null $formatter
+ * @param Formatter|null $formatter
*/
- public function __construct(Formatter $formatter = null)
+ public function __construct(?Formatter $formatter = null)
{
$this->formatter = $formatter ?: new FullHttpMessageFormatter();
}
@@ -80,13 +80,13 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
/**
* Throws one our of our exceptions if the API response code is higher than 399.
*
- * @param \Psr\Http\Message\ResponseInterface $response
- * @param \Psr\Http\Message\RequestInterface $request
+ * @param ResponseInterface $response
+ * @param RequestInterface $request
*
- * @throws \Apigee\Edge\Exception\ClientErrorException
- * @throws \Apigee\Edge\Exception\ServerErrorException
+ * @throws ClientErrorException
+ * @throws ServerErrorException
*
- * @return \Psr\Http\Message\ResponseInterface
+ * @return ResponseInterface
*/
private function decodeResponse(ResponseInterface $response, RequestInterface $request)
{
diff --git a/src/HttpClient/Plugin/RetryOauthAuthenticationPlugin.php b/src/HttpClient/Plugin/RetryOauthAuthenticationPlugin.php
index f1a2f9095..fdc272218 100644
--- a/src/HttpClient/Plugin/RetryOauthAuthenticationPlugin.php
+++ b/src/HttpClient/Plugin/RetryOauthAuthenticationPlugin.php
@@ -20,8 +20,8 @@
use Apigee\Edge\Exception\OauthAccessTokenAuthenticationException;
use Apigee\Edge\HttpClient\Plugin\Authentication\AbstractOauth;
+use Exception;
use Http\Client\Common\Plugin;
-use Http\Client\Exception;
use Http\Promise\Promise;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
@@ -32,14 +32,14 @@
class RetryOauthAuthenticationPlugin implements Plugin
{
/**
- * @var \Apigee\Edge\HttpClient\Plugin\Authentication\AbstractOauth
+ * @var AbstractOauth
*/
private $auth;
/**
* RetryOauthAuthenticationPlugin constructor.
*
- * @param \Apigee\Edge\HttpClient\Plugin\Authentication\AbstractOauth $auth
+ * @param AbstractOauth $auth
*/
public function __construct(AbstractOauth $auth)
{
@@ -62,9 +62,8 @@ public function handleRequest(RequestInterface $request, callable $next, callabl
// Mark access token as expired and with that ensure that the authentication plugin gets a new
// access token.
$this->auth->getTokenStorage()->markExpired();
- $promise = $first($request);
- return $promise->wait();
+ return $first($request)->wait();
}
throw $exception;
diff --git a/src/HttpClient/Utility/Builder.php b/src/HttpClient/Utility/Builder.php
index c5c0f167b..f7f3991d2 100644
--- a/src/HttpClient/Utility/Builder.php
+++ b/src/HttpClient/Utility/Builder.php
@@ -33,7 +33,7 @@
*/
class Builder implements BuilderInterface
{
- /** @var \Psr\Http\Client\ClientInterface */
+ /** @var ClientInterface */
private $httpClient;
/** @var PluginClient */
@@ -55,14 +55,14 @@ class Builder implements BuilderInterface
/**
* Builder constructor.
*
- * @param \Psr\Http\Client\ClientInterface|null $httpClient
- * @param \Psr\Http\Message\RequestFactoryInterface|null $requestFactory
- * @param \Psr\Http\Message\StreamFactoryInterface|null $streamFactory
+ * @param ClientInterface|null $httpClient
+ * @param RequestFactoryInterface|null $requestFactory
+ * @param StreamFactoryInterface|null $streamFactory
*/
public function __construct(
- ClientInterface $httpClient = null,
- RequestFactoryInterface $requestFactory = null,
- StreamFactoryInterface $streamFactory = null
+ ?ClientInterface $httpClient = null,
+ ?RequestFactoryInterface $requestFactory = null,
+ ?StreamFactoryInterface $streamFactory = null,
) {
$this->httpClient = $httpClient ?: Psr18ClientDiscovery::find();
if (null !== $requestFactory) {
diff --git a/src/HttpClient/Utility/BuilderInterface.php b/src/HttpClient/Utility/BuilderInterface.php
index a4dcd8d82..06586d622 100644
--- a/src/HttpClient/Utility/BuilderInterface.php
+++ b/src/HttpClient/Utility/BuilderInterface.php
@@ -29,7 +29,7 @@
interface BuilderInterface
{
/**
- * @return \Psr\Http\Client\ClientInterface
+ * @return ClientInterface
*/
public function getHttpClient(): ClientInterface;
@@ -61,7 +61,7 @@ public function removeHeader(string $header): void;
*
* The plugin is added to the end of the plugin list.
*
- * @param \Http\Client\Common\Plugin
+ * @param Plugin
* Http client plugin.
*
* @see http://docs.php-http.org/en/latest/plugins/introduction.html#how-it-works
diff --git a/src/HttpClient/Utility/Journal.php b/src/HttpClient/Utility/Journal.php
index 34777bb37..442e7c900 100644
--- a/src/HttpClient/Utility/Journal.php
+++ b/src/HttpClient/Utility/Journal.php
@@ -33,10 +33,10 @@
*/
final class Journal implements JournalInterface
{
- /** @var \Psr\Http\Message\RequestInterface */
+ /** @var RequestInterface */
private $lastRequest;
- /** @var \Psr\Http\Message\ResponseInterface */
+ /** @var ResponseInterface */
private $lastResponse;
/** @var \Http\Client\Exception */
@@ -52,8 +52,8 @@ final class Journal implements JournalInterface
/**
* Record a successful call.
*
- * @param \Psr\Http\Message\RequestInterface $request Request use to make the call
- * @param \Psr\Http\Message\ResponseInterface $response Response returned by the call
+ * @param RequestInterface $request Request use to make the call
+ * @param ResponseInterface $response Response returned by the call
*/
public function addSuccess(RequestInterface $request, ResponseInterface $response): void
{
@@ -65,8 +65,8 @@ public function addSuccess(RequestInterface $request, ResponseInterface $respons
/**
* Record a failed call.
*
- * @param \Psr\Http\Message\RequestInterface $request Request use to make the call
- * @param \Psr\Http\Client\ClientExceptionInterface $exception Exception returned by the call
+ * @param RequestInterface $request Request use to make the call
+ * @param ClientExceptionInterface $exception Exception returned by the call
*/
public function addFailure(RequestInterface $request, ClientExceptionInterface $exception): void
{
@@ -75,7 +75,7 @@ public function addFailure(RequestInterface $request, ClientExceptionInterface $
}
/**
- * @return \Psr\Http\Message\RequestInterface
+ * @return RequestInterface
*/
public function getLastRequest()
{
@@ -83,7 +83,7 @@ public function getLastRequest()
}
/**
- * @return \Psr\Http\Message\ResponseInterface
+ * @return ResponseInterface
*/
public function getLastResponse()
{
diff --git a/src/Normalizer/CredentialProductNormalizer.php b/src/Normalizer/CredentialProductNormalizer.php
index 2f882a707..7a1b1adba 100644
--- a/src/Normalizer/CredentialProductNormalizer.php
+++ b/src/Normalizer/CredentialProductNormalizer.php
@@ -19,6 +19,7 @@
namespace Apigee\Edge\Normalizer;
use Apigee\Edge\Structure\CredentialProductInterface;
+use ArrayObject;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
/**
@@ -40,9 +41,9 @@ public function normalize($object, $format = null, array $context = [])
'status' => $object->getStatus(),
];
- //Need to convert to ArrayObject as symfony normalizer throws error for std object.
- //Need to set ARRAY_AS_PROPS flag as we need Entries to be accessed as properties.
- return new \ArrayObject($asObject, \ArrayObject::ARRAY_AS_PROPS);
+ // Need to convert to ArrayObject as symfony normalizer throws error for std object.
+ // Need to set ARRAY_AS_PROPS flag as we need Entries to be accessed as properties.
+ return new ArrayObject($asObject, ArrayObject::ARRAY_AS_PROPS);
}
/**
@@ -52,4 +53,14 @@ public function supportsNormalization($data, $format = null)
{
return $data instanceof CredentialProductInterface;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ CredentialProductInterface::class => true,
+ ];
+ }
}
diff --git a/src/Normalizer/EdgeDateNormalizer.php b/src/Normalizer/EdgeDateNormalizer.php
index 9443d8473..770252074 100644
--- a/src/Normalizer/EdgeDateNormalizer.php
+++ b/src/Normalizer/EdgeDateNormalizer.php
@@ -18,6 +18,7 @@
namespace Apigee\Edge\Normalizer;
+use DateTimeInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
class EdgeDateNormalizer implements NormalizerInterface
@@ -27,7 +28,7 @@ class EdgeDateNormalizer implements NormalizerInterface
*/
public function supportsNormalization($data, $format = null)
{
- return $data instanceof \DateTimeInterface;
+ return $data instanceof DateTimeInterface;
}
/**
@@ -38,4 +39,14 @@ public function normalize($object, $format = null, array $context = [])
/* @var \DateTimeInterface $object */
return $object->getTimestamp() * 1000;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ DateTimeInterface::class => true,
+ ];
+ }
}
diff --git a/src/Normalizer/KeyValueMapNormalizer.php b/src/Normalizer/KeyValueMapNormalizer.php
index 22d7fbd78..998c0427e 100644
--- a/src/Normalizer/KeyValueMapNormalizer.php
+++ b/src/Normalizer/KeyValueMapNormalizer.php
@@ -46,4 +46,14 @@ public function supportsNormalization($data, $format = null)
{
return $data instanceof KeyValueMapInterface;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ KeyValueMapInterface::class => true,
+ ];
+ }
}
diff --git a/src/Normalizer/ObjectNormalizer.php b/src/Normalizer/ObjectNormalizer.php
index f24e5ce47..644e9d219 100644
--- a/src/Normalizer/ObjectNormalizer.php
+++ b/src/Normalizer/ObjectNormalizer.php
@@ -19,6 +19,7 @@
namespace Apigee\Edge\Normalizer;
use Apigee\Edge\PropertyAccess\PropertyAccessorDecorator;
+use ArrayObject;
use Symfony\Component\PropertyAccess\PropertyAccess;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
@@ -39,10 +40,10 @@
*/
class ObjectNormalizer implements NormalizerInterface, SerializerAwareInterface
{
- /** @var \Symfony\Component\Serializer\Normalizer\ObjectNormalizer */
+ /** @var BaseObjectNormalizer */
private $objectNormalizer;
- /** @var \Symfony\Component\Serializer\SerializerInterface|null */
+ /** @var SerializerInterface|null */
private $serializer;
/**
@@ -55,12 +56,12 @@ class ObjectNormalizer implements NormalizerInterface, SerializerAwareInterface
/**
* EntityNormalizer constructor.
*
- * @param \Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface|null $classMetadataFactory
- * @param \Symfony\Component\Serializer\NameConverter\NameConverterInterface|null $nameConverter
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface|null $propertyAccessor
- * @param \Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface|null $propertyTypeExtractor
+ * @param ClassMetadataFactoryInterface|null $classMetadataFactory
+ * @param NameConverterInterface|null $nameConverter
+ * @param PropertyAccessorInterface|null $propertyAccessor
+ * @param PropertyTypeExtractorInterface|null $propertyTypeExtractor
*/
- public function __construct(ClassMetadataFactoryInterface $classMetadataFactory = null, NameConverterInterface $nameConverter = null, PropertyAccessorInterface $propertyAccessor = null, PropertyTypeExtractorInterface $propertyTypeExtractor = null)
+ public function __construct(?ClassMetadataFactoryInterface $classMetadataFactory = null, ?NameConverterInterface $nameConverter = null, ?PropertyAccessorInterface $propertyAccessor = null, ?PropertyTypeExtractorInterface $propertyTypeExtractor = null)
{
if (null === $propertyTypeExtractor) {
$reflectionExtractor = new ReflectionExtractor();
@@ -129,9 +130,19 @@ public function setSerializer(SerializerInterface $serializer): void
/**
* {@inheritDoc}
*/
- public function convertToArrayObject($normalized, $array_as_props = \ArrayObject::ARRAY_AS_PROPS)
+ public function convertToArrayObject($normalized, $array_as_props = ArrayObject::ARRAY_AS_PROPS)
{
- //default set ARRAY_AS_PROPS flag as we need entries to be accessed as properties.
- return new \ArrayObject($normalized, $array_as_props);
+ // default set ARRAY_AS_PROPS flag as we need entries to be accessed as properties.
+ return new ArrayObject($normalized, $array_as_props);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSupportedTypes(?string $format): array
+ {
+ return [
+ '*' => false,
+ ];
}
}
diff --git a/src/Normalizer/PropertiesPropertyNormalizer.php b/src/Normalizer/PropertiesPropertyNormalizer.php
index 1ea099d0e..7818c6377 100644
--- a/src/Normalizer/PropertiesPropertyNormalizer.php
+++ b/src/Normalizer/PropertiesPropertyNormalizer.php
@@ -19,6 +19,7 @@
namespace Apigee\Edge\Normalizer;
use Apigee\Edge\Structure\PropertiesProperty;
+use ArrayObject;
/**
* Class PropertiesPropertyNormalizer.
@@ -39,9 +40,9 @@ public function normalize($object, $format = null, array $context = [])
'property' => parent::normalize($object, $format, $context),
];
- //convert to ArrayObject as symfony normalizer throws error for std object.
- //set ARRAY_AS_PROPS flag as we need entries to be accessed as properties.
- return new \ArrayObject($return, \ArrayObject::ARRAY_AS_PROPS);
+ // convert to ArrayObject as symfony normalizer throws error for std object.
+ // set ARRAY_AS_PROPS flag as we need entries to be accessed as properties.
+ return new ArrayObject($return, ArrayObject::ARRAY_AS_PROPS);
}
/**
diff --git a/src/PropertyAccess/PropertyAccessorDecorator.php b/src/PropertyAccess/PropertyAccessorDecorator.php
index 0254c5697..e47653fa6 100644
--- a/src/PropertyAccess/PropertyAccessorDecorator.php
+++ b/src/PropertyAccess/PropertyAccessorDecorator.php
@@ -20,8 +20,14 @@
use Apigee\Edge\Exception\UnexpectedValueException;
use Apigee\Edge\Exception\UninitializedPropertyException;
+
+use function get_class;
+use function gettype;
+
+use ReflectionObject;
use Symfony\Component\PropertyAccess\Exception\InvalidArgumentException;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
+use TypeError;
/**
* Extra features for Symfony's property accessor.
@@ -29,14 +35,14 @@
final class PropertyAccessorDecorator implements PropertyAccessorInterface
{
/**
- * @var \Symfony\Component\PropertyAccess\PropertyAccessorInterface
+ * @var PropertyAccessorInterface
*/
private $propertyAccessor;
/**
* PropertyAccessorDecorator constructor.
*
- * @param \Symfony\Component\PropertyAccess\PropertyAccessorInterface $propertyAccessor
+ * @param PropertyAccessorInterface $propertyAccessor
*/
public function __construct(PropertyAccessorInterface $propertyAccessor)
{
@@ -50,7 +56,7 @@ public function setValue(&$objectOrArray, $propertyPath, $value): void
{
try {
$this->propertyAccessor->setValue($objectOrArray, $propertyPath, $value);
- } catch (InvalidArgumentException | \TypeError $exception) {
+ } catch (InvalidArgumentException|TypeError $exception) {
// Auto-retry, try to pass the value as variable-length arguments to
// the setter method.
if (is_object($objectOrArray) && is_array($value)) {
@@ -64,7 +70,7 @@ public function setValue(&$objectOrArray, $propertyPath, $value): void
}
if (null === $setter) {
- throw new \TypeError("Setter method not found for {$propertyPath} property.", 0, $exception);
+ throw new TypeError("Setter method not found for {$propertyPath} property.", 0, $exception);
}
try {
@@ -74,7 +80,7 @@ public function setValue(&$objectOrArray, $propertyPath, $value): void
} else {
$objectOrArray->{$setter}(...$value);
}
- } catch (\TypeError $typeError) {
+ } catch (TypeError $typeError) {
self::processTypeErrorOnSetValue($typeError->getMessage(), $typeError->getTrace(), 0, (string) $typeError);
// Rethrow the exception if it could not be transformed
@@ -94,7 +100,7 @@ public function getValue($objectOrArray, $propertyPath): mixed
{
try {
$value = $this->propertyAccessor->getValue($objectOrArray, $propertyPath);
- } catch (\TypeError $error) {
+ } catch (TypeError $error) {
// Make sure it is an object.
if (is_object($objectOrArray)) {
self::processTypeErrorOnGetValue($objectOrArray, (string) $propertyPath, $error);
@@ -134,11 +140,11 @@ public function isReadable($objectOrArray, $propertyPath): bool
*
* @param object $object
* @param string $property
- * @param \TypeError $error
+ * @param TypeError $error
*
* @see \Symfony\Component\PropertyAccess\PropertyAccessor::throwInvalidArgumentException()
*/
- private static function processTypeErrorOnGetValue($object, string $property, \TypeError $error): void
+ private static function processTypeErrorOnGetValue($object, string $property, TypeError $error): void
{
if (0 !== strpos($error->getMessage(), 'Return value of ')) {
return;
@@ -146,7 +152,7 @@ private static function processTypeErrorOnGetValue($object, string $property, \T
$pos = strpos($error->getMessage(), $delim = 'must be of the type ') ?: (strpos($error->getMessage(), $delim = 'must be an instance of ') ?: strpos($error->getMessage(), $delim = 'must implement interface '));
if (false !== $pos) {
- $ro = new \ReflectionObject($object);
+ $ro = new ReflectionObject($object);
$rp = $ro->getProperty($property);
$rp->setAccessible(true);
$pos += strlen($delim);
@@ -157,7 +163,7 @@ private static function processTypeErrorOnGetValue($object, string $property, \T
throw new UninitializedPropertyException($object, $property, $expectedType);
}
- $actualType = \is_object($actualValue) ? \get_class($actualValue) : \gettype($actualValue);
+ $actualType = \is_object($actualValue) ? get_class($actualValue) : gettype($actualValue);
// Until we are using strongly typed variables this should not happen.
throw new UnexpectedValueException($object, $property, $expectedType, $actualType);
diff --git a/src/Serializer/EntitySerializer.php b/src/Serializer/EntitySerializer.php
index 87223c940..24e90e31b 100755
--- a/src/Serializer/EntitySerializer.php
+++ b/src/Serializer/EntitySerializer.php
@@ -26,16 +26,19 @@
use Apigee\Edge\Normalizer\KeyValueMapNormalizer;
use Apigee\Edge\Normalizer\ObjectNormalizer;
use Psr\Http\Message\ResponseInterface;
+use ReflectionMethod;
+use ReflectionObject;
use Symfony\Component\Serializer\Exception\NotEncodableValueException;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
use Symfony\Component\Serializer\Serializer;
+use TypeError;
/**
* Serializes, normalizes and denormalizes entities.
*/
class EntitySerializer implements EntitySerializerInterface
{
- /** @var \Symfony\Component\Serializer\Serializer */
+ /** @var Serializer */
private $serializer;
/**
@@ -63,7 +66,7 @@ public function __construct(array $normalizers = [])
new ArrayDenormalizer(),
new ObjectNormalizer(),
new ObjectDenormalizer(),
- ]
+ ]
);
$this->serializer = new Serializer($normalizers, [$this->jsonEncoder()]);
}
@@ -140,7 +143,7 @@ public function setPropertiesFromResponse(ResponseInterface $response, EntityInt
get_class($entity),
$this->format
);
- $ro = new \ReflectionObject($entity);
+ $ro = new ReflectionObject($entity);
// Copy property values from the temporary entity to $entity.
foreach ($ro->getProperties() as $property) {
// Ensure that these methods are exist. This is always true for all SDK entities but we can not be sure
@@ -158,7 +161,7 @@ public function setPropertiesFromResponse(ResponseInterface $response, EntityInt
}
}
- $rm = new \ReflectionMethod($entity, $setter);
+ $rm = new ReflectionMethod($entity, $setter);
$value = $tmp->{$getter}();
// Exclude null values.
// (An entity property value is null (internally) if it is scalar
@@ -168,7 +171,7 @@ public function setPropertiesFromResponse(ResponseInterface $response, EntityInt
if (null !== $value) {
try {
$rm->invoke($entity, $value);
- } catch (\TypeError $error) {
+ } catch (TypeError $error) {
// Auto-retry, pass the value as variable-length arguments.
if (is_array($value)) {
// Clear the value of the property.
@@ -220,7 +223,7 @@ public function supportsEncoding($format): bool
/**
* Allows subclasses to replace the default JSON encoder.
*
- * @return \Apigee\Edge\Serializer\JsonEncoder
+ * @return JsonEncoder
*/
protected function jsonEncoder(): JsonEncoder
{
diff --git a/src/Serializer/EntitySerializerInterface.php b/src/Serializer/EntitySerializerInterface.php
index 4b2c57f9c..b6348a79a 100755
--- a/src/Serializer/EntitySerializerInterface.php
+++ b/src/Serializer/EntitySerializerInterface.php
@@ -34,9 +34,9 @@ interface EntitySerializerInterface extends NormalizerInterface, DenormalizerInt
/**
* Set property values on an entity from an Apigee Edge response.
*
- * @param \Psr\Http\Message\ResponseInterface $response
+ * @param ResponseInterface $response
* Response from Apigee Edge.
- * @param \Apigee\Edge\Entity\EntityInterface $entity
+ * @param EntityInterface $entity
* Entity that properties should be updated.
*/
public function setPropertiesFromResponse(ResponseInterface $response, EntityInterface $entity): void;
diff --git a/src/Serializer/JsonDecode.php b/src/Serializer/JsonDecode.php
index cea70ddbf..76dd89532 100644
--- a/src/Serializer/JsonDecode.php
+++ b/src/Serializer/JsonDecode.php
@@ -18,6 +18,10 @@
namespace Apigee\Edge\Serializer;
+use const E_USER_DEPRECATED;
+
+use function is_array;
+
use Symfony\Component\Serializer\Encoder\JsonDecode as BaseJsonDecode;
/**
@@ -58,8 +62,8 @@ final class JsonDecode extends BaseJsonDecode
*/
public function __construct($defaultContext = [], int $depth = 512)
{
- if (!\is_array($defaultContext)) {
- @trigger_error(sprintf('Using constructor parameters that are not a default context is deprecated since Symfony 4.2, use the "%s" and "%s" keys of the context instead.', self::ASSOCIATIVE, self::RECURSION_DEPTH), \E_USER_DEPRECATED);
+ if (!is_array($defaultContext)) {
+ @trigger_error(sprintf('Using constructor parameters that are not a default context is deprecated since Symfony 4.2, use the "%s" and "%s" keys of the context instead.', self::ASSOCIATIVE, self::RECURSION_DEPTH), E_USER_DEPRECATED);
$defaultContext = [
self::ASSOCIATIVE => (bool) $defaultContext,
diff --git a/src/Serializer/JsonEncoder.php b/src/Serializer/JsonEncoder.php
index 22318d61e..df74aa625 100644
--- a/src/Serializer/JsonEncoder.php
+++ b/src/Serializer/JsonEncoder.php
@@ -33,9 +33,9 @@ final class JsonEncoder extends BaseJsonEncoder
*
* The encoder implementation is intentionally not swappable.
*
- * @param \Apigee\Edge\Serializer\JsonDecode|null $decodingImpl
+ * @param JsonDecode|null $decodingImpl
*/
- public function __construct(JsonDecode $decodingImpl = null)
+ public function __construct(?JsonDecode $decodingImpl = null)
{
$decodingImpl = $decodingImpl ?: new JsonDecode([JsonDecode::ASSOCIATIVE => true]);
parent::__construct(new JsonEncode([JsonEncode::OPTIONS => JSON_PRESERVE_ZERO_FRACTION]), $decodingImpl);
diff --git a/src/Structure/AddonsConfig.php b/src/Structure/AddonsConfig.php
index ce1ed916b..f317b1d99 100644
--- a/src/Structure/AddonsConfig.php
+++ b/src/Structure/AddonsConfig.php
@@ -23,7 +23,7 @@
*/
final class AddonsConfig extends BaseObject
{
- /** @var \Apigee\Edge\Structure\MonetizationConfig */
+ /** @var MonetizationConfig */
protected $monetizationConfig;
/**
diff --git a/src/Structure/BaseObject.php b/src/Structure/BaseObject.php
index 277543e8a..a1156e1c4 100644
--- a/src/Structure/BaseObject.php
+++ b/src/Structure/BaseObject.php
@@ -18,6 +18,10 @@
namespace Apigee\Edge\Structure;
+use ReflectionMethod;
+use ReflectionObject;
+use TypeError;
+
/**
* Class BaseObject.
*/
@@ -33,7 +37,7 @@ abstract class BaseObject
*/
public function __construct(array $values = [])
{
- $ro = new \ReflectionObject($this);
+ $ro = new ReflectionObject($this);
foreach ($ro->getProperties() as $property) {
if (!array_key_exists($property->getName(), $values)) {
continue;
@@ -41,10 +45,10 @@ public function __construct(array $values = [])
$setter = 'set' . ucfirst($property->getName());
if ($ro->hasMethod($setter)) {
$value = $values[$property->getName()];
- $rm = new \ReflectionMethod($this, $setter);
+ $rm = new ReflectionMethod($this, $setter);
try {
$rm->invoke($this, $value);
- } catch (\TypeError $error) {
+ } catch (TypeError $error) {
// Auto-retry, pass the value as variable-length arguments.
// Ignore empty variable list.
if (is_array($value)) {
diff --git a/src/Structure/KeyValueMap.php b/src/Structure/KeyValueMap.php
index e59af9da6..d9262b73a 100644
--- a/src/Structure/KeyValueMap.php
+++ b/src/Structure/KeyValueMap.php
@@ -18,6 +18,9 @@
namespace Apigee\Edge\Structure;
+use ArrayIterator;
+use Traversable;
+
/**
* Class KeyValueMap.
*/
@@ -93,8 +96,8 @@ public function has(string $key): bool
/**
* {@inheritdoc}
*/
- public function getIterator(): \Traversable
+ public function getIterator(): Traversable
{
- return new \ArrayIterator($this->values());
+ return new ArrayIterator($this->values());
}
}
diff --git a/src/Structure/KeyValueMapInterface.php b/src/Structure/KeyValueMapInterface.php
index a380b6728..e5ee22dc1 100644
--- a/src/Structure/KeyValueMapInterface.php
+++ b/src/Structure/KeyValueMapInterface.php
@@ -18,12 +18,14 @@
namespace Apigee\Edge\Structure;
+use IteratorAggregate;
+
/**
* Interface KeyValueMapInterface.
*
* @extends \IteratorAggregate
*/
-interface KeyValueMapInterface extends \IteratorAggregate
+interface KeyValueMapInterface extends IteratorAggregate
{
/**
* Returns values from the store.
diff --git a/src/Structure/ObjectCopyHelperTrait.php b/src/Structure/ObjectCopyHelperTrait.php
index 2598cd671..2958e8622 100644
--- a/src/Structure/ObjectCopyHelperTrait.php
+++ b/src/Structure/ObjectCopyHelperTrait.php
@@ -18,6 +18,8 @@
namespace Apigee\Edge\Structure;
+use ReflectionObject;
+
trait ObjectCopyHelperTrait
{
/**
@@ -27,7 +29,7 @@ trait ObjectCopyHelperTrait
*/
public function __clone()
{
- $ro = new \ReflectionObject($this);
+ $ro = new ReflectionObject($this);
foreach ($ro->getProperties() as $property) {
$property->setAccessible(true);
$value = $property->getValue($this);
diff --git a/src/Utility/DeprecatedPropertyTrait.php b/src/Utility/DeprecatedPropertyTrait.php
index b5336eb55..d0123801c 100644
--- a/src/Utility/DeprecatedPropertyTrait.php
+++ b/src/Utility/DeprecatedPropertyTrait.php
@@ -18,6 +18,8 @@
namespace Apigee\Edge\Utility;
+use LogicException;
+
/**
* Trait DeprecatedPropertyTrait.
*
@@ -29,6 +31,7 @@
* protected $deprecatedProperties = [
* 'deprecatedProperty' => 'replacementProperty',
* ];
+ *
* @endcode
*/
trait DeprecatedPropertyTrait
@@ -41,7 +44,7 @@ public function __get($name)
$removedBeforeVersion = '3.0.0';
if (!isset($this->deprecatedProperties)) {
- throw new \LogicException('The deprecatedProperties property must be defined to use this trait.');
+ throw new LogicException('The deprecatedProperties property must be defined to use this trait.');
}
if (isset($this->deprecatedProperties[$name])) {
@@ -52,7 +55,7 @@ public function __get($name)
// The property has no replacement (it does not exist anymore) or has an invalid/missing replacement.
$message = "The property $name is deprecated in $className and no replacement has been defined.";
@trigger_error($message, E_USER_DEPRECATED);
- throw new \LogicException($message);
+ throw new LogicException($message);
}
// If the property does have a replacement.
diff --git a/src/Utility/OrganizationFeatures.php b/src/Utility/OrganizationFeatures.php
index fd4194ad1..628676ae7 100644
--- a/src/Utility/OrganizationFeatures.php
+++ b/src/Utility/OrganizationFeatures.php
@@ -25,7 +25,7 @@ final class OrganizationFeatures
/**
* Checks whether CPS feature is enabled on an organization.
*
- * @param \Apigee\Edge\Api\Management\Entity\OrganizationInterface $org
+ * @param OrganizationInterface $org
*
* @return bool
*/
@@ -37,7 +37,7 @@ public static function isCpsEnabled(OrganizationInterface $org): bool
/**
* Checks whether pagination is enabled on an organization.
*
- * @param \Apigee\Edge\Api\Management\Entity\OrganizationInterface $org
+ * @param OrganizationInterface $org
*
* @return bool
*/
@@ -49,7 +49,7 @@ public static function isPaginationAvailable(OrganizationInterface $org): bool
/**
* Checks whether companies features/resources are supported for an organization.
*
- * @param \Apigee\Edge\Api\Management\Entity\OrganizationInterface $org
+ * @param OrganizationInterface $org
*
* @return bool
*/
@@ -61,7 +61,7 @@ public static function isCompaniesFeatureAvailable(OrganizationInterface $org):
/**
* Checks whether hybrid feature is enabled on an organization.
*
- * @param \Apigee\Edge\Api\Management\Entity\OrganizationInterface $org
+ * @param OrganizationInterface $org
*
* @return bool
*/
@@ -73,7 +73,7 @@ public static function isHybridEnabled(OrganizationInterface $org): bool
/**
* Checks whether monetization feature is enabled on an organization.
*
- * @param \Apigee\Edge\Api\Management\Entity\OrganizationInterface $org
+ * @param OrganizationInterface $org
*
* @return bool
*/
@@ -87,7 +87,7 @@ public static function isMonetizationEnabled(OrganizationInterface $org): bool
*
* @param string $feature
* Name of a "feature' property.
- * @param \Apigee\Edge\Api\Management\Entity\OrganizationInterface $org
+ * @param OrganizationInterface $org
* The organization to be checked.
*
* @return bool
diff --git a/src/Utility/ResponseToArrayHelper.php b/src/Utility/ResponseToArrayHelper.php
index 40c5d7761..3a75323f3 100644
--- a/src/Utility/ResponseToArrayHelper.php
+++ b/src/Utility/ResponseToArrayHelper.php
@@ -22,6 +22,8 @@
use Apigee\Edge\Exception\ApiResponseException;
use Apigee\Edge\Exception\InvalidJsonException;
use Psr\Http\Message\ResponseInterface;
+use RuntimeException;
+use UnexpectedValueException;
trait ResponseToArrayHelper
{
@@ -33,7 +35,7 @@ trait ResponseToArrayHelper
*
* The SDK only works with JSON responses, but let's be prepared for the unexpected.
*
- * @param \Psr\Http\Message\ResponseInterface $response
+ * @param ResponseInterface $response
* @param bool $expandCompatability
* If the API response requires backwards compatibility with the way Edge
* formats it's responses.
@@ -42,15 +44,15 @@ trait ResponseToArrayHelper
* expand=false query parameter on the Hybrid documentation:
* https://docs.apigee.com/hybrid/beta2/reference/apis/unsupported-apis
*
- * @throws \RuntimeException If response can not be decoded, because the input format is unknown.
- * @throws \Apigee\Edge\Exception\InvalidJsonException If there was an error with decoding a JSON response.
+ * @throws RuntimeException If response can not be decoded, because the input format is unknown.
+ * @throws InvalidJsonException If there was an error with decoding a JSON response.
*
* @return array
*/
protected function responseToArray(ResponseInterface $response, bool $expandCompatibility = false): array
{
- if ($response->getHeaderLine('Content-Type') &&
- 0 === strpos($response->getHeaderLine('Content-Type'), 'application/json')) {
+ if ($response->getHeaderLine('Content-Type')
+ && 0 === strpos($response->getHeaderLine('Content-Type'), 'application/json')) {
try {
$decoded = (array) $this->jsonDecoder()->decode((string) $response->getBody(), 'json');
@@ -59,7 +61,7 @@ protected function responseToArray(ResponseInterface $response, bool $expandComp
}
return $decoded;
- } catch (\UnexpectedValueException $e) {
+ } catch (UnexpectedValueException $e) {
throw new InvalidJsonException(
$e->getMessage(),
$response,
diff --git a/tests/Api/ApigeeX/Controller/AcceptedRatePlanControllerTestBase.php b/tests/Api/ApigeeX/Controller/AcceptedRatePlanControllerTestBase.php
index 161a2b49a..dcc5fb2d9 100644
--- a/tests/Api/ApigeeX/Controller/AcceptedRatePlanControllerTestBase.php
+++ b/tests/Api/ApigeeX/Controller/AcceptedRatePlanControllerTestBase.php
@@ -63,7 +63,7 @@ public function testAcceptRatePlan(): void
$httpClient = static::mockApiClient()->getMockHttpClient();
/** @var \Apigee\Edge\Api\ApigeeX\Controller\AcceptedRatePlanControllerInterface $acceptedController */
$acceptedController = static::entityController(static::mockApiClient());
- /** @var \Apigee\Edge\Api\ApigeeX\Entity\RatePlanInterface $ratePlan */
+ /** @var RatePlanInterface $ratePlan */
$ratePlan = $this->getRatePlanToAccept();
$response = $this->getAcceptRatePlanResponse();
$httpClient->addResponse($response);
@@ -88,12 +88,12 @@ public function testAcceptRatePlan(): void
/**
* Returns a response that will be returned for acceptRatePlan().
*
- * @return \Psr\Http\Message\ResponseInterface
+ * @return ResponseInterface
*/
abstract protected function getAcceptRatePlanResponse(): ResponseInterface;
/**
- * @return \Apigee\Edge\Api\ApigeeX\Entity\RatePlanInterface
+ * @return RatePlanInterface
*/
abstract protected function getRatePlanToAccept(): RatePlanInterface;
diff --git a/tests/Api/ApigeeX/Controller/ApiProductControllerAwareTestTrait.php b/tests/Api/ApigeeX/Controller/ApiProductControllerAwareTestTrait.php
new file mode 100644
index 000000000..4fbc7e300
--- /dev/null
+++ b/tests/Api/ApigeeX/Controller/ApiProductControllerAwareTestTrait.php
@@ -0,0 +1,44 @@
+create(static::$testApiProduct);
+ }
+
+ /**
+ * It is easier to test it here instead in the DeveloperControllerTest
+ * or CompanyControllerTest.
+ */
+ public function testHasApp(): void
+ {
+ if (TestClientFactory::isOfflineClient(static::defaultAPIClient())) {
+ Assert::markTestSkipped(__FUNCTION__ . ' can be executed only with an online API test client.');
+ }
+ /** @var \Apigee\Edge\Api\Management\Controller\DeveloperAppControllerInterface $controller */
+ $controller = static::entityController();
+ /** @var \Apigee\Edge\Api\Management\Entity\DeveloperAppInterface $entity */
+ $entity = static::getNewEntity();
+ $controller->create($entity);
+ /** @var \Apigee\Edge\Api\Management\Entity\DeveloperInterface|\Apigee\Edge\Api\ApigeeX\Entity\AppGroupInterface $appOwner */
+ $appOwner = static::reloadAppOwner();
+ $this->assertTrue($appOwner->hasApp($entity->getName()));
+ $controller->delete($entity->id());
+ $appOwner = static::reloadAppOwner();
+ $this->assertFalse($appOwner->hasApp($entity->getName()));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected static function entityCreateOperationTestController(): EntityCreateOperationTestControllerTesterInterface
+ {
+ return new EntityCreateOperationControllerTester(static::entityController());
+ }
+
+ /**
+ * Reloads the developer from Apigee Edge.
+ *
+ * @return \Apigee\Edge\Api\Management\Entity\DeveloperInterface|\Apigee\Edge\Api\ApigeeX\Entity\AppGroupInterface
+ */
+ abstract protected function reloadAppOwner();
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function alterArraysBeforeCompareSentAndReceivedPayloadsInCreate(array &$sentEntityAsArray, array $responseEntityAsArray): void
+ {
+ // This is not returned in the POST/PUT API call responses only in GET.
+ unset($sentEntityAsArray['appFamily']);
+ unset($sentEntityAsArray['apiProducts']);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function alterObjectsBeforeCompareResponseAndCreatedEntity(stdClass &$responseObject, EntityInterface $created): void
+ {
+ /* @var \Apigee\Edge\Api\Management\Entity\DeveloperAppInterface $created */
+ $responseObject->apiProducts = $created->getApiProducts();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function alterArraysBeforeCompareSentAndReceivedPayloadsInUpdate(array &$sentEntityAsArray, array $responseEntityAsArray): void
+ {
+ $this->alterArraysBeforeCompareSentAndReceivedPayloadsInCreate($sentEntityAsArray, $responseEntityAsArray);
+ $sentEntityAsArray['credentials'][0]['issuedAt'] = $responseEntityAsArray['credentials'][0]['issuedAt'];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function alterObjectsBeforeCompareResponseAndUpdateEntity(stdClass &$responseObject, EntityInterface $created): void
+ {
+ $this->alterObjectsBeforeCompareResponseAndCreatedEntity($responseObject, $created);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function entitySerializerValidator(): EntitySerializerValidatorInterface
+ {
+ static $validator;
+ if (null === $validator) {
+ $validator = new AppSerializerValidator($this->entitySerializer());
+ }
+
+ return $validator;
+ }
+}
diff --git a/tests/Api/ApigeeX/Controller/AppCredentialControllerTestBase.php b/tests/Api/ApigeeX/Controller/AppCredentialControllerTestBase.php
new file mode 100644
index 000000000..ca61bab3e
--- /dev/null
+++ b/tests/Api/ApigeeX/Controller/AppCredentialControllerTestBase.php
@@ -0,0 +1,348 @@
+create(static::$testApiProduct);
+ static::$testAppOwner = static::setupTestAppOwner();
+ static::$testApp = static::setupTestApp(static::setupTestAppOwner());
+ }
+
+ public function testCreatedAppHasAnEmptyCredential(): void
+ {
+ /** @var DeveloperAppInterface $entity */
+ /** @var AppByOwnerControllerInterface $controller */
+ $entity = static::appByOwnerController()->load(static::$testApp->id());
+ $credentials = $entity->getCredentials();
+ $this->assertCount(1, $credentials);
+ /** @var AppCredentialInterface $credential */
+ $credential = reset($credentials);
+ $this->assertCount(0, $credential->getApiProducts());
+ $this->assertNotEmpty($credential->getConsumerKey());
+ $this->assertNotEmpty($credential->getConsumerSecret());
+ $this->assertEquals(null, $credential->getExpiresAt());
+ }
+
+ /**
+ * @depends testCreatedAppHasAnEmptyCredential
+ *
+ * @return AppCredentialInterface
+ */
+ public function testCreate(): AppCredentialInterface
+ {
+ // Ensure that generated key always valid. (Random app names used by online tests can contain dot which is not
+ // valid according to Apigee Edge.)
+ $key = preg_replace('/[^A-Za-z0-9\-_]/', '', static::$testApp->getName() . '_key');
+ $secret = static::$testApp->getName() . '_secret';
+ $credential = static::entityController()->create($key, $secret);
+ $this->assertCount(0, $credential->getApiProducts());
+ $this->assertEquals($key, $credential->getConsumerKey());
+ $this->assertEquals($secret, $credential->getConsumerSecret());
+ $this->assertEquals(null, $credential->getExpiresAt());
+
+ return $credential;
+ }
+
+ /**
+ * @depends testCreate
+ *
+ * @param AppCredentialInterface $created
+ *
+ * @return string
+ */
+ public function testLoad(AppCredentialInterface $created)
+ {
+ /** @var AppCredentialInterface $loaded */
+ $loaded = static::entityController()->load($created->id());
+ $this->assertCount(count($loaded->getApiProducts()), $created->getApiProducts());
+ $this->assertEquals($created->getConsumerKey(), $loaded->getConsumerKey());
+ $this->assertEquals($created->getConsumerSecret(), $loaded->getConsumerSecret());
+ $this->assertEquals($created->getIssuedAt()->getTimestamp(), $loaded->getIssuedAt()->getTimestamp());
+ $this->assertEquals($created->getExpiresAt(), $loaded->getExpiresAt());
+
+ return $loaded->id();
+ }
+
+ /**
+ * @depends testLoad
+ *
+ * @param string $entityId
+ */
+ public function testAddProducts(string $entityId): void
+ {
+ /** @var AppCredentialControllerInterface $controller */
+ $controller = $this->entityController();
+ $credential = $controller->addProducts($entityId, [static::$testApiProduct->id()]);
+ $productNames = $this->getCredentialProducts($credential);
+ $this->assertContains(static::$testApiProduct->id(), $productNames);
+ }
+
+ /**
+ * @depends testLoad
+ *
+ * @param string $entityId
+ */
+ public function testOverrideScopes(string $entityId): void
+ {
+ /** @var AppCredentialControllerInterface $controller */
+ $controller = $this->entityController();
+ /** @var AppCredentialInterface $credential */
+ $credential = $controller->load($entityId);
+ $this->assertEmpty($credential->getScopes());
+ $credential = $controller->overrideScopes($entityId, ['scope 1']);
+ $this->assertContains('scope 1', $credential->getScopes());
+ if (TestClientFactory::isOfflineClient(static::defaultAPIClient())) {
+ $this->markTestIncomplete(__FUNCTION__ . ' can be completed only with an online API test client.');
+ }
+ $credential = $controller->overrideScopes($entityId, ['scope 2']);
+ $this->assertNotContains('scope 1', $credential->getScopes());
+ $this->assertContains('scope 2', $credential->getScopes());
+ }
+
+ /**
+ * @depends testLoad
+ *
+ * @group online
+ *
+ * @param string $entityId
+ */
+ public function testStatusChange(string $entityId): void
+ {
+ static::markOnlineTestSkipped(__FUNCTION__);
+ /** @var AppCredentialControllerInterface $controller */
+ $controller = static::entityController();
+ /* @var AppCredentialInterface $credential */
+ $controller->setStatus($entityId, AppCredentialControllerInterface::STATUS_REVOKE);
+ $credential = $controller->load($entityId);
+ $this->assertEquals($credential->getStatus(), AppCredentialInterface::STATUS_REVOKED);
+ $controller->setStatus($entityId, AppCredentialControllerInterface::STATUS_APPROVE);
+ $credential = $controller->load($entityId);
+ $this->assertEquals($credential->getStatus(), AppCredentialInterface::STATUS_APPROVED);
+ }
+
+ /**
+ * @depends testLoad
+ *
+ * @group online
+ *
+ * @param string $entityId
+ */
+ public function testApiProductStatusChange(string $entityId): void
+ {
+ static::markOnlineTestSkipped(__FUNCTION__);
+ /** @var AppCredentialControllerInterface $controller */
+ $controller = static::entityController();
+ /* @var AppCredentialInterface $credential */
+ $controller->setApiProductStatus(
+ $entityId,
+ static::$testApiProduct->id(),
+ AppCredentialControllerInterface::STATUS_REVOKE
+ );
+ $credential = $controller->load($entityId);
+ /** @var CredentialProduct $product */
+ foreach ($credential->getApiProducts() as $product) {
+ if ($product->getApiproduct() === static::$testApiProduct->id()) {
+ $this->assertEquals($product->getStatus(), CredentialProductInterface::STATUS_REVOKED);
+ break;
+ }
+ }
+ $controller->setApiProductStatus(
+ $entityId,
+ static::$testApiProduct->id(),
+ AppCredentialControllerInterface::STATUS_APPROVE
+ );
+ $credential = $controller->load($entityId);
+ foreach ($credential->getApiProducts() as $product) {
+ if ($product->getApiproduct() === static::$testApiProduct->id()) {
+ $this->assertEquals($product->getStatus(), CredentialProductInterface::STATUS_APPROVED);
+ break;
+ }
+ }
+ }
+
+ /**
+ * @group online
+ *
+ * @return string
+ */
+ public function testGenerate(): string
+ {
+ static::markOnlineTestSkipped(__FUNCTION__);
+ /** @var AppCredentialControllerInterface $controller */
+ $controller = $this->entityController();
+ /** @var AppInterface $app */
+ $app = static::appByOwnerController()->load(static::$testApp->id());
+ /** @var AppCredentialInterface $credential */
+ $credential = $controller->generate(
+ [static::$testApiProduct->id()],
+ $app->getAttributes(),
+ $app->getCallbackUrl(),
+ ['scope 1'],
+ 604800000
+ );
+
+ $productNames = $this->getCredentialProducts($credential);
+ $this->assertContains(static::$testApiProduct->id(), $productNames);
+ $this->assertContains('scope 1', $credential->getScopes());
+ // Thanks for the offline tests, we can not expect a concrete value
+ // here.
+ $this->assertNotEquals('-1', $credential->getExpiresAt());
+ /** @var AppInterface $updatedApp */
+ $updatedApp = static::appByOwnerController()->load(static::$testApp->id());
+ // Credential generation should not deleted any previously existing app
+ // credentials.
+ $this->assertEquals($app->getAttributes(), $updatedApp->getAttributes());
+
+ return $credential->id();
+ }
+
+ /**
+ * @depends testGenerate
+ *
+ * @group online
+ */
+ public function testDeleteApiProduct(string $entityId): void
+ {
+ static::markOnlineTestSkipped(__FUNCTION__);
+ /** @var AppCredentialControllerInterface $controller */
+ $controller = static::entityController();
+ /** @var AppCredentialInterface $credential */
+ $credential = $controller->load($entityId);
+ $productNames = $this->getCredentialProducts($credential);
+ $this->assertContains(static::$testApiProduct->id(), $productNames);
+ /* @var AppCredentialInterface $credential */
+ $controller->deleteApiProduct(
+ $entityId,
+ static::$testApiProduct->id()
+ );
+ $credential = $controller->load($entityId);
+ $productNames = $this->getCredentialProducts($credential);
+ $this->assertNotContains(static::$testApiProduct->id(), $productNames);
+ }
+
+ /**
+ * @depends testGenerate
+ */
+ public function testAddAttributesToEntity(): string
+ {
+ /** @var AppCredentialInterface $credential */
+ $credentials = static::$testApp->getCredentials();
+ $credential = reset($credentials);
+ /** @var AttributesProperty $attributes */
+ $attributes = $credential->getAttributes();
+ $originalAttributes = $attributes->values();
+ $attributes->add('name1', 'value1');
+ $attributes->add('name2', 'value2');
+ /** @var AttributesProperty $attributesProperty */
+ $attributesProperty = static::entityController()->updateAttributes($credential->id(), $attributes);
+ /** @var array $newAttributes */
+ $newAttributes = $attributesProperty->values();
+ $this->assertArraySubset($originalAttributes, $newAttributes);
+ $this->assertArrayHasKey('name1', $newAttributes);
+ $this->assertArrayHasKey('name2', $newAttributes);
+ $this->assertEquals('value1', $newAttributes['name1']);
+ $this->assertEquals('value2', $newAttributes['name2']);
+
+ return $credential->id();
+ }
+
+ /**
+ * @depends testCreatedAppHasAnEmptyCredential
+ *
+ * @group online
+ */
+ public function testDelete(): void
+ {
+ static::markOnlineTestSkipped(__FUNCTION__);
+ $newCredential = static::entityController()->generate(
+ [static::$testApiProduct->id()],
+ static::$testApp->getAttributes(),
+ static::$testApp->getCallbackUrl(),
+ ['scope 1'],
+ 604800000
+ );
+ static::$testApp = static::appByOwnerController()->load(static::$testApp->id());
+ static::entityController()->delete($newCredential->id());
+ static::$testApp = static::appByOwnerController()->load(static::$testApp->id());
+ $found = false;
+ foreach (static::$testApp->getCredentials() as $cred) {
+ if ($newCredential->id() === $cred->id()) {
+ $found = true;
+ }
+ }
+ $this->assertFalse($found, 'Credential credential has not been deleted.');
+ }
+
+ abstract protected static function setupTestApp(AppGroup $appOwner): AppInterface;
+
+ abstract protected static function setupTestAppOwner(): AppGroup;
+
+ /**
+ * @return EntityControllerTesterInterface|AppByOwnerControllerInterface
+ */
+ abstract protected static function appByOwnerController(): EntityControllerTesterInterface;
+
+ private function getCredentialProducts(AppCredentialInterface $credential)
+ {
+ return array_map(function ($product) {
+ /* @var CredentialProduct $product */
+ return $product->getApiproduct();
+ }, $credential->getApiProducts());
+ }
+}
diff --git a/tests/Api/ApigeeX/Controller/AppGroupAppControllerAwareTestTrait.php b/tests/Api/ApigeeX/Controller/AppGroupAppControllerAwareTestTrait.php
new file mode 100644
index 000000000..91cfd3818
--- /dev/null
+++ b/tests/Api/ApigeeX/Controller/AppGroupAppControllerAwareTestTrait.php
@@ -0,0 +1,47 @@
+id(), $client));
+ }
+
+ abstract protected static function appGroupAppControllerAppGroupAppOwner(): AppGroupInterface;
+}
diff --git a/tests/Api/ApigeeX/Controller/AppGroupAppControllerTest.php b/tests/Api/ApigeeX/Controller/AppGroupAppControllerTest.php
new file mode 100644
index 000000000..bf7b94acd
--- /dev/null
+++ b/tests/Api/ApigeeX/Controller/AppGroupAppControllerTest.php
@@ -0,0 +1,105 @@
+create(static::$testAppGroup);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
+ {
+ return static::appGroupAppController($client);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected static function getNewEntity(): EntityInterface
+ {
+ return static::getNewAppGroupApp([static::$testApiProduct->id()], !TestClientFactory::isOfflineClient(static::defaultAPIClient()));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function entityForUpdateTest(EntityInterface $existing): EntityInterface
+ {
+ /* @var \Apigee\Edge\Api\Management\Entity\AppGroupAppInterface $existing */
+ return static::getUpdatedAppGroupApp($existing, !TestClientFactory::isOfflineClient(static::defaultAPIClient()));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected static function entityCreateOperationTestController(): EntityCreateOperationTestControllerTesterInterface
+ {
+ return new EntityCreateOperationControllerTester(static::entityController());
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected static function appGroupAppControllerAppGroupAppOwner(): AppGroupInterface
+ {
+ return static::$testAppGroup;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function reloadAppOwner()
+ {
+ return static::appGroupController()->load(static::$testAppGroup->id());
+ }
+}
diff --git a/tests/Api/ApigeeX/Controller/AppGroupAppCredentialControllerTest.php b/tests/Api/ApigeeX/Controller/AppGroupAppCredentialControllerTest.php
new file mode 100644
index 000000000..38cc3ac3b
--- /dev/null
+++ b/tests/Api/ApigeeX/Controller/AppGroupAppCredentialControllerTest.php
@@ -0,0 +1,92 @@
+id(), static::$testApp->id(), $client));
+ }
+
+ protected static function setupTestApp(AppGroup $appOwner): AppInterface
+ {
+ $app = static::getNewAppGroupApp();
+ static::appGroupAppController()->create($app);
+
+ return $app;
+ }
+
+ protected static function setupTestAppOwner(): AppGroup
+ {
+ $appGroup = static::getNewAppGroup();
+ static::appGroupController()->create($appGroup);
+
+ return $appGroup;
+ }
+
+ protected static function appGroupAppControllerAppGroupAppOwner(): AppGroupInterface
+ {
+ return static::$testAppOwner;
+ }
+
+ protected static function entityCreateOperationTestController(): EntityCreateOperationTestControllerTesterInterface
+ {
+ return new EntityCreateOperationControllerTester(static::appGroupAppController());
+ }
+
+ protected static function getNewEntity(): EntityInterface
+ {
+ return static::getNewAppGroupApp();
+ }
+
+ protected static function appByOwnerController(): EntityControllerTesterInterface
+ {
+ return static::appGroupAppController();
+ }
+}
diff --git a/tests/Api/ApigeeX/Controller/AppGroupControllerAwareTestTrait.php b/tests/Api/ApigeeX/Controller/AppGroupControllerAwareTestTrait.php
new file mode 100644
index 000000000..1a3d31e50
--- /dev/null
+++ b/tests/Api/ApigeeX/Controller/AppGroupControllerAwareTestTrait.php
@@ -0,0 +1,43 @@
+create($entity);
+ $controller->setStatus($entity->id(), AppGroupInterface::STATUS_INACTIVE);
+ $entity = $controller->load($entity->id());
+ $this->assertEquals($entity->getStatus(), AppGroupInterface::STATUS_INACTIVE);
+ $controller->setStatus($entity->id(), AppGroupInterface::STATUS_ACTIVE);
+ $entity = $controller->load($entity->id());
+ $this->assertEquals($entity->getStatus(), AppGroupInterface::STATUS_ACTIVE);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
+ {
+ return static::appGroupController($client);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected static function getNewEntity(): EntityInterface
+ {
+ return static::getNewAppGroup(!TestClientFactory::isOfflineClient(static::defaultAPIClient()));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function entityForUpdateTest(EntityInterface $existing): EntityInterface
+ {
+ /* @var \Apigee\Edge\Api\ApigeeX\Entity\AppGroupInterface $existing */
+ return static::getUpdatedAppGroup($existing, !TestClientFactory::isOfflineClient(static::defaultAPIClient()));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected static function entityCreateOperationTestController(): EntityCreateOperationTestControllerTesterInterface
+ {
+ return new EntityCreateOperationControllerTester(static::entityController());
+ }
+}
diff --git a/tests/Api/ApigeeX/Controller/AppGroupMembersControllerTest.php b/tests/Api/ApigeeX/Controller/AppGroupMembersControllerTest.php
new file mode 100644
index 000000000..f47d08074
--- /dev/null
+++ b/tests/Api/ApigeeX/Controller/AppGroupMembersControllerTest.php
@@ -0,0 +1,131 @@
+create(static::$testAppGroup);
+ static::$testDeveloper1 = static::getNewDeveloper();
+ static::developerController()->create(static::$testDeveloper1);
+ static::$testDeveloper2 = static::getNewDeveloper();
+ static::developerController()->create(static::$testDeveloper2);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function tearDownAfterClass(): void
+ {
+ parent::tearDownAfterClass();
+ EntityStorage::getInstance()->purgeCreatedEntities();
+ }
+
+ public function testCreateMembership(): void
+ {
+ $members = $this->getAppGroupMembershipController()->setMembers(new AppGroupMembership([static::$testDeveloper1->getEmail() => static::TEST_ROLE]));
+ $this->assertTrue($members->isMember(static::$testDeveloper1->getEmail()));
+ $this->assertContains(static::TEST_ROLE, $members->getRole(static::$testDeveloper1->getEmail()));
+ }
+
+ /**
+ * @depends testCreateMembership
+ *
+ * @group online
+ */
+ public function testUpdateMembership(): void
+ {
+ static::markOnlineTestSkipped(__FUNCTION__);
+ $role = 'not a simple member';
+ $members = $this->getAppGroupMembershipController()->setMembers(new AppGroupMembership([static::$testDeveloper1->getEmail() => $role]));
+ $this->assertTrue($members->isMember(static::$testDeveloper1->getEmail()));
+ $this->assertEquals($role, $members->getRole(static::$testDeveloper1->getEmail()));
+ }
+
+ /**
+ * To make sure AppGroup has no members.
+ *
+ * @group online
+ */
+ public function testAddMember(): void
+ {
+ $this->getAppGroupMembershipController()->setMembers(new AppGroupMembership([static::$testDeveloper1->getEmail() => '']));
+ // Add a new member.
+ $this->getAppGroupMembershipController()->setMembers(new AppGroupMembership([static::$testDeveloper2->getEmail() => '']));
+ $members = $this->getAppGroupMembershipController()->getMembers();
+ $this->assertTrue($members->isMember(static::$testDeveloper1->getEmail()));
+ $this->assertTrue($members->isMember(static::$testDeveloper2->getEmail()));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected static function defaultAPIClient(): ClientInterface
+ {
+ return TestClientFactory::getClient();
+ }
+
+ protected function getAppGroupMembershipController(): AppGroupMembersControllerInterface
+ {
+ return new AppGroupMembersController(static::$testAppGroup->id(), static::defaultTestOrganization(static::defaultAPIClient()), static::defaultAPIClient());
+ }
+}
diff --git a/tests/Api/ApigeeX/Controller/AttributesAwareEntityControllerTestTrait.php b/tests/Api/ApigeeX/Controller/AttributesAwareEntityControllerTestTrait.php
new file mode 100644
index 000000000..991bdebd8
--- /dev/null
+++ b/tests/Api/ApigeeX/Controller/AttributesAwareEntityControllerTestTrait.php
@@ -0,0 +1,132 @@
+entityController();
+ /** @var \Apigee\Edge\Entity\Property\AttributesPropertyInterface|\Apigee\Edge\Entity\EntityInterface $entity */
+ $entity = static::getNewEntity();
+ static::entityCreateOperationTestController()->create($entity);
+ /** @var \Apigee\Edge\Structure\AttributesProperty $attributes */
+ $attributes = $entity->getAttributes();
+ $originalAttributes = $attributes->values();
+ $attributes->add('name1', 'value1');
+ $attributes->add('name2', 'value2');
+ /** @var \Apigee\Edge\Structure\AttributesProperty $attributesProperty */
+ $attributesProperty = $controller->updateAttributes($entity->id(), $attributes);
+ /** @var array $newAttributes */
+ $newAttributes = $attributesProperty->values();
+ Assert::assertArraySubset($originalAttributes, $newAttributes);
+ $this->assertArrayHasKey('name1', $newAttributes);
+ $this->assertArrayHasKey('name2', $newAttributes);
+ $this->assertEquals('value1', $newAttributes['name1']);
+ $this->assertEquals('value2', $newAttributes['name2']);
+
+ return $entity->id();
+ }
+
+ /**
+ * @depends testAddAttributesToEntity
+ *
+ * @param string $entityId
+ */
+ public function testGetAttributes(string $entityId): void
+ {
+ /** @var \Apigee\Edge\Api\Management\Controller\AttributesAwareEntityControllerInterface $controller */
+ $controller = $this->entityController();
+ /** @var \Apigee\Edge\Structure\AttributesProperty $attributesProperty */
+ $attributesProperty = $controller->getAttributes($entityId);
+ $attributes = $attributesProperty->values();
+ $this->assertNotEmpty($attributes);
+ $this->assertArrayHasKey('name1', $attributes);
+ $this->assertArrayHasKey('name2', $attributes);
+ $this->assertEquals('value1', $attributes['name1']);
+ $this->assertEquals('value2', $attributes['name2']);
+ }
+
+ /**
+ * @depends testAddAttributesToEntity
+ *
+ * @param string $entityId
+ */
+ public function testGetAttribute(string $entityId): void
+ {
+ /** @var \Apigee\Edge\Api\Management\Controller\AttributesAwareEntityControllerInterface $controller */
+ $controller = $this->entityController();
+ $value = $controller->getAttribute($entityId, 'name1');
+ $this->assertEquals('value1', $value);
+ }
+
+ /**
+ * @depends testAddAttributesToEntity
+ *
+ * @param string $entityId
+ *
+ * @return string
+ */
+ public function testUpdateAttribute(string $entityId): string
+ {
+ /** @var \Apigee\Edge\Api\Management\Controller\AttributesAwareEntityControllerInterface $controller */
+ $controller = $this->entityController();
+ $expected = 'value1-edited';
+ $value = $controller->updateAttribute($entityId, 'name1', $expected);
+ $this->assertEquals($expected, $value);
+
+ return $entityId;
+ }
+
+ /**
+ * @depends testUpdateAttribute
+ *
+ * @group online
+ *
+ * @param string $entityId
+ */
+ public function testDeleteAttribute(string $entityId): void
+ {
+ static::markOnlineTestSkipped(__FUNCTION__);
+ /** @var \Apigee\Edge\Api\Management\Controller\AttributesAwareEntityControllerInterface $controller */
+ $controller = $this->entityController();
+ $attribute = 'name1';
+ $controller->deleteAttribute($entityId, $attribute);
+ try {
+ $controller->getAttribute($entityId, $attribute);
+ } catch (ApiResponseException $e) {
+ $this->assertEquals('organizations.keymanagement.AttributeDoesntExist', $e->getEdgeErrorCode());
+ }
+ }
+}
diff --git a/tests/Api/ApigeeX/Controller/BillingTypeControllerTestBase.php b/tests/Api/ApigeeX/Controller/BillingTypeControllerTestBase.php
index d77e83be3..0437c47aa 100644
--- a/tests/Api/ApigeeX/Controller/BillingTypeControllerTestBase.php
+++ b/tests/Api/ApigeeX/Controller/BillingTypeControllerTestBase.php
@@ -32,7 +32,7 @@ public function testGetAllBillingDetails(): void
$controller = static::entityController();
$ratePlans = $controller->getAllBillingDetails();
$input = json_decode((string) static::defaultAPIClient()->getJournal()->getLastResponse()->getBody());
- $this->entitySerializerValidator()->validate($input, $ratePlans);
+ $this->entitySerializerValidator()->validate($input, $ratePlans);
}
public function testUpdateBillingType(): void
diff --git a/tests/Api/ApigeeX/Controller/DeveloperAcceptedRatePlanControllerTest.php b/tests/Api/ApigeeX/Controller/DeveloperAcceptedRatePlanControllerTest.php
index 17668cdbb..c849377f6 100644
--- a/tests/Api/ApigeeX/Controller/DeveloperAcceptedRatePlanControllerTest.php
+++ b/tests/Api/ApigeeX/Controller/DeveloperAcceptedRatePlanControllerTest.php
@@ -41,7 +41,7 @@ class DeveloperAcceptedRatePlanControllerTest extends AcceptedRatePlanController
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/ApigeeX/Controller/DeveloperBillingTypeControllerTest.php b/tests/Api/ApigeeX/Controller/DeveloperBillingTypeControllerTest.php
index 79dc43dd9..bdb66faa5 100644
--- a/tests/Api/ApigeeX/Controller/DeveloperBillingTypeControllerTest.php
+++ b/tests/Api/ApigeeX/Controller/DeveloperBillingTypeControllerTest.php
@@ -36,7 +36,7 @@ class DeveloperBillingTypeControllerTest extends BillingTypeControllerTestBase
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/ApigeeX/Controller/DeveloperPrepaidBalanceControllerTest.php b/tests/Api/ApigeeX/Controller/DeveloperPrepaidBalanceControllerTest.php
index 5eeed1b46..24a297dae 100644
--- a/tests/Api/ApigeeX/Controller/DeveloperPrepaidBalanceControllerTest.php
+++ b/tests/Api/ApigeeX/Controller/DeveloperPrepaidBalanceControllerTest.php
@@ -36,7 +36,7 @@ class DeveloperPrepaidBalanceControllerTest extends PrepaidBalanceControllerTest
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/ApigeeX/Controller/EntityLoadOperationControllerTestTrait.php b/tests/Api/ApigeeX/Controller/EntityLoadOperationControllerTestTrait.php
index 541a390ee..aac702605 100644
--- a/tests/Api/ApigeeX/Controller/EntityLoadOperationControllerTestTrait.php
+++ b/tests/Api/ApigeeX/Controller/EntityLoadOperationControllerTestTrait.php
@@ -21,6 +21,7 @@
use Apigee\Edge\Entity\EntityInterface;
use Apigee\Edge\Tests\Test\Controller\DefaultAPIClientAwareTrait;
use Apigee\Edge\Tests\Test\Controller\EntityLoadOperationControllerTestTrait as BaseEntityLoadOperationControllerTestTrait;
+use stdClass;
/**
* Monetization API version of EntityLoadOperationControllerTestTrait.
@@ -47,7 +48,22 @@ public function testLoad($created = null): EntityInterface
return $entity;
}
- protected function alterObjectsBeforeCompareExpectedAndLoadedEntity(\stdClass &$expectedAsObject, EntityInterface $loaded): void
+ protected function validateLoadedEntity(EntityInterface $expected, EntityInterface $actual): void
+ {
+ // Tricky Management API does not return "description" property
+ // if it is not set in create but it returns an empty string when
+ // it gets loaded.
+ if ($expected instanceof DescriptionPropertyInterface && $actual instanceof DescriptionPropertyInterface && null !== $actual->getDescription()) {
+ $expected->setDescription($actual->getDescription());
+ }
+ $expected->setCreatedAt($actual->getCreatedAt());
+ $expectedAsObject = json_decode($this->entitySerializer()->serialize($expected, 'json'));
+
+ // Validate that we got back the same object as we created.
+ $this->entitySerializerValidator()->validate($expectedAsObject, $actual);
+ }
+
+ protected function alterObjectsBeforeCompareExpectedAndLoadedEntity(stdClass &$expectedAsObject, EntityInterface $loaded): void
{
// The serialized version of the created (actual) would not be the
// same as the loaded entity, because entity reference properties
diff --git a/tests/Api/ApigeeX/Controller/EntityUpdateOperationControllerTestTrait.php b/tests/Api/ApigeeX/Controller/EntityUpdateOperationControllerTestTrait.php
new file mode 100644
index 000000000..662219ea9
--- /dev/null
+++ b/tests/Api/ApigeeX/Controller/EntityUpdateOperationControllerTestTrait.php
@@ -0,0 +1,100 @@
+entityForUpdateTest($existing);
+ $original = clone $entity;
+ static::controllerForEntityUpdate()->update($entity);
+ $this->validateUpdatedEntity($entity, $original);
+
+ return $entity;
+ }
+
+ protected function validateUpdatedEntity(EntityInterface $updated, EntityInterface $original): void
+ {
+ // Validate we get back the same values as we sent.
+ $sentAsArray = json_decode((string) static::defaultAPIClient()->getJournal()->getLastRequest()->getBody(), true);
+ $responsePayload = (string) static::defaultAPIClient()->getJournal()->getLastResponse()->getBody();
+ // We do not store milliseconds so these values should not be equal
+ // anyway.
+ unset($sentAsArray['createdAt']);
+ unset($sentAsArray['lastModifiedAt']);
+ $responseAsArray = json_decode($responsePayload, true);
+ $this->alterArraysBeforeCompareSentAndReceivedPayloadsInUpdate($sentAsArray, $responseAsArray);
+ Assert::assertArraySubset($sentAsArray, $responseAsArray);
+
+ // Validate that the PHP Client could parse all information from the
+ // API response.
+ $responseObject = json_decode($responsePayload);
+ $this->alterObjectsBeforeCompareResponseAndUpdateEntity($responseObject, $updated);
+ $this->entitySerializerValidator()->validate($responseObject, $updated);
+ }
+
+ abstract protected function entityForUpdateTest(EntityInterface $existing): EntityInterface;
+
+ protected function alterArraysBeforeCompareSentAndReceivedPayloadsInUpdate(array &$sentEntityAsArray, array $responseEntityAsArray): void
+ {
+ }
+
+ protected function alterObjectsBeforeCompareResponseAndUpdateEntity(stdClass &$responseObject, EntityInterface $created): void
+ {
+ }
+
+ /**
+ * Controller for entity update operation testing.
+ *
+ * @return EntityUpdateOperationControllerTesterInterface
+ */
+ protected static function controllerForEntityUpdate(): EntityUpdateOperationControllerTesterInterface
+ {
+ /** @var \Apigee\Edge\Controller\EntityUpdateOperationControllerInterface $controller */
+ $controller = static::entityController();
+
+ return new EntityUpdateOperationControllerTester($controller);
+ }
+}
diff --git a/tests/Api/ApigeeX/Controller/PaginatedEntityListingControllerTestTrait.php b/tests/Api/ApigeeX/Controller/PaginatedEntityListingControllerTestTrait.php
new file mode 100644
index 000000000..36a8f08a5
--- /dev/null
+++ b/tests/Api/ApigeeX/Controller/PaginatedEntityListingControllerTestTrait.php
@@ -0,0 +1,118 @@
+entityIdPrefixForPaginatedEntityListingTest();
+ if (TestClientFactory::isOfflineClient(static::defaultAPIClient())) {
+ $created = $this->controllerForPaginatedEntityListing()->getEntities();
+ } else {
+ $created = $this->setupForPaginatedEntityListingTest($randomPrefix);
+ }
+ $entities = $this->controllerForPaginatedEntityListing()->getEntities();
+ // We created 5 entities so at least 5 entities should be returned.
+ Assert::assertTrue(count($entities) >= count($created));
+ }
+
+ /**
+ * @depends testPaginatedAllEntityListing
+ *
+ * Not necessary to depend on this test, but if that fails this one should
+ * fail as well.
+ */
+ public function testPaginatedEntityListing(): void
+ {
+ $randomPrefix = $this->entityIdPrefixForPaginatedEntityListingTest();
+ if (TestClientFactory::isOfflineClient(static::defaultAPIClient())) {
+ $entities = $this->controllerForPaginatedEntityListing()->getEntities();
+ } else {
+ $entities = $this->setupForPaginatedEntityListingTest($randomPrefix);
+ }
+ /** @var \Apigee\Edge\Entity\EntityInterface[] $tmp */
+ $tmp = $entities;
+ // Get the 4th item from the list.
+ array_shift($tmp);
+ array_shift($tmp);
+ array_shift($tmp);
+ $entityId = $this->entityIdShouldBeUsedInPagination(array_shift($tmp));
+ $limit = 2;
+ $pager = $this->controllerForPaginatedEntityListing()->createPager($limit, $entityId);
+ $result = $this->controllerForPaginatedEntityListing()->getEntities($pager);
+ $this->validatePaginatedEntityListingResult($limit, $entityId, $result, $entities);
+ }
+
+ /**
+ * @param int $limit
+ * @param string $pageToken
+ * @param \Apigee\Edge\Entity\EntityInterface[] $result
+ * @param \Apigee\Edge\Entity\EntityInterface[] $entities
+ */
+ protected function validatePaginatedEntityListingResult(int $limit, string $pageToken, array $result, array $entities): void
+ {
+ /** @var \Apigee\Edge\Entity\EntityInterface $firstInResult */
+ $firstInResult = reset($result);
+ Assert::assertEquals($pageToken, $this->entityIdShouldBeUsedInPagination($firstInResult));
+ Assert::assertEquals($entities[$this->entityIdShouldBeUsedInPagination($firstInResult)], $firstInResult);
+ Assert::assertCount($limit, $result);
+ }
+
+ /**
+ * @param string $entityIdPrefix
+ * Random entity id prefix for this test.
+ *
+ * @return string[]
+ */
+ abstract protected function setupForPaginatedEntityListingTest(string $entityIdPrefix): array;
+
+ abstract protected function entityIdPrefixForPaginatedEntityListingTest(): string;
+
+ /**
+ * Controller for paginated entity listing operation testing.
+ *
+ * @return EntityControllerTesterInterface|PaginatedEntityListingControllerInterface
+ */
+ protected static function controllerForPaginatedEntityListing(): EntityControllerTesterInterface
+ {
+ $controller = static::entityController();
+
+ if ($controller->instanceOf(PaginatedEntityListingControllerInterface::class)) {
+ throw new InvalidArgumentException('Controller must implements PaginatedEntityListingControllerInterface.');
+ }
+
+ return $controller;
+ }
+}
diff --git a/tests/Api/ApigeeX/Controller/PaginatedEntityListingControllerTestTraitBase.php b/tests/Api/ApigeeX/Controller/PaginatedEntityListingControllerTestTraitBase.php
new file mode 100644
index 000000000..6e025ff37
--- /dev/null
+++ b/tests/Api/ApigeeX/Controller/PaginatedEntityListingControllerTestTraitBase.php
@@ -0,0 +1,88 @@
+{$setter}($entityIdPrefix . '_' . $entity->id());
+ $this->entityCreateOperationTestController()->create($entity);
+ // Use the proper id as key in the returned array.
+ $entities[$entityIdPrefix][$this->entityIdShouldBeUsedInPagination($entity)] = $entity;
+ }
+ }
+
+ return $entities[$entityIdPrefix];
+ }
+
+ /**
+ * Some entities have multiple primary (rather say unique) ids at a time.
+ *
+ * This helper function allows to choose the best one for pagination
+ * testing.
+ *
+ * @param EntityInterface $entity
+ *
+ * @return string
+ */
+ protected function entityIdShouldBeUsedInPagination(EntityInterface $entity): string
+ {
+ return $entity->id();
+ }
+
+ /**
+ * Returns the same random prefix for paginated entity tests.
+ *
+ * @return string
+ */
+ protected function entityIdPrefixForPaginatedEntityListingTest(): string
+ {
+ static $randomPrefix;
+ if (null === $randomPrefix) {
+ $randomPrefix = static::randomGenerator()->number();
+ }
+
+ return $randomPrefix;
+ }
+}
diff --git a/tests/Api/ApigeeX/Controller/PrepaidBalanceControllerTestBase.php b/tests/Api/ApigeeX/Controller/PrepaidBalanceControllerTestBase.php
index adb0221a5..9689119e6 100644
--- a/tests/Api/ApigeeX/Controller/PrepaidBalanceControllerTestBase.php
+++ b/tests/Api/ApigeeX/Controller/PrepaidBalanceControllerTestBase.php
@@ -22,6 +22,7 @@
use Apigee\Edge\Tests\Test\Controller\MockClientAwareTrait;
use Apigee\Edge\Tests\Test\EntitySerializer\EntitySerializerValidatorInterface;
use GuzzleHttp\Psr7\Response;
+use ReflectionObject;
/**
* Base class for developer prepaid balance tests.
@@ -87,10 +88,10 @@ public function testGetPrepaidBalance(): void
$json = reset($json);
$i = 0;
// We need to prepaid balance serializer from the controller.
- $ro = new \ReflectionObject(static::entityController());
+ $ro = new ReflectionObject(static::entityController());
$property = $ro->getProperty('decorated');
$property->setAccessible(true);
- $ro = new \ReflectionObject($property->getValue(static::entityController()));
+ $ro = new ReflectionObject($property->getValue(static::entityController()));
$rp = $ro->getProperty('prepaidBalanceSerializer');
$rp->setAccessible(true);
$validator = new PrepaidBalanceSerializerValidator($rp->getValue($property->getValue(static::entityController())));
diff --git a/tests/Api/ApigeeX/Controller/RatePlanControllerTest.php b/tests/Api/ApigeeX/Controller/RatePlanControllerTest.php
index bcd1944f0..3906c2b05 100644
--- a/tests/Api/ApigeeX/Controller/RatePlanControllerTest.php
+++ b/tests/Api/ApigeeX/Controller/RatePlanControllerTest.php
@@ -25,10 +25,9 @@
use Apigee\Edge\Tests\Api\ApigeeX\EntitySerializer\RatePlanSerializerValidator;
use Apigee\Edge\Tests\Test\Controller\EntityControllerTester;
use Apigee\Edge\Tests\Test\Controller\EntityControllerTesterInterface;
+use Apigee\Edge\Tests\Test\Controller\EntityLoadOperationControllerTestTrait;
use Apigee\Edge\Tests\Test\Controller\MockClientAwareTrait;
use Apigee\Edge\Tests\Test\EntitySerializer\EntitySerializerValidatorInterface;
-use Apigee\Edge\Tests\Test\HttpClient\FileSystemResponseFactory;
-use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
/**
@@ -51,7 +50,7 @@ public function testLoad(): void
{
$ids = [
// Standard rate plan for ApigeeX.
- 'standard' => [StandardRatePlanInterface::class]
+ 'standard' => [StandardRatePlanInterface::class],
];
foreach ($ids as $id => $expectedClasses) {
@@ -89,7 +88,7 @@ protected function entitySerializerValidator(): EntitySerializerValidatorInterfa
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/ApigeeX/Controller/SupportedCurrencyControllerTest.php b/tests/Api/ApigeeX/Controller/SupportedCurrencyControllerTest.php
index ba56c477b..0584fa8e3 100644
--- a/tests/Api/ApigeeX/Controller/SupportedCurrencyControllerTest.php
+++ b/tests/Api/ApigeeX/Controller/SupportedCurrencyControllerTest.php
@@ -42,7 +42,7 @@ public function testGetEntities(): void
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/ApigeeX/Entity/AppGroupAppTestEntityProviderTrait.php b/tests/Api/ApigeeX/Entity/AppGroupAppTestEntityProviderTrait.php
new file mode 100644
index 000000000..3f3f7c543
--- /dev/null
+++ b/tests/Api/ApigeeX/Entity/AppGroupAppTestEntityProviderTrait.php
@@ -0,0 +1,56 @@
+ $randomData ? static::randomGenerator()->machineName() : 'phpunit_test_app',
+ 'apiProducts' => $apiProducts,
+ 'callbackUrl' => 'http://example.com',
+ ]);
+ $entity->setDisplayName($randomData ? static::randomGenerator()->displayName() : 'PHP Unit: Test app');
+ $entity->setDescription($randomData ? static::randomGenerator()->text() : 'This is a test app created by PHP Unit.');
+ // We have to use this trick to ensure the order of the attributes is
+ // the same as Apigee Edge returns.
+ $entity->setAttributes(new AttributesProperty(['DisplayName' => $entity->getDisplayName(), 'Notes' => $entity->getDescription(), 'foo' => 'bar']));
+
+ return $entity;
+ }
+
+ protected static function getUpdatedAppGroupApp(AppGroupAppInterface $existing, bool $randomData = true): AppGroupAppInterface
+ {
+ $updated = clone $existing;
+ $updated->setCallbackUrl('http://foo.example.com');
+ $updated->setAttributes(new AttributesProperty(['foo' => 'foo', 'bar' => 'baz']));
+ $updated->setDisplayName($randomData ? static::randomGenerator()->displayName() : '(Edited) PHP Unit: Test app');
+ $updated->setDescription($randomData ? static::randomGenerator()->text() : '(Edited) This is a test app created by PHP Unit.');
+
+ return $updated;
+ }
+}
diff --git a/tests/Api/ApigeeX/Entity/AppGroupTestEntityProviderTrait.php b/tests/Api/ApigeeX/Entity/AppGroupTestEntityProviderTrait.php
new file mode 100644
index 000000000..1844d27c7
--- /dev/null
+++ b/tests/Api/ApigeeX/Entity/AppGroupTestEntityProviderTrait.php
@@ -0,0 +1,49 @@
+ $randomData ? static::randomGenerator()->machineName() : 'phpunit',
+ 'displayName' => $randomData ? static::randomGenerator()->displayName() : 'A PHPUnit appgroup',
+ 'attributes' => new AttributesProperty(['foo' => 'bar']),
+ ]);
+
+ return $entity;
+ }
+
+ protected static function getUpdatedAppGroup(AppGroupInterface $existing, bool $randomData = true): AppGroupInterface
+ {
+ $updated = clone $existing;
+ $updated->setDisplayName($randomData ? static::randomGenerator()->displayName() : '(Edited) A PHPUnit appgroup');
+ $updated->setAttributes(new AttributesProperty(['foo' => 'foo', 'bar' => 'baz']));
+
+ return $updated;
+ }
+}
diff --git a/tests/Api/ApigeeX/EntitySerializer/AcceptedRatePlanSerializerValidator.php b/tests/Api/ApigeeX/EntitySerializer/AcceptedRatePlanSerializerValidator.php
index bf19af756..adcc9b814 100644
--- a/tests/Api/ApigeeX/EntitySerializer/AcceptedRatePlanSerializerValidator.php
+++ b/tests/Api/ApigeeX/EntitySerializer/AcceptedRatePlanSerializerValidator.php
@@ -27,10 +27,10 @@ class AcceptedRatePlanSerializerValidator extends EntitySerializerValidator
/**
* AcceptedRatePlanSerializerValidator constructor.
*
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface $serializer
+ * @param EntitySerializerInterface $serializer
* @param array $propertyValidators
*/
- public function __construct(EntitySerializerInterface $serializer = null, array $propertyValidators = [])
+ public function __construct(?EntitySerializerInterface $serializer = null, array $propertyValidators = [])
{
$propertyValidators = array_merge($propertyValidators, [
new RatePlanEntityReferencePropertyValidator(),
diff --git a/tests/Api/ApigeeX/EntitySerializer/ApiPackageSerializerValidator.php b/tests/Api/ApigeeX/EntitySerializer/ApiPackageSerializerValidator.php
index 72673ae61..0bbc1a810 100644
--- a/tests/Api/ApigeeX/EntitySerializer/ApiPackageSerializerValidator.php
+++ b/tests/Api/ApigeeX/EntitySerializer/ApiPackageSerializerValidator.php
@@ -27,10 +27,10 @@ class ApiPackageSerializerValidator extends EntitySerializerValidator
/**
* ApiPackageSerializerValidator constructor.
*
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface $serializer
+ * @param EntitySerializerInterface $serializer
* @param array $propertyValidators
*/
- public function __construct(EntitySerializerInterface $serializer = null, array $propertyValidators = [])
+ public function __construct(?EntitySerializerInterface $serializer = null, array $propertyValidators = [])
{
$propertyValidators = array_merge($propertyValidators, [
new ApiProductsPropertyValidator(),
diff --git a/tests/Api/ApigeeX/EntitySerializer/BillingTypeSerializerValidator.php b/tests/Api/ApigeeX/EntitySerializer/BillingTypeSerializerValidator.php
index 707135b6d..8c0ac46ac 100644
--- a/tests/Api/ApigeeX/EntitySerializer/BillingTypeSerializerValidator.php
+++ b/tests/Api/ApigeeX/EntitySerializer/BillingTypeSerializerValidator.php
@@ -27,10 +27,10 @@ class BillingTypeSerializerValidator extends EntitySerializerValidator
/**
* BillingTypeSerializerValidator constructor.
*
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface $serializer
+ * @param EntitySerializerInterface $serializer
* @param array $propertyValidators
*/
- public function __construct(EntitySerializerInterface $serializer = null, array $propertyValidators = [])
+ public function __construct(?EntitySerializerInterface $serializer = null, array $propertyValidators = [])
{
$propertyValidators = array_merge($propertyValidators, [
new BillingTypeEntityReferencePropertyValidator(),
diff --git a/tests/Api/ApigeeX/EntitySerializer/OrganizationAwareEntitySerializerValidator.php b/tests/Api/ApigeeX/EntitySerializer/OrganizationAwareEntitySerializerValidator.php
index 29079990b..963483ddd 100644
--- a/tests/Api/ApigeeX/EntitySerializer/OrganizationAwareEntitySerializerValidator.php
+++ b/tests/Api/ApigeeX/EntitySerializer/OrganizationAwareEntitySerializerValidator.php
@@ -27,10 +27,10 @@ class OrganizationAwareEntitySerializerValidator extends EntitySerializerValidat
/**
* OrganizationAwareEntitySerializerValidator constructor.
*
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $serializer
+ * @param EntitySerializerInterface|null $serializer
* @param array $propertyValidators
*/
- public function __construct(EntitySerializerInterface $serializer = null, array $propertyValidators = [])
+ public function __construct(?EntitySerializerInterface $serializer = null, array $propertyValidators = [])
{
$propertyValidators = array_merge($propertyValidators, [
new OrganizationProfileEntityReferencePropertyValidator(),
diff --git a/tests/Api/ApigeeX/EntitySerializer/PrepaidBalanceSerializerValidator.php b/tests/Api/ApigeeX/EntitySerializer/PrepaidBalanceSerializerValidator.php
index 24ffe1299..2f84f6072 100644
--- a/tests/Api/ApigeeX/EntitySerializer/PrepaidBalanceSerializerValidator.php
+++ b/tests/Api/ApigeeX/EntitySerializer/PrepaidBalanceSerializerValidator.php
@@ -27,10 +27,10 @@ class PrepaidBalanceSerializerValidator extends EntitySerializerValidator
/**
* PrepaidBalanceSerializerValidator constructor.
*
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface $serializer
+ * @param EntitySerializerInterface $serializer
* @param array $propertyValidators
*/
- public function __construct(EntitySerializerInterface $serializer = null, array $propertyValidators = [])
+ public function __construct(?EntitySerializerInterface $serializer = null, array $propertyValidators = [])
{
$propertyValidators = array_merge($propertyValidators, [
new OrganizationProfileEntityReferencePropertyValidator(),
diff --git a/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/ApiPackageEntityReferencePropertyValidator.php b/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/ApiPackageEntityReferencePropertyValidator.php
index 46030f430..50dedcedd 100644
--- a/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/ApiPackageEntityReferencePropertyValidator.php
+++ b/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/ApiPackageEntityReferencePropertyValidator.php
@@ -25,6 +25,7 @@
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\RemoveIfPropertyValidPropertyValidatorInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use stdClass;
class ApiPackageEntityReferencePropertyValidator implements RemoveIfPropertyValidPropertyValidatorInterface, \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface
{
@@ -45,7 +46,7 @@ public function __construct()
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
// At this moment only rate plans contain entity references.
if (!$entity instanceof RatePlanInterface) {
diff --git a/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/ApiProductsPropertyValidator.php b/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/ApiProductsPropertyValidator.php
index a5523c011..6a0839d2e 100644
--- a/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/ApiProductsPropertyValidator.php
+++ b/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/ApiProductsPropertyValidator.php
@@ -26,6 +26,7 @@
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use stdClass;
class ApiProductsPropertyValidator implements RemoveIfPropertyValidPropertyValidatorInterface, SerializerAwarePropertyValidatorInterface, PropertyValidatorsAwareValidatorInterface
{
@@ -35,7 +36,7 @@ class ApiProductsPropertyValidator implements RemoveIfPropertyValidPropertyValid
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
if (!$entity instanceof ApiProductPropertyInterface) {
return;
diff --git a/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/BillingTypeEntityReferencePropertyValidator.php b/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/BillingTypeEntityReferencePropertyValidator.php
index b6790279d..426d5e189 100644
--- a/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/BillingTypeEntityReferencePropertyValidator.php
+++ b/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/BillingTypeEntityReferencePropertyValidator.php
@@ -23,6 +23,7 @@
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\RemoveIfPropertyValidPropertyValidatorInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use stdClass;
class BillingTypeEntityReferencePropertyValidator implements RemoveIfPropertyValidPropertyValidatorInterface, \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface
{
@@ -31,7 +32,7 @@ class BillingTypeEntityReferencePropertyValidator implements RemoveIfPropertyVal
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
if (!$entity instanceof BillingTypeInterface) {
return;
diff --git a/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/OrganizationProfileEntityReferencePropertyValidator.php b/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/OrganizationProfileEntityReferencePropertyValidator.php
index 7f9c41be4..e6dac588f 100644
--- a/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/OrganizationProfileEntityReferencePropertyValidator.php
+++ b/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/OrganizationProfileEntityReferencePropertyValidator.php
@@ -23,6 +23,7 @@
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\RemoveIfPropertyValidPropertyValidatorInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use stdClass;
class OrganizationProfileEntityReferencePropertyValidator implements RemoveIfPropertyValidPropertyValidatorInterface, \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface
{
@@ -31,7 +32,7 @@ class OrganizationProfileEntityReferencePropertyValidator implements RemoveIfPro
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
if (!$entity instanceof OrganizationPropertyInterface) {
return;
diff --git a/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/ParentRatePlanEntityReferencePropertyValidator.php b/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/ParentRatePlanEntityReferencePropertyValidator.php
index 3fda3a857..cb7ccc9b2 100644
--- a/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/ParentRatePlanEntityReferencePropertyValidator.php
+++ b/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/ParentRatePlanEntityReferencePropertyValidator.php
@@ -22,6 +22,7 @@
use Apigee\Edge\Entity\EntityInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use stdClass;
class ParentRatePlanEntityReferencePropertyValidator implements \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\RemoveIfPropertyValidPropertyValidatorInterface, \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface
{
@@ -30,7 +31,7 @@ class ParentRatePlanEntityReferencePropertyValidator implements \Apigee\Edge\Tes
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
if (!$entity instanceof RatePlanRevisionInterface) {
return;
diff --git a/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/RatePlanDetailsPropertyValidator.php b/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/RatePlanDetailsPropertyValidator.php
index 98caac13e..235767bed 100644
--- a/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/RatePlanDetailsPropertyValidator.php
+++ b/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/RatePlanDetailsPropertyValidator.php
@@ -23,6 +23,7 @@
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\PropertyValidatorInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use stdClass;
class RatePlanDetailsPropertyValidator implements PropertyValidatorInterface, \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface
{
@@ -30,7 +31,7 @@ class RatePlanDetailsPropertyValidator implements PropertyValidatorInterface, \A
setEntitySerializer as private traitSetEntitySerializer;
}
- /** @var \Apigee\Edge\Tests\Api\ApigeeX\EntitySerializer\PropertyValidator\OrganizationProfileEntityReferencePropertyValidator */
+ /** @var OrganizationProfileEntityReferencePropertyValidator */
protected $orgPropValidator;
/**
@@ -44,7 +45,7 @@ public function __construct()
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
if (!$entity instanceof RatePlanInterface) {
return;
diff --git a/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/RatePlanEntityReferencePropertyValidator.php b/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/RatePlanEntityReferencePropertyValidator.php
index 07d13d23b..53700b087 100644
--- a/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/RatePlanEntityReferencePropertyValidator.php
+++ b/tests/Api/ApigeeX/EntitySerializer/PropertyValidator/RatePlanEntityReferencePropertyValidator.php
@@ -24,6 +24,7 @@
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\RemoveIfPropertyValidPropertyValidatorInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use stdClass;
class RatePlanEntityReferencePropertyValidator implements RemoveIfPropertyValidPropertyValidatorInterface, \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface
{
@@ -44,7 +45,7 @@ public function __construct()
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
if (!$entity instanceof AcceptedRatePlanInterface) {
return;
diff --git a/tests/Api/ApigeeX/EntitySerializer/RatePlanSerializerValidator.php b/tests/Api/ApigeeX/EntitySerializer/RatePlanSerializerValidator.php
index 34ca6fb40..5b7a2788b 100644
--- a/tests/Api/ApigeeX/EntitySerializer/RatePlanSerializerValidator.php
+++ b/tests/Api/ApigeeX/EntitySerializer/RatePlanSerializerValidator.php
@@ -21,25 +21,26 @@
use Apigee\Edge\Api\ApigeeX\Entity\RatePlanRevisionInterface;
use Apigee\Edge\Entity\EntityInterface;
use Apigee\Edge\Serializer\EntitySerializerInterface;
-use Apigee\Edge\Tests\Test\EntitySerializer\EntitySerializerValidator;
use Apigee\Edge\Tests\Api\ApigeeX\EntitySerializer\PropertyValidator\ApiPackageEntityReferencePropertyValidator;
use Apigee\Edge\Tests\Api\ApigeeX\EntitySerializer\PropertyValidator\ParentRatePlanEntityReferencePropertyValidator;
use Apigee\Edge\Tests\Api\ApigeeX\EntitySerializer\PropertyValidator\RatePlanDetailsPropertyValidator;
+use Apigee\Edge\Tests\Test\EntitySerializer\EntitySerializerValidator;
+use stdClass;
class RatePlanSerializerValidator extends EntitySerializerValidator
{
/**
* RatePlanSerializerValidator constructor.
*
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface $serializer
+ * @param EntitySerializerInterface $serializer
* @param array $propertyValidators
*/
- public function __construct(EntitySerializerInterface $serializer = null, array $propertyValidators = [])
+ public function __construct(?EntitySerializerInterface $serializer = null, array $propertyValidators = [])
{
$propertyValidators = array_merge($propertyValidators, [
- //new CurrencyEntityReferencePropertyValidator(),
+ // new CurrencyEntityReferencePropertyValidator(),
new ApiPackageEntityReferencePropertyValidator(),
- new RatePlanDetailsPropertyValidator()
+ new RatePlanDetailsPropertyValidator(),
]);
parent::__construct($serializer, $propertyValidators);
}
@@ -47,7 +48,7 @@ public function __construct(EntitySerializerInterface $serializer = null, array
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, EntityInterface $entity): void
+ public function validate(stdClass $input, EntityInterface $entity): void
{
/* @var \Apigee\Edge\Api\ApigeeX\Entity\StandardRatePlanInterface $entity */
if ($entity instanceof RatePlanRevisionInterface) {
diff --git a/tests/Api/Management/Controller/ApiProductControllerAwareTestTrait.php b/tests/Api/Management/Controller/ApiProductControllerAwareTestTrait.php
index 7c89aa52d..9e70b58af 100644
--- a/tests/Api/Management/Controller/ApiProductControllerAwareTestTrait.php
+++ b/tests/Api/Management/Controller/ApiProductControllerAwareTestTrait.php
@@ -27,15 +27,15 @@
trait ApiProductControllerAwareTestTrait
{
- use DefaultTestOrganizationAwareTrait;
+ use defaultTestOrganizationAwareTrait;
use DefaultAPIClientAwareTrait;
/**
- * @param \Apigee\Edge\ClientInterface|null $client
+ * @param ClientInterface|null $client
*
- * @return \Apigee\Edge\Tests\Test\Controller\EntityControllerTesterInterface|\Apigee\Edge\Api\Management\Controller\ApiProductControllerInterface
+ * @return EntityControllerTesterInterface|\Apigee\Edge\Api\Management\Controller\ApiProductControllerInterface
*/
- protected static function apiProductController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function apiProductController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Management/Controller/ApiProductControllerTest.php b/tests/Api/Management/Controller/ApiProductControllerTest.php
index 2feb6902f..1ca142f29 100644
--- a/tests/Api/Management/Controller/ApiProductControllerTest.php
+++ b/tests/Api/Management/Controller/ApiProductControllerTest.php
@@ -65,7 +65,7 @@ public function testSearchByAttribute(): void
$expectedEntityId = 'phpunit_test';
$unexpectedId = 'should_not_appear';
} else {
- /** @var \Apigee\Edge\Api\Management\Entity\ApiProductInterface $unexpectedEntity */
+ /** @var ApiProductInterface $unexpectedEntity */
$unexpectedEntity = static::getNewEntity();
$unexpectedEntity->setAttribute('foo', 'foo');
// Use the same controller as the entity create test uses because
@@ -73,7 +73,7 @@ public function testSearchByAttribute(): void
// returns.
static::controllerForEntityCreate()->create($unexpectedEntity);
$unexpectedId = $unexpectedEntity->id();
- /** @var \Apigee\Edge\Api\Management\Entity\ApiProductInterface $expectedEntity */
+ /** @var ApiProductInterface $expectedEntity */
$expectedEntity = static::getNewEntity();
$expectedEntity->setAttribute('foo', 'bar');
static::controllerForEntityCreate()->create($expectedEntity);
@@ -88,7 +88,7 @@ public function testSearchByAttribute(): void
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
return static::apiProductController($client);
}
diff --git a/tests/Api/Management/Controller/AppControllerTest.php b/tests/Api/Management/Controller/AppControllerTest.php
index 69557e12d..32c5a91b1 100644
--- a/tests/Api/Management/Controller/AppControllerTest.php
+++ b/tests/Api/Management/Controller/AppControllerTest.php
@@ -57,16 +57,16 @@ class AppControllerTest extends EntityControllerTestBase
use DefaultTestOrganizationAwareTrait;
use MarkOnlineTestSkippedAwareTrait;
- /** @var \Apigee\Edge\Api\Management\Entity\DeveloperInterface */
+ /** @var DeveloperInterface */
protected static $testDeveloper;
- /** @var \Apigee\Edge\Api\Management\Entity\CompanyInterface */
+ /** @var CompanyInterface */
protected static $testCompany;
- /** @var \Apigee\Edge\Api\Management\Entity\DeveloperAppInterface */
+ /** @var DeveloperAppInterface */
protected static $testDeveloperApp;
- /** @var \Apigee\Edge\Api\Management\Entity\CompanyAppInterface */
+ /** @var CompanyAppInterface */
protected static $testCompanyApp;
/**
@@ -111,7 +111,7 @@ public function testListApps(): void
$this->assertEquals(static::$testDeveloperApp, $apps[static::$testDeveloperApp->getAppId()]);
$this->assertEquals(static::$testCompanyApp, $apps[static::$testCompanyApp->getAppId()]);
$apps = static::entityController()->listApps(false);
- /** @var \Apigee\Edge\Api\Management\Entity\AppInterface $firstApp */
+ /** @var AppInterface $firstApp */
$firstApp = reset($apps);
$this->assertEmpty($firstApp->getCredentials());
}
@@ -172,9 +172,9 @@ protected static function developerAppControllerDeveloperAppOwner(): DeveloperIn
/**
* {@inheritdoc}
*
- * @return \Apigee\Edge\Tests\Test\Controller\EntityControllerTesterInterface|\Apigee\Edge\Api\Management\Controller\AppControllerInterface
+ * @return EntityControllerTesterInterface|AppControllerInterface
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Management/Controller/AppControllerTestBase.php b/tests/Api/Management/Controller/AppControllerTestBase.php
index ee212f234..8bc1cd81f 100644
--- a/tests/Api/Management/Controller/AppControllerTestBase.php
+++ b/tests/Api/Management/Controller/AppControllerTestBase.php
@@ -31,6 +31,7 @@
use Apigee\Edge\Tests\Test\EntitySerializer\EntitySerializerValidatorInterface;
use Apigee\Edge\Tests\Test\TestClientFactory;
use PHPUnit\Framework\Assert;
+use stdClass;
/**
* Base class for developer- and company app controller tests.
@@ -113,7 +114,7 @@ protected function alterArraysBeforeCompareSentAndReceivedPayloadsInCreate(array
/**
* {@inheritdoc}
*/
- protected function alterObjectsBeforeCompareResponseAndCreatedEntity(\stdClass &$responseObject, EntityInterface $created): void
+ protected function alterObjectsBeforeCompareResponseAndCreatedEntity(stdClass &$responseObject, EntityInterface $created): void
{
/* @var \Apigee\Edge\Api\Management\Entity\DeveloperAppInterface $created */
$responseObject->appFamily = $created->getAppFamily();
@@ -133,7 +134,7 @@ protected function alterArraysBeforeCompareSentAndReceivedPayloadsInUpdate(array
/**
* {@inheritdoc}
*/
- protected function alterObjectsBeforeCompareResponseAndUpdateEntity(\stdClass &$responseObject, EntityInterface $created): void
+ protected function alterObjectsBeforeCompareResponseAndUpdateEntity(stdClass &$responseObject, EntityInterface $created): void
{
$this->alterObjectsBeforeCompareResponseAndCreatedEntity($responseObject, $created);
}
diff --git a/tests/Api/Management/Controller/AppCredentialControllerTestBase.php b/tests/Api/Management/Controller/AppCredentialControllerTestBase.php
index 584bc4133..da985404f 100644
--- a/tests/Api/Management/Controller/AppCredentialControllerTestBase.php
+++ b/tests/Api/Management/Controller/AppCredentialControllerTestBase.php
@@ -46,10 +46,10 @@ abstract class AppCredentialControllerTestBase extends EntityControllerTestBase
/** @var \Apigee\Edge\Api\Management\Entity\ApiProductInterface */
protected static $testApiProduct;
- /** @var \Apigee\Edge\Api\Management\Entity\AppOwnerInterface */
+ /** @var AppOwnerInterface */
protected static $testAppOwner;
- /** @var \Apigee\Edge\Api\Management\Entity\AppInterface */
+ /** @var AppInterface */
protected static $testApp;
/**
@@ -71,7 +71,7 @@ public function testCreatedAppHasAnEmptyCredential(): void
$entity = static::appByOwnerController()->load(static::$testApp->id());
$credentials = $entity->getCredentials();
$this->assertCount(1, $credentials);
- /** @var \Apigee\Edge\Api\Management\Entity\AppCredentialInterface $credential */
+ /** @var AppCredentialInterface $credential */
$credential = reset($credentials);
$this->assertCount(0, $credential->getApiProducts());
$this->assertNotEmpty($credential->getConsumerKey());
@@ -82,7 +82,7 @@ public function testCreatedAppHasAnEmptyCredential(): void
/**
* @depends testCreatedAppHasAnEmptyCredential
*
- * @return \Apigee\Edge\Api\Management\Entity\AppCredentialInterface
+ * @return AppCredentialInterface
*/
public function testCreate(): AppCredentialInterface
{
@@ -102,13 +102,13 @@ public function testCreate(): AppCredentialInterface
/**
* @depends testCreate
*
- * @param \Apigee\Edge\Api\Management\Entity\AppCredentialInterface $created
+ * @param AppCredentialInterface $created
*
* @return string
*/
public function testLoad(AppCredentialInterface $created)
{
- /** @var \Apigee\Edge\Api\Management\Entity\AppCredentialInterface $loaded */
+ /** @var AppCredentialInterface $loaded */
$loaded = static::entityController()->load($created->id());
$this->assertCount(count($loaded->getApiProducts()), $created->getApiProducts());
$this->assertEquals($created->getConsumerKey(), $loaded->getConsumerKey());
@@ -126,7 +126,7 @@ public function testLoad(AppCredentialInterface $created)
*/
public function testAddProducts(string $entityId): void
{
- /** @var \Apigee\Edge\Api\Management\Controller\AppCredentialControllerInterface $controller */
+ /** @var AppCredentialControllerInterface $controller */
$controller = $this->entityController();
$credential = $controller->addProducts($entityId, [static::$testApiProduct->id()]);
$productNames = $this->getCredentialProducts($credential);
@@ -140,9 +140,9 @@ public function testAddProducts(string $entityId): void
*/
public function testOverrideScopes(string $entityId): void
{
- /** @var \Apigee\Edge\Api\Management\Controller\AppCredentialControllerInterface $controller */
+ /** @var AppCredentialControllerInterface $controller */
$controller = $this->entityController();
- /** @var \Apigee\Edge\Api\Management\Entity\AppCredentialInterface $credential */
+ /** @var AppCredentialInterface $credential */
$credential = $controller->load($entityId);
$this->assertEmpty($credential->getScopes());
$credential = $controller->overrideScopes($entityId, ['scope 1']);
@@ -165,7 +165,7 @@ public function testOverrideScopes(string $entityId): void
public function testStatusChange(string $entityId): void
{
static::markOnlineTestSkipped(__FUNCTION__);
- /** @var \Apigee\Edge\Api\Management\Controller\AppCredentialControllerInterface $controller */
+ /** @var AppCredentialControllerInterface $controller */
$controller = static::entityController();
/* @var \Apigee\Edge\Api\Management\Entity\AppCredentialInterface $credential */
$controller->setStatus($entityId, AppCredentialControllerInterface::STATUS_REVOKE);
@@ -186,7 +186,7 @@ public function testStatusChange(string $entityId): void
public function testApiProductStatusChange(string $entityId): void
{
static::markOnlineTestSkipped(__FUNCTION__);
- /** @var \Apigee\Edge\Api\Management\Controller\AppCredentialControllerInterface $controller */
+ /** @var AppCredentialControllerInterface $controller */
$controller = static::entityController();
/* @var \Apigee\Edge\Api\Management\Entity\AppCredentialInterface $credential */
$controller->setApiProductStatus(
@@ -224,11 +224,11 @@ public function testApiProductStatusChange(string $entityId): void
public function testGenerate(): string
{
static::markOnlineTestSkipped(__FUNCTION__);
- /** @var \Apigee\Edge\Api\Management\Controller\AppCredentialControllerInterface $controller */
+ /** @var AppCredentialControllerInterface $controller */
$controller = $this->entityController();
- /** @var \Apigee\Edge\Api\Management\Entity\AppInterface $app */
+ /** @var AppInterface $app */
$app = static::appByOwnerController()->load(static::$testApp->id());
- /** @var \Apigee\Edge\Api\Management\Entity\AppCredentialInterface $credential */
+ /** @var AppCredentialInterface $credential */
$credential = $controller->generate(
[static::$testApiProduct->id()],
$app->getAttributes(),
@@ -243,10 +243,10 @@ public function testGenerate(): string
// Thanks for the offline tests, we can not expect a concrete value
// here.
$this->assertNotEquals('-1', $credential->getExpiresAt());
- /** @var \Apigee\Edge\Api\Management\Entity\AppInterface $updatedApp */
+ /** @var AppInterface $updatedApp */
$updatedApp = static::appByOwnerController()->load(static::$testApp->id());
// Credential generation should not deleted any previously existing app
- //credentials.
+ // credentials.
$this->assertEquals($app->getAttributes(), $updatedApp->getAttributes());
return $credential->id();
@@ -260,9 +260,9 @@ public function testGenerate(): string
public function testDeleteApiProduct(string $entityId): void
{
static::markOnlineTestSkipped(__FUNCTION__);
- /** @var \Apigee\Edge\Api\Management\Controller\AppCredentialControllerInterface $controller */
+ /** @var AppCredentialControllerInterface $controller */
$controller = static::entityController();
- /** @var \Apigee\Edge\Api\Management\Entity\AppCredentialInterface $credential */
+ /** @var AppCredentialInterface $credential */
$credential = $controller->load($entityId);
$productNames = $this->getCredentialProducts($credential);
$this->assertContains(static::$testApiProduct->id(), $productNames);
@@ -281,7 +281,7 @@ public function testDeleteApiProduct(string $entityId): void
*/
public function testAddAttributesToEntity(): string
{
- /** @var \Apigee\Edge\Api\Management\Entity\AppCredentialInterface $credential */
+ /** @var AppCredentialInterface $credential */
$credentials = static::$testApp->getCredentials();
$credential = reset($credentials);
/** @var \Apigee\Edge\Structure\AttributesProperty $attributes */
@@ -318,7 +318,7 @@ public function testDelete(): void
604800000
);
static::$testApp = static::appByOwnerController()->load(static::$testApp->id());
- /** @var \Apigee\Edge\Api\Management\Entity\AppCredentialInterface $loaded */
+ /* @var \Apigee\Edge\Api\Management\Entity\AppCredentialInterface $loaded */
static::entityController()->delete($newCredential->id());
static::$testApp = static::appByOwnerController()->load(static::$testApp->id());
$found = false;
@@ -335,7 +335,7 @@ abstract protected static function setupTestApp(AppOwnerInterface $appOwner): Ap
abstract protected static function setupTestAppOwner(): AppOwnerInterface;
/**
- * @return \Apigee\Edge\Tests\Test\Controller\EntityControllerTesterInterface|\Apigee\Edge\Api\Management\Controller\AppByOwnerControllerInterface
+ * @return EntityControllerTesterInterface|\Apigee\Edge\Api\Management\Controller\AppByOwnerControllerInterface
*/
abstract protected static function appByOwnerController(): EntityControllerTesterInterface;
diff --git a/tests/Api/Management/Controller/CompanyAppControllerAwareTestTrait.php b/tests/Api/Management/Controller/CompanyAppControllerAwareTestTrait.php
index 60216d53e..b1a8c27c2 100644
--- a/tests/Api/Management/Controller/CompanyAppControllerAwareTestTrait.php
+++ b/tests/Api/Management/Controller/CompanyAppControllerAwareTestTrait.php
@@ -32,11 +32,11 @@ trait CompanyAppControllerAwareTestTrait
use DefaultAPIClientAwareTrait;
/**
- * @param \Apigee\Edge\ClientInterface|null $client
+ * @param ClientInterface|null $client
*
- * @return \Apigee\Edge\Tests\Test\Controller\EntityControllerTesterInterface|\Apigee\Edge\Api\Management\Controller\CompanyAppControllerInterface
+ * @return EntityControllerTesterInterface|\Apigee\Edge\Api\Management\Controller\CompanyAppControllerInterface
*/
- protected static function companyAppController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function companyAppController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Management/Controller/CompanyAppControllerTest.php b/tests/Api/Management/Controller/CompanyAppControllerTest.php
index 0c5b2ebb9..d973039c6 100644
--- a/tests/Api/Management/Controller/CompanyAppControllerTest.php
+++ b/tests/Api/Management/Controller/CompanyAppControllerTest.php
@@ -41,7 +41,7 @@ class CompanyAppControllerTest extends AppControllerTestBase
use CompanyControllerAwareTestTrait;
use CompanyTestEntityProviderTrait;
- /** @var \Apigee\Edge\Api\Management\Entity\CompanyInterface */
+ /** @var CompanyInterface */
protected static $testCompany;
/**
@@ -57,7 +57,7 @@ public static function setUpBeforeClass(): void
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
return static::companyAppController($client);
}
diff --git a/tests/Api/Management/Controller/CompanyAppCredentialControllerTest.php b/tests/Api/Management/Controller/CompanyAppCredentialControllerTest.php
index deca3db9a..94d7c1a1d 100644
--- a/tests/Api/Management/Controller/CompanyAppCredentialControllerTest.php
+++ b/tests/Api/Management/Controller/CompanyAppCredentialControllerTest.php
@@ -47,7 +47,7 @@ class CompanyAppCredentialControllerTest extends AppCredentialControllerTestBase
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Management/Controller/CompanyControllerAwareTestTrait.php b/tests/Api/Management/Controller/CompanyControllerAwareTestTrait.php
index ad9aea5d3..8e1561912 100644
--- a/tests/Api/Management/Controller/CompanyControllerAwareTestTrait.php
+++ b/tests/Api/Management/Controller/CompanyControllerAwareTestTrait.php
@@ -30,11 +30,11 @@ trait CompanyControllerAwareTestTrait
use DefaultAPIClientAwareTrait;
/**
- * @param \Apigee\Edge\ClientInterface|null $client
+ * @param ClientInterface|null $client
*
- * @return \Apigee\Edge\Tests\Test\Controller\EntityControllerTester|\Apigee\Edge\Api\Management\Controller\CompanyControllerInterface
+ * @return EntityControllerTester|\Apigee\Edge\Api\Management\Controller\CompanyControllerInterface
*/
- protected static function companyController(ClientInterface $client = null): EntityControllerTester
+ protected static function companyController(?ClientInterface $client = null): EntityControllerTester
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Management/Controller/CompanyControllerTest.php b/tests/Api/Management/Controller/CompanyControllerTest.php
index 0f29d2b78..9493a1325 100644
--- a/tests/Api/Management/Controller/CompanyControllerTest.php
+++ b/tests/Api/Management/Controller/CompanyControllerTest.php
@@ -64,7 +64,7 @@ public function testStatusChange(): void
/** @var \Apigee\Edge\Api\Management\Controller\CompanyControllerInterface $controller */
$controller = static::entityController();
- /** @var \Apigee\Edge\Api\Management\Entity\CompanyInterface $entity */
+ /** @var CompanyInterface $entity */
$entity = static::getNewEntity();
$controller->create($entity);
$controller->setStatus($entity->id(), CompanyInterface::STATUS_INACTIVE);
@@ -78,7 +78,7 @@ public function testStatusChange(): void
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
return static::companyController($client);
}
diff --git a/tests/Api/Management/Controller/DeveloperAppControllerAwareTestTrait.php b/tests/Api/Management/Controller/DeveloperAppControllerAwareTestTrait.php
index 02c5bad36..e7c7abfb9 100644
--- a/tests/Api/Management/Controller/DeveloperAppControllerAwareTestTrait.php
+++ b/tests/Api/Management/Controller/DeveloperAppControllerAwareTestTrait.php
@@ -31,11 +31,11 @@ trait DeveloperAppControllerAwareTestTrait
use DefaultAPIClientAwareTrait;
/**
- * @param \Apigee\Edge\ClientInterface|null $client
+ * @param ClientInterface|null $client
*
- * @return \Apigee\Edge\Tests\Test\Controller\EntityControllerTester|\Apigee\Edge\Api\Management\Controller\DeveloperAppControllerInterface
+ * @return EntityControllerTester|\Apigee\Edge\Api\Management\Controller\DeveloperAppControllerInterface
*/
- protected static function developerAppController(ClientInterface $client = null): EntityControllerTester
+ protected static function developerAppController(?ClientInterface $client = null): EntityControllerTester
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Management/Controller/DeveloperAppControllerTest.php b/tests/Api/Management/Controller/DeveloperAppControllerTest.php
index 9fe2efd27..acfa53b87 100644
--- a/tests/Api/Management/Controller/DeveloperAppControllerTest.php
+++ b/tests/Api/Management/Controller/DeveloperAppControllerTest.php
@@ -44,7 +44,7 @@ class DeveloperAppControllerTest extends AppControllerTestBase
use DeveloperTestEntityProviderTrait;
use ParameterUrlEncodingTestTrait;
- /** @var \Apigee\Edge\Api\Management\Entity\DeveloperInterface */
+ /** @var DeveloperInterface */
protected static $testDeveloper;
/**
@@ -60,7 +60,7 @@ public static function setUpBeforeClass(): void
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
return static::developerAppController($client);
}
diff --git a/tests/Api/Management/Controller/DeveloperAppCredentialControllerTest.php b/tests/Api/Management/Controller/DeveloperAppCredentialControllerTest.php
index 05e0de366..b49ab998e 100644
--- a/tests/Api/Management/Controller/DeveloperAppCredentialControllerTest.php
+++ b/tests/Api/Management/Controller/DeveloperAppCredentialControllerTest.php
@@ -47,7 +47,7 @@ class DeveloperAppCredentialControllerTest extends AppCredentialControllerTestBa
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Management/Controller/DeveloperControllerAwareTestTrait.php b/tests/Api/Management/Controller/DeveloperControllerAwareTestTrait.php
index 21521f8a5..3c999e74f 100644
--- a/tests/Api/Management/Controller/DeveloperControllerAwareTestTrait.php
+++ b/tests/Api/Management/Controller/DeveloperControllerAwareTestTrait.php
@@ -31,11 +31,11 @@ trait DeveloperControllerAwareTestTrait
use DefaultAPIClientAwareTrait;
/**
- * @param \Apigee\Edge\ClientInterface|null $client
+ * @param ClientInterface|null $client
*
- * @return \Apigee\Edge\Tests\Test\Controller\EntityControllerTesterInterface|\Apigee\Edge\Api\Management\Controller\DeveloperControllerInterface
+ * @return EntityControllerTesterInterface|\Apigee\Edge\Api\Management\Controller\DeveloperControllerInterface
*/
- protected static function developerController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function developerController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Management/Controller/DeveloperControllerTest.php b/tests/Api/Management/Controller/DeveloperControllerTest.php
index 1afbf6c29..ed5df367a 100644
--- a/tests/Api/Management/Controller/DeveloperControllerTest.php
+++ b/tests/Api/Management/Controller/DeveloperControllerTest.php
@@ -82,7 +82,7 @@ public function testStatusChange(): void
static::markOnlineTestSkipped(__FUNCTION__);
/** @var \Apigee\Edge\Api\Management\Controller\DeveloperControllerInterface $controller */
$controller = static::entityController();
- /** @var \Apigee\Edge\Api\Management\Entity\DeveloperInterface $entity */
+ /** @var DeveloperInterface $entity */
$entity = static::getNewEntity();
$controller->create($entity);
$controller->setStatus($entity->id(), DeveloperInterface::STATUS_INACTIVE);
@@ -151,7 +151,7 @@ protected function entityIdShouldBeUsedInPagination(EntityInterface $entity): st
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
return static::developerController($client);
}
diff --git a/tests/Api/Management/Controller/EnvironmentControllerTest.php b/tests/Api/Management/Controller/EnvironmentControllerTest.php
index 74359ed06..fcc7a6ab0 100644
--- a/tests/Api/Management/Controller/EnvironmentControllerTest.php
+++ b/tests/Api/Management/Controller/EnvironmentControllerTest.php
@@ -49,7 +49,7 @@ class EnvironmentControllerTest extends EntityControllerTestBase
/**
* Test load depends on this so we had to implement it.
*
- * @return \Apigee\Edge\Entity\EntityInterface
+ * @return EntityInterface
*/
public function testCreate(): EntityInterface
{
@@ -64,7 +64,7 @@ public function testCreate(): EntityInterface
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Management/Controller/NonPaginatedEntityIdListingControllerTestTrait.php b/tests/Api/Management/Controller/NonPaginatedEntityIdListingControllerTestTrait.php
index 7253d84fd..562c5d4a0 100644
--- a/tests/Api/Management/Controller/NonPaginatedEntityIdListingControllerTestTrait.php
+++ b/tests/Api/Management/Controller/NonPaginatedEntityIdListingControllerTestTrait.php
@@ -24,6 +24,7 @@
use Apigee\Edge\Tests\Test\Controller\EntityControllerTesterInterface;
use Apigee\Edge\Tests\Test\Controller\EntityCreateOperationTestControllerAwareTrait;
use Apigee\Edge\Tests\Test\Utility\EntityStorage;
+use InvalidArgumentException;
use PHPUnit\Framework\Assert;
trait NonPaginatedEntityIdListingControllerTestTrait
@@ -55,13 +56,13 @@ protected function validateNonPaginatedEntityIdListingResult(array $entityIds):
/**
* Controller for non-paginated entity id listing operation testing.
*
- * @return \Apigee\Edge\Tests\Test\Controller\EntityControllerTesterInterface|\Apigee\Edge\Controller\NonPaginatedEntityIdListingControllerInterface
+ * @return EntityControllerTesterInterface|NonPaginatedEntityIdListingControllerInterface
*/
protected static function controllerForNonPaginatedEntityIdListing(): EntityControllerTesterInterface
{
$controller = static::entityController();
if ($controller->instanceOf(NonPaginatedEntityIdListingControllerInterface::class)) {
- throw new \InvalidArgumentException('Controller must implements NonPaginatedEntityIdListingControllerInterface.');
+ throw new InvalidArgumentException('Controller must implements NonPaginatedEntityIdListingControllerInterface.');
}
return $controller;
diff --git a/tests/Api/Management/Controller/NonPaginatedEntityListingControllerTestTrait.php b/tests/Api/Management/Controller/NonPaginatedEntityListingControllerTestTrait.php
index e8b932034..5c126a9ff 100644
--- a/tests/Api/Management/Controller/NonPaginatedEntityListingControllerTestTrait.php
+++ b/tests/Api/Management/Controller/NonPaginatedEntityListingControllerTestTrait.php
@@ -24,6 +24,7 @@
use Apigee\Edge\Tests\Test\Controller\EntityControllerTesterInterface;
use Apigee\Edge\Tests\Test\Controller\EntityCreateOperationTestControllerAwareTrait;
use Apigee\Edge\Tests\Test\Utility\EntityStorage;
+use InvalidArgumentException;
use PHPUnit\Framework\Assert;
trait NonPaginatedEntityListingControllerTestTrait
@@ -55,14 +56,14 @@ protected function validateNonPaginatedEntityListingResult(array $entities): voi
/**
* Controller for non-paginated entity listing operation testing.
*
- * @return \Apigee\Edge\Tests\Test\Controller\EntityControllerTesterInterface|\Apigee\Edge\Controller\NonPaginatedEntityListingControllerInterface
+ * @return EntityControllerTesterInterface|NonPaginatedEntityListingControllerInterface
*/
protected static function controllerForNonPaginatedEntityListing(): EntityControllerTesterInterface
{
$controller = static::entityController();
if ($controller->instanceOf(NonPaginatedEntityListingControllerInterface::class)) {
- throw new \InvalidArgumentException('Controller must implements NonPaginatedEntityListingControllerInterface.');
+ throw new InvalidArgumentException('Controller must implements NonPaginatedEntityListingControllerInterface.');
}
return $controller;
diff --git a/tests/Api/Management/Controller/OrganizationControllerTest.php b/tests/Api/Management/Controller/OrganizationControllerTest.php
index 4ea0e6e36..b16a1b689 100644
--- a/tests/Api/Management/Controller/OrganizationControllerTest.php
+++ b/tests/Api/Management/Controller/OrganizationControllerTest.php
@@ -21,6 +21,7 @@
use Apigee\Edge\Api\Management\Controller\OrganizationController;
use Apigee\Edge\Tests\Test\Controller\ControllerTestBase;
use Apigee\Edge\Tests\Test\Controller\FileSystemMockAPIClientAwareTrait;
+use DateTimeImmutable;
/**
* Class OrganizationControllerTest.
@@ -50,8 +51,8 @@ public function testLoad(): void
$this->assertTrue($entity->hasProperty('self.service.virtual.host.enabled'));
$this->assertEquals('true', $entity->getPropertyValue('features.isCpsEnabled'));
$this->assertEquals('trial', $entity->getType());
- $this->assertEquals(new \DateTimeImmutable('@648345600'), $entity->getCreatedAt());
- $this->assertEquals(new \DateTimeImmutable('@648345600'), $entity->getLastModifiedAt());
+ $this->assertEquals(new DateTimeImmutable('@648345600'), $entity->getCreatedAt());
+ $this->assertEquals(new DateTimeImmutable('@648345600'), $entity->getLastModifiedAt());
$this->assertEquals('phpunit@example.com', $entity->getCreatedBy());
$this->assertEquals('phpunit@example.com', $entity->getLastModifiedBy());
}
diff --git a/tests/Api/Management/Controller/PaginatedEntityIdListingControllerTestTrait.php b/tests/Api/Management/Controller/PaginatedEntityIdListingControllerTestTrait.php
index 2ca014b96..45dd8c0b9 100644
--- a/tests/Api/Management/Controller/PaginatedEntityIdListingControllerTestTrait.php
+++ b/tests/Api/Management/Controller/PaginatedEntityIdListingControllerTestTrait.php
@@ -24,6 +24,7 @@
use Apigee\Edge\Tests\Test\Controller\EntityControllerAwareTestTrait;
use Apigee\Edge\Tests\Test\Controller\EntityControllerTesterInterface;
use Apigee\Edge\Tests\Test\TestClientFactory;
+use InvalidArgumentException;
use PHPUnit\Framework\Assert;
trait PaginatedEntityIdListingControllerTestTrait
@@ -69,13 +70,13 @@ abstract protected function entityIdPrefixForPaginatedEntityListingTest(): strin
/**
* Controller for paginated entity id listing operation testing.
*
- * @return \Apigee\Edge\Tests\Test\Controller\EntityControllerTesterInterface|\Apigee\Edge\Controller\PaginatedEntityIdListingControllerInterface
+ * @return EntityControllerTesterInterface|PaginatedEntityIdListingControllerInterface
*/
protected static function controllerForPaginatedEntityIdListing(): EntityControllerTesterInterface
{
$controller = static::entityController();
if ($controller->instanceOf(PaginatedEntityIdListingControllerInterface::class)) {
- throw new \InvalidArgumentException('Controller must implements PaginatedEntityIdListingControllerInterface.');
+ throw new InvalidArgumentException('Controller must implements PaginatedEntityIdListingControllerInterface.');
}
return $controller;
diff --git a/tests/Api/Management/Controller/PaginatedEntityListingControllerTestTrait.php b/tests/Api/Management/Controller/PaginatedEntityListingControllerTestTrait.php
index 22b1d3a8d..68a8fdd3c 100644
--- a/tests/Api/Management/Controller/PaginatedEntityListingControllerTestTrait.php
+++ b/tests/Api/Management/Controller/PaginatedEntityListingControllerTestTrait.php
@@ -23,6 +23,7 @@
use Apigee\Edge\Tests\Test\Controller\EntityControllerAwareTestTrait;
use Apigee\Edge\Tests\Test\Controller\EntityControllerTesterInterface;
use Apigee\Edge\Tests\Test\TestClientFactory;
+use InvalidArgumentException;
use PHPUnit\Framework\Assert;
trait PaginatedEntityListingControllerTestTrait
@@ -104,14 +105,14 @@ abstract protected function entityIdPrefixForPaginatedEntityListingTest(): strin
/**
* Controller for paginated entity listing operation testing.
*
- * @return \Apigee\Edge\Tests\Test\Controller\EntityControllerTesterInterface|\Apigee\Edge\Controller\PaginatedEntityListingControllerInterface
+ * @return EntityControllerTesterInterface|PaginatedEntityListingControllerInterface
*/
protected static function controllerForPaginatedEntityListing(): EntityControllerTesterInterface
{
$controller = static::entityController();
if ($controller->instanceOf(PaginatedEntityListingControllerInterface::class)) {
- throw new \InvalidArgumentException('Controller must implements PaginatedEntityListingControllerInterface.');
+ throw new InvalidArgumentException('Controller must implements PaginatedEntityListingControllerInterface.');
}
return $controller;
diff --git a/tests/Api/Management/Controller/PaginatedEntityListingControllerTestTraitBase.php b/tests/Api/Management/Controller/PaginatedEntityListingControllerTestTraitBase.php
index 6081de9dd..c96afa173 100644
--- a/tests/Api/Management/Controller/PaginatedEntityListingControllerTestTraitBase.php
+++ b/tests/Api/Management/Controller/PaginatedEntityListingControllerTestTraitBase.php
@@ -62,7 +62,7 @@ protected function setupForPaginatedEntityListingTest(string $entityIdPrefix): a
* This helper function allows to choose the best one for pagination
* testing.
*
- * @param \Apigee\Edge\Entity\EntityInterface $entity
+ * @param EntityInterface $entity
*
* @return string
*/
diff --git a/tests/Api/Management/Controller/StatsControllerTest.php b/tests/Api/Management/Controller/StatsControllerTest.php
index 9fc131bf8..744ffe18e 100644
--- a/tests/Api/Management/Controller/StatsControllerTest.php
+++ b/tests/Api/Management/Controller/StatsControllerTest.php
@@ -24,7 +24,9 @@
use Apigee\Edge\Tests\Test\Controller\ControllerTestBase;
use Apigee\Edge\Tests\Test\Controller\FileSystemMockAPIClientAwareTrait;
use Apigee\Edge\Tests\Test\Controller\MockClientAwareTrait;
+use Exception;
use GuzzleHttp\Psr7\Response;
+use InvalidArgumentException;
use League\Period\Period;
/**
@@ -32,6 +34,7 @@
*
* @group controller
* @group management
+ *
* @small
*/
class StatsControllerTest extends ControllerTestBase
@@ -62,7 +65,7 @@ public function getOptimizedMetrics(bool $tsAscending): void
// Make our life easier and use the same timezone as Edge.
// StatsQueryNormalizerTest ensures that date conversion works properly.
date_default_timezone_set('UTC');
- $q = new StatsQuery(['sum(message_count)'], new Period('2018-02-01 00:00', '2018-02-28 23:59'));
+ $q = new StatsQuery(['sum(message_count)'], Period::fromDate('2018-02-01 00:00', '2018-02-28 23:59'));
$q->setTsAscending($tsAscending);
$q->setTimeUnit('day');
$original = $this->getController()->getMetrics($q);
@@ -103,7 +106,7 @@ public function getOptimizedMetricsByDimensions(bool $tsAscending): void
// Make our life easier and use the same timezone as Apigee Edge.
// StatsQueryNormalizerTest ensures that date conversion works properly.
date_default_timezone_set('UTC');
- $q = new StatsQuery(['sum(message_count), sum(is_error)'], new Period('2018-02-01 00:00', '2018-02-28 23:59'));
+ $q = new StatsQuery(['sum(message_count), sum(is_error)'], Period::fromDate('2018-02-01 00:00', '2018-02-28 23:59'));
$q->setTsAscending($tsAscending);
$q->setTimeUnit('day');
$original = $this->getController()->getMetricsByDimensions(['developer_app', 'developer'], $q);
@@ -131,7 +134,7 @@ public function getOptimizedMetricsByDimensions(bool $tsAscending): void
public function testUnsupportedTimeUnit(): void
{
date_default_timezone_set('UTC');
- $q = new StatsQuery([], new Period('2018-02-01 00:00', '2018-02-28 23:59'));
+ $q = new StatsQuery([], Period::fromDate('2018-02-01 00:00', '2018-02-28 23:59'));
$client = static::mockApiClient();
/** @var \Apigee\Edge\Tests\Test\HttpClient\MockHttpClient $httpClient */
$httpClient = $client->getMockHttpClient();
@@ -141,8 +144,8 @@ public function testUnsupportedTimeUnit(): void
$httpClient->addResponse(new Response(200, ['Content-Type' => 'application/json'], json_encode($this->emptyResponseArray())));
try {
$controller->getOptimisedMetrics($q);
- } catch (\Exception $e) {
- $this->assertInstanceOf(\InvalidArgumentException::class, $e);
+ } catch (Exception $e) {
+ $this->assertInstanceOf(InvalidArgumentException::class, $e);
}
}
}
@@ -150,7 +153,7 @@ public function testUnsupportedTimeUnit(): void
public function testGapFilling(): void
{
date_default_timezone_set('UTC');
- $q = new StatsQuery([], new Period('2018-02-01 11:11', '2018-02-14 23:23'));
+ $q = new StatsQuery([], Period::fromDate('2018-02-01 11:11', '2018-02-14 23:23'));
$q->setTimeUnit('day');
$client = static::mockApiClient();
/** @var \Apigee\Edge\Tests\Test\HttpClient\MockHttpClient $httpClient */
@@ -160,7 +163,7 @@ public function testGapFilling(): void
$response = $controller->getOptimisedMetrics($q);
$this->assertCount(14, $response['TimeUnit']);
$this->assertCount(14, $response['stats']['data'][0]['values']);
- $q->setTimeRange(new Period('2018-02-01 11:11', '2018-02-01 23:23'));
+ $q->setTimeRange(Period::fromDate('2018-02-01 11:11', '2018-02-01 23:23'));
$q->setTimeUnit('hour');
$httpClient->addResponse(new Response(200, ['Content-Type' => 'application/json'], json_encode($this->emptyResponseArray())));
$response = $controller->getOptimisedMetrics($q);
@@ -186,7 +189,7 @@ protected static function defaultAPIClient(): ClientInterface
/**
* Returns a configured controller with an offline http client.
*
- * @return \Apigee\Edge\Api\Management\Controller\StatsController
+ * @return StatsController
*/
protected function getController(): StatsController
{
diff --git a/tests/Api/Management/EntitySerializer/AppSerializerValidator.php b/tests/Api/Management/EntitySerializer/AppSerializerValidator.php
index 306fdad9e..1a899ef60 100644
--- a/tests/Api/Management/EntitySerializer/AppSerializerValidator.php
+++ b/tests/Api/Management/EntitySerializer/AppSerializerValidator.php
@@ -20,13 +20,14 @@
use Apigee\Edge\Entity\EntityInterface;
use PHPUnit\Framework\Assert;
+use stdClass;
class AppSerializerValidator extends EntitySerializerValidator
{
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, EntityInterface $entity): void
+ public function validate(stdClass $input, EntityInterface $entity): void
{
/** @var \Apigee\Edge\Api\Management\Entity\AppInterface $entity */
/** @var \Apigee\Edge\Api\Management\Entity\AppCredentialInterface $credential */
diff --git a/tests/Api/Management/EntitySerializer/EntitySerializerValidator.php b/tests/Api/Management/EntitySerializer/EntitySerializerValidator.php
index 4fd255d6e..de96a1c7f 100644
--- a/tests/Api/Management/EntitySerializer/EntitySerializerValidator.php
+++ b/tests/Api/Management/EntitySerializer/EntitySerializerValidator.php
@@ -28,10 +28,10 @@ class EntitySerializerValidator extends BaseEntitySerializerValidator
/**
* EntitySerializerValidator constructor.
*
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $serializer
+ * @param EntitySerializerInterface|null $serializer
* @param array $propertyValidators
*/
- public function __construct(EntitySerializerInterface $serializer = null, array $propertyValidators = [])
+ public function __construct(?EntitySerializerInterface $serializer = null, array $propertyValidators = [])
{
$propertyValidators = array_merge($propertyValidators, [
new CreatedAtPropertyValidator(),
diff --git a/tests/Api/Management/EntitySerializer/PropertyValidator/CreatedAtPropertyValidator.php b/tests/Api/Management/EntitySerializer/PropertyValidator/CreatedAtPropertyValidator.php
index 577201ec7..339d84089 100644
--- a/tests/Api/Management/EntitySerializer/PropertyValidator/CreatedAtPropertyValidator.php
+++ b/tests/Api/Management/EntitySerializer/PropertyValidator/CreatedAtPropertyValidator.php
@@ -23,6 +23,7 @@
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\RemoveIfPropertyValidPropertyValidatorInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use stdClass;
class CreatedAtPropertyValidator implements RemoveIfPropertyValidPropertyValidatorInterface, \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface
{
@@ -31,7 +32,7 @@ class CreatedAtPropertyValidator implements RemoveIfPropertyValidPropertyValidat
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
if (!$entity instanceof CommonEntityPropertiesInterface) {
return;
diff --git a/tests/Api/Management/EntitySerializer/PropertyValidator/LastModifiedAtPropertyValidator.php b/tests/Api/Management/EntitySerializer/PropertyValidator/LastModifiedAtPropertyValidator.php
index ba31e0cb4..95e36e406 100644
--- a/tests/Api/Management/EntitySerializer/PropertyValidator/LastModifiedAtPropertyValidator.php
+++ b/tests/Api/Management/EntitySerializer/PropertyValidator/LastModifiedAtPropertyValidator.php
@@ -24,6 +24,7 @@
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use stdClass;
class LastModifiedAtPropertyValidator implements RemoveIfPropertyValidPropertyValidatorInterface, SerializerAwarePropertyValidatorInterface
{
@@ -32,7 +33,7 @@ class LastModifiedAtPropertyValidator implements RemoveIfPropertyValidPropertyVa
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
if (!$entity instanceof CommonEntityPropertiesInterface) {
return;
diff --git a/tests/Api/Management/Query/StatsQueryNormalizerTest.php b/tests/Api/Management/Query/StatsQueryNormalizerTest.php
index c34232f8d..dd7a710b2 100644
--- a/tests/Api/Management/Query/StatsQueryNormalizerTest.php
+++ b/tests/Api/Management/Query/StatsQueryNormalizerTest.php
@@ -29,11 +29,12 @@
* @group management
* @group normalizer
* @group query
+ *
* @small
*/
class StatsQueryNormalizerTest extends TestCase
{
- /** @var \Apigee\Edge\Api\Management\Query\StatsQueryNormalizer */
+ /** @var StatsQueryNormalizer */
private static $normalizer;
/**
diff --git a/tests/Api/Monetization/Controller/AcceptedRatePlanControllerTestBase.php b/tests/Api/Monetization/Controller/AcceptedRatePlanControllerTestBase.php
index 0c2f0ceae..0dc5971f8 100644
--- a/tests/Api/Monetization/Controller/AcceptedRatePlanControllerTestBase.php
+++ b/tests/Api/Monetization/Controller/AcceptedRatePlanControllerTestBase.php
@@ -22,6 +22,7 @@
use Apigee\Edge\Tests\Api\Monetization\EntitySerializer\AcceptedRatePlanSerializerValidator;
use Apigee\Edge\Tests\Test\Controller\MockClientAwareTrait;
use Apigee\Edge\Tests\Test\EntitySerializer\EntitySerializerValidatorInterface;
+use DateTimeImmutable;
use GuzzleHttp\Psr7\Response;
use Psr\Http\Message\ResponseInterface;
@@ -63,9 +64,9 @@ public function testAcceptRatePlan(): void
$httpClient = static::mockApiClient()->getMockHttpClient();
/** @var \Apigee\Edge\Api\Monetization\Controller\AcceptedRatePlanControllerInterface $acceptedController */
$acceptedController = static::entityController(static::mockApiClient());
- /** @var \Apigee\Edge\Api\Monetization\Entity\RatePlanInterface $ratePlan */
+ /** @var RatePlanInterface $ratePlan */
$ratePlan = $this->getRatePlanToAccept();
- $startDate = new \DateTimeImmutable('now');
+ $startDate = new DateTimeImmutable('now');
$response = $this->getAcceptRatePlanResponse();
$httpClient->addResponse($response);
/** @var \Apigee\Edge\Api\Monetization\Entity\AcceptedRatePlanInterface $acceptedRatePlan */
@@ -82,7 +83,7 @@ public function testAcceptRatePlan(): void
$httpClient->addResponse($response);
/* @var \Apigee\Edge\Api\Monetization\Entity\AcceptedRatePlanInterface $acceptedRatePlan */
- $acceptedController->acceptRatePlan($ratePlan, $startDate, new \DateTimeImmutable('tomorrow'), 10, false, false);
+ $acceptedController->acceptRatePlan($ratePlan, $startDate, new DateTimeImmutable('tomorrow'), 10, false, false);
$payload = json_decode((string) static::mockApiClient()->getJournal()->getLastRequest()->getBody());
$this->assertNotNull($payload->endDate);
$this->assertEquals(10, $payload->quotaTarget);
@@ -91,7 +92,7 @@ public function testAcceptRatePlan(): void
$httpClient->addResponse($response);
/* @var \Apigee\Edge\Api\Monetization\Entity\AcceptedRatePlanInterface $acceptedRatePlan */
- $acceptedController->acceptRatePlan($ratePlan, $startDate, new \DateTimeImmutable('tomorrow'), 10, true, true);
+ $acceptedController->acceptRatePlan($ratePlan, $startDate, new DateTimeImmutable('tomorrow'), 10, true, true);
$payload = json_decode((string) static::mockApiClient()->getJournal()->getLastRequest()->getBody());
$this->assertEquals('true', $payload->suppressWarning);
$this->assertEquals('true', $payload->waveTerminationCharge);
@@ -110,7 +111,7 @@ public function testUpdateSubscription(): void
/** @var \Apigee\Edge\Api\Monetization\Entity\AcceptedRatePlanInterface $acceptedRatePlan */
$acceptedRatePlan = $acceptedController->load('phpunit');
$originalStartDate = $acceptedRatePlan->getStartDate();
- $acceptedRatePlan->setStartDate(new \DateTimeImmutable('now'));
+ $acceptedRatePlan->setStartDate(new DateTimeImmutable('now'));
$acceptedController->updateSubscription($acceptedRatePlan);
$payload = json_decode((string) static::mockApiClient()->getJournal()->getLastRequest()->getBody());
// Make sure we do not send properties with null values.
@@ -139,12 +140,12 @@ public function testUpdateSubscription(): void
/**
* Returns a response that will be returned for acceptRatePlan().
*
- * @return \Psr\Http\Message\ResponseInterface
+ * @return ResponseInterface
*/
abstract protected function getAcceptRatePlanResponse(): ResponseInterface;
/**
- * @return \Apigee\Edge\Api\Monetization\Entity\RatePlanInterface
+ * @return RatePlanInterface
*/
abstract protected function getRatePlanToAccept(): RatePlanInterface;
diff --git a/tests/Api/Monetization/Controller/ActiveRatePlanControllerTestBase.php b/tests/Api/Monetization/Controller/ActiveRatePlanControllerTestBase.php
index 06e56d522..091b77243 100755
--- a/tests/Api/Monetization/Controller/ActiveRatePlanControllerTestBase.php
+++ b/tests/Api/Monetization/Controller/ActiveRatePlanControllerTestBase.php
@@ -20,6 +20,7 @@
use Apigee\Edge\Tests\Api\Monetization\EntitySerializer\RatePlanSerializerValidator;
use Apigee\Edge\Tests\Test\EntitySerializer\EntitySerializerValidatorInterface;
+use Exception;
/**
* Base test class for developer- and company active rate plans.
@@ -52,7 +53,7 @@ public function testGetActiveRatePlanByApiProduct(): void
$this->assertEmpty(static::defaultAPIClient()->getJournal()->getLastRequest()->getUri()->getQuery());
try {
$controller->getActiveRatePlanByApiProduct('phpunit', true);
- } catch (\Exception $exception) {
+ } catch (Exception $exception) {
// File does not exist, so it is fine.
}
$this->assertEquals('showPrivate=true', static::defaultAPIClient()->getJournal()->getLastRequest()->getUri()->getQuery());
diff --git a/tests/Api/Monetization/Controller/ApiPackageControllerTest.php b/tests/Api/Monetization/Controller/ApiPackageControllerTest.php
index 03d5c5980..bfde72913 100644
--- a/tests/Api/Monetization/Controller/ApiPackageControllerTest.php
+++ b/tests/Api/Monetization/Controller/ApiPackageControllerTest.php
@@ -78,7 +78,7 @@ public function testDeleteProduct(): void
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/ApiProductControllerTest.php b/tests/Api/Monetization/Controller/ApiProductControllerTest.php
index 69b611b4c..432e41d61 100755
--- a/tests/Api/Monetization/Controller/ApiProductControllerTest.php
+++ b/tests/Api/Monetization/Controller/ApiProductControllerTest.php
@@ -46,7 +46,7 @@ public function testEligibleProducts(): void
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/CompanyAcceptedRatePlanControllerTest.php b/tests/Api/Monetization/Controller/CompanyAcceptedRatePlanControllerTest.php
index 35b83b888..55d057a78 100644
--- a/tests/Api/Monetization/Controller/CompanyAcceptedRatePlanControllerTest.php
+++ b/tests/Api/Monetization/Controller/CompanyAcceptedRatePlanControllerTest.php
@@ -41,7 +41,7 @@ class CompanyAcceptedRatePlanControllerTest extends AcceptedRatePlanControllerTe
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/CompanyActiveRatePlanControllerTest.php b/tests/Api/Monetization/Controller/CompanyActiveRatePlanControllerTest.php
index ddde86385..b657056e8 100644
--- a/tests/Api/Monetization/Controller/CompanyActiveRatePlanControllerTest.php
+++ b/tests/Api/Monetization/Controller/CompanyActiveRatePlanControllerTest.php
@@ -34,7 +34,7 @@ class CompanyActiveRatePlanControllerTest extends ActiveRatePlanControllerTestBa
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/CompanyControllerTest.php b/tests/Api/Monetization/Controller/CompanyControllerTest.php
index 6749cfed9..cec4e7ca7 100755
--- a/tests/Api/Monetization/Controller/CompanyControllerTest.php
+++ b/tests/Api/Monetization/Controller/CompanyControllerTest.php
@@ -34,7 +34,7 @@ class CompanyControllerTest extends LegalEntityControllerTestBase
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/CompanyPrepaidBalanceControllerTest.php b/tests/Api/Monetization/Controller/CompanyPrepaidBalanceControllerTest.php
index 49648d0ce..3b0232664 100644
--- a/tests/Api/Monetization/Controller/CompanyPrepaidBalanceControllerTest.php
+++ b/tests/Api/Monetization/Controller/CompanyPrepaidBalanceControllerTest.php
@@ -37,7 +37,7 @@ class CompanyPrepaidBalanceControllerTest extends PrepaidBalanceControllerTestBa
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/CompanyReportDefinitionControllerTest.php b/tests/Api/Monetization/Controller/CompanyReportDefinitionControllerTest.php
index 5176d263d..941181117 100644
--- a/tests/Api/Monetization/Controller/CompanyReportDefinitionControllerTest.php
+++ b/tests/Api/Monetization/Controller/CompanyReportDefinitionControllerTest.php
@@ -36,7 +36,7 @@ class CompanyReportDefinitionControllerTest extends ReportDefinitionControllerTe
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/CompanyTermsAndConditionsControllerTest.php b/tests/Api/Monetization/Controller/CompanyTermsAndConditionsControllerTest.php
index 364548ab0..56314c9b1 100644
--- a/tests/Api/Monetization/Controller/CompanyTermsAndConditionsControllerTest.php
+++ b/tests/Api/Monetization/Controller/CompanyTermsAndConditionsControllerTest.php
@@ -39,7 +39,7 @@ class CompanyTermsAndConditionsControllerTest extends LegalEntityTermsAndConditi
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/DeveloperAcceptedRatePlanControllerTest.php b/tests/Api/Monetization/Controller/DeveloperAcceptedRatePlanControllerTest.php
index ea7bcc80e..974df97c9 100644
--- a/tests/Api/Monetization/Controller/DeveloperAcceptedRatePlanControllerTest.php
+++ b/tests/Api/Monetization/Controller/DeveloperAcceptedRatePlanControllerTest.php
@@ -41,7 +41,7 @@ class DeveloperAcceptedRatePlanControllerTest extends AcceptedRatePlanController
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/DeveloperActiveRatePlanControllerTest.php b/tests/Api/Monetization/Controller/DeveloperActiveRatePlanControllerTest.php
index 277985a5a..a1eac9351 100644
--- a/tests/Api/Monetization/Controller/DeveloperActiveRatePlanControllerTest.php
+++ b/tests/Api/Monetization/Controller/DeveloperActiveRatePlanControllerTest.php
@@ -34,7 +34,7 @@ class DeveloperActiveRatePlanControllerTest extends ActiveRatePlanControllerTest
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/DeveloperControllerTest.php b/tests/Api/Monetization/Controller/DeveloperControllerTest.php
index 42d8c5c2a..334b50deb 100755
--- a/tests/Api/Monetization/Controller/DeveloperControllerTest.php
+++ b/tests/Api/Monetization/Controller/DeveloperControllerTest.php
@@ -46,7 +46,7 @@ protected function entitySerializerValidator(): EntitySerializerValidatorInterfa
return $validator;
}
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/DeveloperPrepaidBalanceControllerTest.php b/tests/Api/Monetization/Controller/DeveloperPrepaidBalanceControllerTest.php
index 60edcfd08..6a196d248 100644
--- a/tests/Api/Monetization/Controller/DeveloperPrepaidBalanceControllerTest.php
+++ b/tests/Api/Monetization/Controller/DeveloperPrepaidBalanceControllerTest.php
@@ -37,7 +37,7 @@ class DeveloperPrepaidBalanceControllerTest extends PrepaidBalanceControllerTest
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/DeveloperReportDefinitionControllerTest.php b/tests/Api/Monetization/Controller/DeveloperReportDefinitionControllerTest.php
index c1969a132..520d0f735 100644
--- a/tests/Api/Monetization/Controller/DeveloperReportDefinitionControllerTest.php
+++ b/tests/Api/Monetization/Controller/DeveloperReportDefinitionControllerTest.php
@@ -36,7 +36,7 @@ class DeveloperReportDefinitionControllerTest extends ReportDefinitionController
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/DeveloperRoleControllerTest.php b/tests/Api/Monetization/Controller/DeveloperRoleControllerTest.php
index 353c88347..93a163c55 100755
--- a/tests/Api/Monetization/Controller/DeveloperRoleControllerTest.php
+++ b/tests/Api/Monetization/Controller/DeveloperRoleControllerTest.php
@@ -48,7 +48,7 @@ public function testListing(): void
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/DeveloperTermsAndConditionsControllerTest.php b/tests/Api/Monetization/Controller/DeveloperTermsAndConditionsControllerTest.php
index d2fb2f87e..dd1025f6b 100644
--- a/tests/Api/Monetization/Controller/DeveloperTermsAndConditionsControllerTest.php
+++ b/tests/Api/Monetization/Controller/DeveloperTermsAndConditionsControllerTest.php
@@ -37,7 +37,7 @@ class DeveloperTermsAndConditionsControllerTest extends LegalEntityTermsAndCondi
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/EntityDeleteOperationControllerTestTrait.php b/tests/Api/Monetization/Controller/EntityDeleteOperationControllerTestTrait.php
index f69039493..e86bb90cf 100644
--- a/tests/Api/Monetization/Controller/EntityDeleteOperationControllerTestTrait.php
+++ b/tests/Api/Monetization/Controller/EntityDeleteOperationControllerTestTrait.php
@@ -34,7 +34,7 @@ trait EntityDeleteOperationControllerTestTrait
/**
* @depends testLoad
*
- * @param \Apigee\Edge\Entity\EntityInterface $entity
+ * @param EntityInterface $entity
*/
public function testDelete(EntityInterface $entity): void
{
diff --git a/tests/Api/Monetization/Controller/EntityLoadOperationControllerTestTrait.php b/tests/Api/Monetization/Controller/EntityLoadOperationControllerTestTrait.php
index e2fa39db0..e3d931824 100644
--- a/tests/Api/Monetization/Controller/EntityLoadOperationControllerTestTrait.php
+++ b/tests/Api/Monetization/Controller/EntityLoadOperationControllerTestTrait.php
@@ -21,6 +21,7 @@
use Apigee\Edge\Entity\EntityInterface;
use Apigee\Edge\Tests\Test\Controller\DefaultAPIClientAwareTrait;
use Apigee\Edge\Tests\Test\Controller\EntityLoadOperationControllerTestTrait as BaseEntityLoadOperationControllerTestTrait;
+use stdClass;
/**
* Monetization API version of EntityLoadOperationControllerTestTrait.
@@ -47,7 +48,7 @@ public function testLoad($created = null): EntityInterface
return $entity;
}
- protected function alterObjectsBeforeCompareExpectedAndLoadedEntity(\stdClass &$expectedAsObject, EntityInterface $loaded): void
+ protected function alterObjectsBeforeCompareExpectedAndLoadedEntity(stdClass &$expectedAsObject, EntityInterface $loaded): void
{
// The serialized version of the created (actual) would not be the
// same as the loaded entity, because entity reference properties
diff --git a/tests/Api/Monetization/Controller/LegalEntityTermsAndConditionsControllerTestBase.php b/tests/Api/Monetization/Controller/LegalEntityTermsAndConditionsControllerTestBase.php
index a54f8668c..f45dda1a6 100644
--- a/tests/Api/Monetization/Controller/LegalEntityTermsAndConditionsControllerTestBase.php
+++ b/tests/Api/Monetization/Controller/LegalEntityTermsAndConditionsControllerTestBase.php
@@ -23,6 +23,7 @@
use Apigee\Edge\Serializer\JsonEncoder;
use Apigee\Edge\Tests\Test\Controller\MockClientAwareTrait;
use Apigee\Edge\Tests\Test\HttpClient\FileSystemResponseFactory;
+use DateTimeImmutable;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
@@ -68,9 +69,9 @@ public function testAcceptDeclineTermsAndConditions(): void
// Action does not matter because we do not validate it.
'action' => LegalEntityTermsAndConditionsHistoryItem::ACTION_ACCEPTED,
'id' => static::randomGenerator()->machineName(),
- 'auditDate' => static::entitySerializer()->normalize(new \DateTimeImmutable('now'), 'json'),
+ 'auditDate' => static::entitySerializer()->normalize(new DateTimeImmutable('now'), 'json'),
'tnc' => $encoder->decode((string) (new FileSystemResponseFactory())->createResponseForRequest(new Request('GET', 'v1/mint/organizations/phpunit/tncs/phpunit'))->getBody(), 'json'),
- ], 'json');
+ ], 'json');
$httpClient->setDefaultResponse(new Response(200, ['Content-Type' => 'application/json'], $mockResponse));
$controller->acceptTermsAndConditionsById($tncId);
diff --git a/tests/Api/Monetization/Controller/OrganizationProfileControllerTest.php b/tests/Api/Monetization/Controller/OrganizationProfileControllerTest.php
index e6dad5ad0..c11e8c675 100755
--- a/tests/Api/Monetization/Controller/OrganizationProfileControllerTest.php
+++ b/tests/Api/Monetization/Controller/OrganizationProfileControllerTest.php
@@ -53,7 +53,7 @@ public function testLoad($created = null): EntityInterface
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/PaginatedEntityListingControllerAwareTraitTest.php b/tests/Api/Monetization/Controller/PaginatedEntityListingControllerAwareTraitTest.php
index ad517f4f5..c7fb505db 100644
--- a/tests/Api/Monetization/Controller/PaginatedEntityListingControllerAwareTraitTest.php
+++ b/tests/Api/Monetization/Controller/PaginatedEntityListingControllerAwareTraitTest.php
@@ -66,7 +66,7 @@ class PaginatedEntityListingControllerAwareTraitClass
use JsonDecoderAwareTrait;
/**
- * @var \Apigee\Edge\ClientInterface
+ * @var ClientInterface
*/
protected $client;
diff --git a/tests/Api/Monetization/Controller/PaymentProviderControllerTest.php b/tests/Api/Monetization/Controller/PaymentProviderControllerTest.php
index 57c6121e8..4a5434f14 100644
--- a/tests/Api/Monetization/Controller/PaymentProviderControllerTest.php
+++ b/tests/Api/Monetization/Controller/PaymentProviderControllerTest.php
@@ -48,7 +48,7 @@ class PaymentProviderControllerTest extends EntityControllerTestBase
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/PrepaidBalanceControllerTestBase.php b/tests/Api/Monetization/Controller/PrepaidBalanceControllerTestBase.php
index b2bfb0d91..0cf1aa440 100644
--- a/tests/Api/Monetization/Controller/PrepaidBalanceControllerTestBase.php
+++ b/tests/Api/Monetization/Controller/PrepaidBalanceControllerTestBase.php
@@ -21,7 +21,9 @@
use Apigee\Edge\Tests\Api\Monetization\EntitySerializer\PrepaidBalanceSerializerValidator;
use Apigee\Edge\Tests\Test\Controller\MockClientAwareTrait;
use Apigee\Edge\Tests\Test\EntitySerializer\EntitySerializerValidatorInterface;
+use DateTimeImmutable;
use GuzzleHttp\Psr7\Response;
+use ReflectionObject;
/**
* Base class for developer- and company prepaid balance tests.
@@ -96,15 +98,15 @@ public function testGetPrepaidBalance(): void
/** @var \Apigee\Edge\Api\Monetization\Controller\PrepaidBalanceControllerInterface $controller */
$controller = static::entityController();
/** @var \Apigee\Edge\Api\Monetization\Entity\PrepaidBalanceInterface[] $entities */
- $entities = $controller->getPrepaidBalance(new \DateTimeImmutable('2018-10-01'));
+ $entities = $controller->getPrepaidBalance(new DateTimeImmutable('2018-10-01'));
$json = json_decode((string) static::defaultAPIClient()->getJournal()->getLastResponse()->getBody());
$json = reset($json);
$i = 0;
// We need to prepaid balance serializer from the controller.
- $ro = new \ReflectionObject(static::entityController());
+ $ro = new ReflectionObject(static::entityController());
$property = $ro->getProperty('decorated');
$property->setAccessible(true);
- $ro = new \ReflectionObject($property->getValue(static::entityController()));
+ $ro = new ReflectionObject($property->getValue(static::entityController()));
$rp = $ro->getProperty('prepaidBalanceSerializer');
$rp->setAccessible(true);
$validator = new PrepaidBalanceSerializerValidator($rp->getValue($property->getValue(static::entityController())));
@@ -126,7 +128,7 @@ public function testMethodsThatReturnsPrepaidBalance(): void
/** @var \Apigee\Edge\Api\Monetization\Controller\PrepaidBalanceControllerInterface $controller */
$controller = static::entityController(static::mockApiClient());
$currencyCode = 'USD';
- $billingMonth = new \DateTimeImmutable('now');
+ $billingMonth = new DateTimeImmutable('now');
$balance = $controller->getPrepaidBalanceByCurrency($currencyCode, $billingMonth);
// In case of an empty result this should return null.
$this->assertNull($balance);
diff --git a/tests/Api/Monetization/Controller/RatePlanControllerTest.php b/tests/Api/Monetization/Controller/RatePlanControllerTest.php
index 430ddd9b4..aad21f311 100644
--- a/tests/Api/Monetization/Controller/RatePlanControllerTest.php
+++ b/tests/Api/Monetization/Controller/RatePlanControllerTest.php
@@ -33,6 +33,7 @@
use Apigee\Edge\Tests\Test\Controller\MockClientAwareTrait;
use Apigee\Edge\Tests\Test\EntitySerializer\EntitySerializerValidatorInterface;
use Apigee\Edge\Tests\Test\HttpClient\FileSystemResponseFactory;
+use DateTimeImmutable;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
@@ -106,9 +107,9 @@ public function testCreateNewRevision(): void
/** @var \Apigee\Edge\Api\Monetization\Entity\RatePlanInterface $rate_plan */
// Create a new revision from a rate plan revision.
$rate_plan = $this->controllerForEntityLoad()->load('standard-rev');
- $rate_plan->setStartDate(new \DateTimeImmutable('now'));
- /** @var \Apigee\Edge\Api\Monetization\Entity\RatePlanRevisionInterface $rate_plan_revision */
- $rate_plan_revision_start_date = new \DateTimeImmutable('tomorrow');
+ $rate_plan->setStartDate(new DateTimeImmutable('now'));
+ /** @var RatePlanRevisionInterface $rate_plan_revision */
+ $rate_plan_revision_start_date = new DateTimeImmutable('tomorrow');
$rate_plan_revision = RatePlanRevisionBuilder::buildRatePlanRevision($rate_plan, $rate_plan_revision_start_date);
$this->assertNull($rate_plan_revision->id());
$this->assertNull($rate_plan_revision->getEndDate());
@@ -138,8 +139,8 @@ public function testCreateNewRevisionWithIncorrectStartDate(): void
/** @var \Apigee\Edge\Api\Monetization\Entity\RatePlanInterface $rate_plan */
$rate_plan = $this->controllerForEntityLoad()->load('standard');
- $rate_plan->setStartDate(new \DateTimeImmutable('now'));
- RatePlanRevisionBuilder::buildRatePlanRevision($rate_plan, new \DateTimeImmutable('yesterday'));
+ $rate_plan->setStartDate(new DateTimeImmutable('now'));
+ RatePlanRevisionBuilder::buildRatePlanRevision($rate_plan, new DateTimeImmutable('yesterday'));
}
/**
@@ -158,7 +159,7 @@ protected function entitySerializerValidator(): EntitySerializerValidatorInterfa
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/ReportDefinitionControllerTest.php b/tests/Api/Monetization/Controller/ReportDefinitionControllerTest.php
index d5e81c147..47c511427 100644
--- a/tests/Api/Monetization/Controller/ReportDefinitionControllerTest.php
+++ b/tests/Api/Monetization/Controller/ReportDefinitionControllerTest.php
@@ -44,7 +44,7 @@ protected function expectedFilteredReportDefinitionUrl(): string
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/ReportDefinitionControllerTestBase.php b/tests/Api/Monetization/Controller/ReportDefinitionControllerTestBase.php
index a75d83e0c..ae2d5c20d 100644
--- a/tests/Api/Monetization/Controller/ReportDefinitionControllerTestBase.php
+++ b/tests/Api/Monetization/Controller/ReportDefinitionControllerTestBase.php
@@ -33,6 +33,7 @@
use Apigee\Edge\Tests\Test\Controller\MockClientAwareTrait;
use Apigee\Edge\Tests\Test\EntitySerializer\EntitySerializerValidatorInterface;
use Apigee\Edge\Tests\Test\TestClientFactory;
+use DateTimeImmutable;
use GuzzleHttp\Psr7\Response;
abstract class ReportDefinitionControllerTestBase extends EntityControllerTestBase
@@ -59,7 +60,7 @@ public function testGenerateReport(): void
$this->assertEquals("/v1/mint/organizations/{$test_org}/billing-reports", static::mockApiClient()->getJournal()->getLastRequest()->getUri()->getPath());
$controller->generateReport(new PrepaidBalanceReportCriteria('JANUARY', 2019));
$this->assertEquals("/v1/mint/organizations/{$test_org}/prepaid-balance-reports", static::mockApiClient()->getJournal()->getLastRequest()->getUri()->getPath());
- $controller->generateReport(new RevenueReportCriteria(new \DateTimeImmutable('yesterday'), new \DateTimeImmutable('now')));
+ $controller->generateReport(new RevenueReportCriteria(new DateTimeImmutable('yesterday'), new DateTimeImmutable('now')));
$this->assertEquals("/v1/mint/organizations/{$test_org}/revenue-reports", static::mockApiClient()->getJournal()->getLastRequest()->getUri()->getPath());
}
@@ -68,7 +69,7 @@ public function testGenerateReportWithUnknownCriteria(): void
$this->expectException('\Apigee\Edge\Exception\InvalidArgumentException');
$this->expectExceptionMessage('Unable to identify report type.');
- $class = new class() extends AbstractCriteria {
+ $class = new class extends AbstractCriteria {
};
/** @var \Apigee\Edge\Api\Monetization\Controller\ReportDefinitionControllerInterface $controller */
$controller = static::entityController(static::mockApiClient());
diff --git a/tests/Api/Monetization/Controller/SupportedCurrencyControllerTest.php b/tests/Api/Monetization/Controller/SupportedCurrencyControllerTest.php
index 476b3fb5b..25b3d4a59 100644
--- a/tests/Api/Monetization/Controller/SupportedCurrencyControllerTest.php
+++ b/tests/Api/Monetization/Controller/SupportedCurrencyControllerTest.php
@@ -48,7 +48,7 @@ class SupportedCurrencyControllerTest extends EntityControllerTestBase
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/TermsAndConditionsControllerTest.php b/tests/Api/Monetization/Controller/TermsAndConditionsControllerTest.php
index 0e0e373b7..807ced976 100644
--- a/tests/Api/Monetization/Controller/TermsAndConditionsControllerTest.php
+++ b/tests/Api/Monetization/Controller/TermsAndConditionsControllerTest.php
@@ -72,7 +72,7 @@ public function testGetEntities(): void
/**
* {@inheritdoc}
*/
- protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface
+ protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface
{
$client = $client ?? static::defaultAPIClient();
diff --git a/tests/Api/Monetization/Controller/TimezoneConversionTestTrait.php b/tests/Api/Monetization/Controller/TimezoneConversionTestTrait.php
index a69217c35..431dabc81 100644
--- a/tests/Api/Monetization/Controller/TimezoneConversionTestTrait.php
+++ b/tests/Api/Monetization/Controller/TimezoneConversionTestTrait.php
@@ -22,7 +22,11 @@
use Apigee\Edge\Tests\Test\Controller\DefaultAPIClientAwareTrait;
use Apigee\Edge\Tests\Test\Controller\EntityControllerAwareTestTrait;
use Apigee\Edge\Tests\Test\EntitySerializer\EntitySerializerAwareTestTrait;
+use DateTimeImmutable;
+use DateTimeInterface;
+use DateTimeZone;
use PHPUnit\Framework\Assert;
+use ReflectionObject;
trait TimezoneConversionTestTrait
{
@@ -60,7 +64,7 @@ public function testTimezoneConversation(): void
// Change value of timezone, use the current timezone instead of
// the org's timezone.
- $entity->{$setter}(\DateTimeImmutable::createFromFormat(EntityInterface::DATE_FORMAT, '2017-12-31 16:15:59'));
+ $entity->{$setter}(DateTimeImmutable::createFromFormat(EntityInterface::DATE_FORMAT, '2017-12-31 16:15:59'));
$this->assertEquals($currentTimezone, $entity->{$getter}()->getTimezone()->getName());
}
// Ensure the serializer converts the value of date properties to org's
@@ -83,11 +87,11 @@ abstract protected function getTestEntityForTimezoneConversion(): EntityInterfac
* aware entity, but it could happen that it does not, ex.: rate plans.
* On Rate Plans the parent API package contains the organization reference.
*
- * @param \Apigee\Edge\Api\Monetization\Entity\EntityInterface $entity
+ * @param EntityInterface $entity
*
- * @return \DateTimeZone
+ * @return DateTimeZone
*/
- protected function getOrganizationTimezoneFromEntity(EntityInterface $entity): \DateTimeZone
+ protected function getOrganizationTimezoneFromEntity(EntityInterface $entity): DateTimeZone
{
/* @var \Apigee\Edge\Api\Monetization\Entity\OrganizationAwareEntityInterface $entity */
return $entity->getOrganization()->getTimezone();
@@ -96,7 +100,7 @@ protected function getOrganizationTimezoneFromEntity(EntityInterface $entity): \
/**
* Collect all date properties from entity (non-recursively) with reflection.
*
- * @param \Apigee\Edge\Api\Monetization\Entity\EntityInterface $entity
+ * @param EntityInterface $entity
*
* @return string[]
* Array of property names.
@@ -105,11 +109,11 @@ private function getDateProperties(EntityInterface $entity): array
{
$properties = [];
- $ro = new \ReflectionObject($entity);
+ $ro = new ReflectionObject($entity);
foreach ($ro->getProperties() as $property) {
$property->setAccessible(true);
$value = $property->getValue($entity);
- if ($value instanceof \DateTimeInterface) {
+ if ($value instanceof DateTimeInterface) {
$properties[] = $property->getName();
}
}
diff --git a/tests/Api/Monetization/Denormalizer/ReportCriteriaDenormalizerTest.php b/tests/Api/Monetization/Denormalizer/ReportCriteriaDenormalizerTest.php
index d0b1158b0..f471a76e4 100644
--- a/tests/Api/Monetization/Denormalizer/ReportCriteriaDenormalizerTest.php
+++ b/tests/Api/Monetization/Denormalizer/ReportCriteriaDenormalizerTest.php
@@ -31,7 +31,7 @@
class ReportCriteriaDenormalizerTest extends TestCase
{
- /** @var \Apigee\Edge\Api\Monetization\Denormalizer\ReportCriteriaDenormalizer */
+ /** @var Apigee\Edge\Api\Monetization\Denormalizer\ReportCriteriaDenormalizer */
protected static $denormalizer;
/**
@@ -46,7 +46,7 @@ public static function setUpBeforeClass(): void
public function testDenormalizeWithAbtractClassNoContext(): void
{
- $this->expectException('\Error');
+ $this->expectException('\Symfony\Component\Serializer\Exception\NotNormalizableValueException');
static::$denormalizer->denormalize((object) [], AbstractCriteria::class, 'json');
}
diff --git a/tests/Api/Monetization/Entity/ReportDefinitionEntityProviderTrait.php b/tests/Api/Monetization/Entity/ReportDefinitionEntityProviderTrait.php
index c16262ab7..b4722e2d8 100644
--- a/tests/Api/Monetization/Entity/ReportDefinitionEntityProviderTrait.php
+++ b/tests/Api/Monetization/Entity/ReportDefinitionEntityProviderTrait.php
@@ -30,7 +30,7 @@ trait ReportDefinitionEntityProviderTrait
protected static function getNewReportDefinition(bool $randomData = true): ReportDefinitionInterface
{
$criteria = new BillingReportCriteria('JANUARY', $randomData ? date('Y') : 2019);
- $criteria->groupBy('PACKAGE', 'PRODUCT', 'DEVELOPER')->ratePlanLevels('STANDARD', 'DEVELOPER')->developers('developer@example.com');
+ $criteria->setGroupBy('PACKAGE', 'PRODUCT', 'DEVELOPER')->setRatePlanLevels('STANDARD', 'DEVELOPER')->setDevelopers('developer@example.com');
$entity = new ReportDefinition([
'name' => $randomData ? static::randomGenerator()->machineName() : 'PHPUnit',
'description' => $randomData ? static::randomGenerator()->text() : 'test report definition provider',
@@ -44,10 +44,10 @@ protected static function getUpdatedReportDefinition(ReportDefinitionInterface $
{
$updated = clone $existing;
$updated->setDescription($randomData ? static::randomGenerator()->text() : '(edited) test report definition provider');
- /** @var \Apigee\Edge\Api\Monetization\Structure\Reports\Criteria\BillingReportCriteria $criteria */
+ /** @var BillingReportCriteria $criteria */
$criteria = $updated->getCriteria();
$criteria->setBillingMonth('FEBRUARY');
- $criteria->showSummary(!$criteria->getShowSummary());
+ $criteria->setShowSummary(!$criteria->getShowSummary());
$updated->setCriteria($criteria);
return $updated;
diff --git a/tests/Api/Monetization/Entity/TermsAndConditionsEntityProviderTrait.php b/tests/Api/Monetization/Entity/TermsAndConditionsEntityProviderTrait.php
index 9765ab779..260040ecc 100644
--- a/tests/Api/Monetization/Entity/TermsAndConditionsEntityProviderTrait.php
+++ b/tests/Api/Monetization/Entity/TermsAndConditionsEntityProviderTrait.php
@@ -22,6 +22,7 @@
use Apigee\Edge\Api\Monetization\Entity\TermsAndConditionsInterface;
use Apigee\Edge\Tests\Api\Monetization\Controller\OrganizationProfileControllerAwareTestTrait;
use Apigee\Edge\Tests\Test\Utility\RandomGeneratorAwareTrait;
+use DateTimeImmutable;
trait TermsAndConditionsEntityProviderTrait
{
@@ -31,7 +32,7 @@ trait TermsAndConditionsEntityProviderTrait
protected static function getNewTnC(bool $randomData = true): TermsAndConditionsInterface
{
$entity = new TermsAndConditions([
- 'startDate' => $randomData ? new \DateTimeImmutable('tomorrow') : \DateTimeImmutable::createFromFormat(TermsAndConditionsInterface::DATE_FORMAT, '2017-12-31 16:15:59'),
+ 'startDate' => $randomData ? new DateTimeImmutable('tomorrow') : DateTimeImmutable::createFromFormat(TermsAndConditionsInterface::DATE_FORMAT, '2017-12-31 16:15:59'),
'description' => $randomData ? static::randomGenerator()->text() : 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
// In the API level the version could be anything, so it is string.
// Because it is a string JSON float serialization trick does
diff --git a/tests/Api/Monetization/EntitySerializer/AcceptedRatePlanSerializerValidator.php b/tests/Api/Monetization/EntitySerializer/AcceptedRatePlanSerializerValidator.php
index 30762ad88..016c977ba 100644
--- a/tests/Api/Monetization/EntitySerializer/AcceptedRatePlanSerializerValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/AcceptedRatePlanSerializerValidator.php
@@ -27,10 +27,10 @@ class AcceptedRatePlanSerializerValidator extends OrganizationAwareEntitySeriali
/**
* AcceptedRatePlanSerializerValidator constructor.
*
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface $serializer
+ * @param EntitySerializerInterface $serializer
* @param array $propertyValidators
*/
- public function __construct(EntitySerializerInterface $serializer = null, array $propertyValidators = [])
+ public function __construct(?EntitySerializerInterface $serializer = null, array $propertyValidators = [])
{
$propertyValidators = array_merge($propertyValidators, [
new LegalEntityEntityReferencePropertyValidator(),
diff --git a/tests/Api/Monetization/EntitySerializer/ApiPackageSerializerValidator.php b/tests/Api/Monetization/EntitySerializer/ApiPackageSerializerValidator.php
index 4372ddea5..abf6570d3 100644
--- a/tests/Api/Monetization/EntitySerializer/ApiPackageSerializerValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/ApiPackageSerializerValidator.php
@@ -26,10 +26,10 @@ class ApiPackageSerializerValidator extends OrganizationAwareEntitySerializerVal
/**
* ApiPackageSerializerValidator constructor.
*
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface $serializer
+ * @param EntitySerializerInterface $serializer
* @param array $propertyValidators
*/
- public function __construct(EntitySerializerInterface $serializer = null, array $propertyValidators = [])
+ public function __construct(?EntitySerializerInterface $serializer = null, array $propertyValidators = [])
{
$propertyValidators = array_merge($propertyValidators, [
new ApiProductsPropertyValidator(),
diff --git a/tests/Api/Monetization/EntitySerializer/DeveloperEntitySerializerValidator.php b/tests/Api/Monetization/EntitySerializer/DeveloperEntitySerializerValidator.php
index fa36e4f1b..8bbe30e67 100644
--- a/tests/Api/Monetization/EntitySerializer/DeveloperEntitySerializerValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/DeveloperEntitySerializerValidator.php
@@ -26,7 +26,7 @@ class DeveloperEntitySerializerValidator extends LegalEntitySerializerValidator
/**
* LegalEntitySerializerValidator constructor.
*
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface $serializer
+ * @param EntitySerializerInterface $serializer
* @param array $propertyValidators
*/
public function __construct(EntitySerializerInterface $serializer, array $propertyValidators = [])
diff --git a/tests/Api/Monetization/EntitySerializer/LegalEntitySerializerValidator.php b/tests/Api/Monetization/EntitySerializer/LegalEntitySerializerValidator.php
index 4e9c71c1b..2f4cb0ccd 100644
--- a/tests/Api/Monetization/EntitySerializer/LegalEntitySerializerValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/LegalEntitySerializerValidator.php
@@ -28,10 +28,10 @@ class LegalEntitySerializerValidator extends OrganizationAwareEntitySerializerVa
/**
* LegalEntitySerializerValidator constructor.
*
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $serializer
+ * @param EntitySerializerInterface|null $serializer
* @param array $propertyValidators
*/
- public function __construct(EntitySerializerInterface $serializer = null, array $propertyValidators = [])
+ public function __construct(?EntitySerializerInterface $serializer = null, array $propertyValidators = [])
{
$propertyValidators = array_merge($propertyValidators, [
new CustomAttributesPropertyValidator(),
diff --git a/tests/Api/Monetization/EntitySerializer/OrganizationAwareEntitySerializerValidator.php b/tests/Api/Monetization/EntitySerializer/OrganizationAwareEntitySerializerValidator.php
index 1a744e2c4..120009450 100644
--- a/tests/Api/Monetization/EntitySerializer/OrganizationAwareEntitySerializerValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/OrganizationAwareEntitySerializerValidator.php
@@ -27,10 +27,10 @@ class OrganizationAwareEntitySerializerValidator extends EntitySerializerValidat
/**
* OrganizationAwareEntitySerializerValidator constructor.
*
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface|null $serializer
+ * @param EntitySerializerInterface|null $serializer
* @param array $propertyValidators
*/
- public function __construct(EntitySerializerInterface $serializer = null, array $propertyValidators = [])
+ public function __construct(?EntitySerializerInterface $serializer = null, array $propertyValidators = [])
{
$propertyValidators = array_merge($propertyValidators, [
new OrganizationProfileEntityReferencePropertyValidator(),
diff --git a/tests/Api/Monetization/EntitySerializer/PrepaidBalanceSerializerValidator.php b/tests/Api/Monetization/EntitySerializer/PrepaidBalanceSerializerValidator.php
index 140517822..f209bd715 100644
--- a/tests/Api/Monetization/EntitySerializer/PrepaidBalanceSerializerValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/PrepaidBalanceSerializerValidator.php
@@ -30,10 +30,10 @@ class PrepaidBalanceSerializerValidator extends OrganizationAwareEntitySerialize
/**
* PrepaidBalanceSerializerValidator constructor.
*
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface $serializer
+ * @param EntitySerializerInterface $serializer
* @param array $propertyValidators
*/
- public function __construct(EntitySerializerInterface $serializer = null, array $propertyValidators = [])
+ public function __construct(?EntitySerializerInterface $serializer = null, array $propertyValidators = [])
{
$propertyValidators = array_merge($propertyValidators, [
new SupportedCurrencyEntityReferencePropertyValidator(),
diff --git a/tests/Api/Monetization/EntitySerializer/PropertyValidator/ApiPackageEntityReferencePropertyValidator.php b/tests/Api/Monetization/EntitySerializer/PropertyValidator/ApiPackageEntityReferencePropertyValidator.php
index 8817b3d6b..63691e15f 100644
--- a/tests/Api/Monetization/EntitySerializer/PropertyValidator/ApiPackageEntityReferencePropertyValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/PropertyValidator/ApiPackageEntityReferencePropertyValidator.php
@@ -25,6 +25,7 @@
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\RemoveIfPropertyValidPropertyValidatorInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use stdClass;
class ApiPackageEntityReferencePropertyValidator implements RemoveIfPropertyValidPropertyValidatorInterface, \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface
{
@@ -45,7 +46,7 @@ public function __construct()
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
// At this moment only rate plans contain entity references.
if (!$entity instanceof RatePlanInterface) {
diff --git a/tests/Api/Monetization/EntitySerializer/PropertyValidator/ApiProductsPropertyValidator.php b/tests/Api/Monetization/EntitySerializer/PropertyValidator/ApiProductsPropertyValidator.php
index efdc49120..0d7325bae 100644
--- a/tests/Api/Monetization/EntitySerializer/PropertyValidator/ApiProductsPropertyValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/PropertyValidator/ApiProductsPropertyValidator.php
@@ -26,6 +26,7 @@
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use stdClass;
class ApiProductsPropertyValidator implements RemoveIfPropertyValidPropertyValidatorInterface, SerializerAwarePropertyValidatorInterface, PropertyValidatorsAwareValidatorInterface
{
@@ -35,7 +36,7 @@ class ApiProductsPropertyValidator implements RemoveIfPropertyValidPropertyValid
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
if (!$entity instanceof ApiProductsPropertyInterface) {
return;
diff --git a/tests/Api/Monetization/EntitySerializer/PropertyValidator/CompanyEntityReferencePropertyValidator.php b/tests/Api/Monetization/EntitySerializer/PropertyValidator/CompanyEntityReferencePropertyValidator.php
index ca579392d..c4a696b54 100644
--- a/tests/Api/Monetization/EntitySerializer/PropertyValidator/CompanyEntityReferencePropertyValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/PropertyValidator/CompanyEntityReferencePropertyValidator.php
@@ -24,6 +24,7 @@
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use stdClass;
class CompanyEntityReferencePropertyValidator implements RemoveIfPropertyValidPropertyValidatorInterface, SerializerAwarePropertyValidatorInterface
{
@@ -31,7 +32,7 @@ class CompanyEntityReferencePropertyValidator implements RemoveIfPropertyValidPr
setEntitySerializer as private traitSetEntitySerializer;
}
- /** @var \Apigee\Edge\Tests\Api\Monetization\EntitySerializer\PropertyValidator\OrganizationProfileEntityReferencePropertyValidator */
+ /** @var OrganizationProfileEntityReferencePropertyValidator */
protected $orgPropValidator;
/**
@@ -45,7 +46,7 @@ public function __construct()
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
if (!$entity instanceof Developer || !$entity->getCompany()) {
return;
diff --git a/tests/Api/Monetization/EntitySerializer/PropertyValidator/CurrencyEntityReferencePropertyValidator.php b/tests/Api/Monetization/EntitySerializer/PropertyValidator/CurrencyEntityReferencePropertyValidator.php
index 369e64d87..9abe14a21 100644
--- a/tests/Api/Monetization/EntitySerializer/PropertyValidator/CurrencyEntityReferencePropertyValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/PropertyValidator/CurrencyEntityReferencePropertyValidator.php
@@ -22,6 +22,7 @@
use Apigee\Edge\Entity\EntityInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use stdClass;
class CurrencyEntityReferencePropertyValidator implements \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\RemoveIfPropertyValidPropertyValidatorInterface, \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface
{
@@ -29,7 +30,7 @@ class CurrencyEntityReferencePropertyValidator implements \Apigee\Edge\Tests\Tes
setEntitySerializer as private traitSetEntitySerializer;
}
- /** @var \Apigee\Edge\Tests\Api\Monetization\EntitySerializer\PropertyValidator\OrganizationProfileEntityReferencePropertyValidator */
+ /** @var OrganizationProfileEntityReferencePropertyValidator */
protected $orgPropValidator;
/**
@@ -43,7 +44,7 @@ public function __construct()
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
if (!$entity instanceof CurrencyPropertyInterface) {
return;
diff --git a/tests/Api/Monetization/EntitySerializer/PropertyValidator/CustomAttributesPropertyValidator.php b/tests/Api/Monetization/EntitySerializer/PropertyValidator/CustomAttributesPropertyValidator.php
index e890fd01e..301fa778a 100644
--- a/tests/Api/Monetization/EntitySerializer/PropertyValidator/CustomAttributesPropertyValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/PropertyValidator/CustomAttributesPropertyValidator.php
@@ -23,6 +23,7 @@
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\PropertyValidatorInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use stdClass;
class CustomAttributesPropertyValidator implements PropertyValidatorInterface, \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface
{
@@ -31,7 +32,7 @@ class CustomAttributesPropertyValidator implements PropertyValidatorInterface, \
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
if (!$entity instanceof AttributesPropertyInterface) {
return;
diff --git a/tests/Api/Monetization/EntitySerializer/PropertyValidator/DeveloperCategoryEntityReferencePropertyValidator.php b/tests/Api/Monetization/EntitySerializer/PropertyValidator/DeveloperCategoryEntityReferencePropertyValidator.php
index 652a234ae..f37ec6f83 100644
--- a/tests/Api/Monetization/EntitySerializer/PropertyValidator/DeveloperCategoryEntityReferencePropertyValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/PropertyValidator/DeveloperCategoryEntityReferencePropertyValidator.php
@@ -23,6 +23,7 @@
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use stdClass;
class DeveloperCategoryEntityReferencePropertyValidator implements \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\RemoveIfPropertyValidPropertyValidatorInterface, SerializerAwarePropertyValidatorInterface
{
@@ -31,7 +32,7 @@ class DeveloperCategoryEntityReferencePropertyValidator implements \Apigee\Edge\
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
if (!$entity instanceof LegalEntityInterface) {
return;
diff --git a/tests/Api/Monetization/EntitySerializer/PropertyValidator/LegalEntityEntityReferencePropertyValidator.php b/tests/Api/Monetization/EntitySerializer/PropertyValidator/LegalEntityEntityReferencePropertyValidator.php
index 7fb4014b7..845c24e86 100644
--- a/tests/Api/Monetization/EntitySerializer/PropertyValidator/LegalEntityEntityReferencePropertyValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/PropertyValidator/LegalEntityEntityReferencePropertyValidator.php
@@ -22,6 +22,7 @@
use Apigee\Edge\Tests\Api\Monetization\EntitySerializer\LegalEntitySerializerValidator;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use stdClass;
class LegalEntityEntityReferencePropertyValidator implements \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\RemoveIfPropertyValidPropertyValidatorInterface, \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface
{
@@ -42,7 +43,7 @@ public function __construct()
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
if (!method_exists($entity, 'getCompany') && !method_exists($entity, 'getDeveloper')) {
return;
diff --git a/tests/Api/Monetization/EntitySerializer/PropertyValidator/OrganizationProfileEntityReferencePropertyValidator.php b/tests/Api/Monetization/EntitySerializer/PropertyValidator/OrganizationProfileEntityReferencePropertyValidator.php
index 8e42624e2..e824ba29e 100644
--- a/tests/Api/Monetization/EntitySerializer/PropertyValidator/OrganizationProfileEntityReferencePropertyValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/PropertyValidator/OrganizationProfileEntityReferencePropertyValidator.php
@@ -23,6 +23,7 @@
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\RemoveIfPropertyValidPropertyValidatorInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use stdClass;
class OrganizationProfileEntityReferencePropertyValidator implements RemoveIfPropertyValidPropertyValidatorInterface, \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface
{
@@ -31,7 +32,7 @@ class OrganizationProfileEntityReferencePropertyValidator implements RemoveIfPro
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
if (!$entity instanceof OrganizationPropertyInterface) {
return;
diff --git a/tests/Api/Monetization/EntitySerializer/PropertyValidator/ParentRatePlanEntityReferencePropertyValidator.php b/tests/Api/Monetization/EntitySerializer/PropertyValidator/ParentRatePlanEntityReferencePropertyValidator.php
index 2af0ad84b..72b328208 100644
--- a/tests/Api/Monetization/EntitySerializer/PropertyValidator/ParentRatePlanEntityReferencePropertyValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/PropertyValidator/ParentRatePlanEntityReferencePropertyValidator.php
@@ -22,6 +22,7 @@
use Apigee\Edge\Entity\EntityInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use stdClass;
class ParentRatePlanEntityReferencePropertyValidator implements \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\RemoveIfPropertyValidPropertyValidatorInterface, \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface
{
@@ -30,7 +31,7 @@ class ParentRatePlanEntityReferencePropertyValidator implements \Apigee\Edge\Tes
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
if (!$entity instanceof RatePlanRevisionInterface) {
return;
diff --git a/tests/Api/Monetization/EntitySerializer/PropertyValidator/PaymentTransactionPropertyValidator.php b/tests/Api/Monetization/EntitySerializer/PropertyValidator/PaymentTransactionPropertyValidator.php
index b80a6b5c9..bff7b681e 100644
--- a/tests/Api/Monetization/EntitySerializer/PropertyValidator/PaymentTransactionPropertyValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/PropertyValidator/PaymentTransactionPropertyValidator.php
@@ -26,6 +26,8 @@
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use ReflectionObject;
+use stdClass;
/**
* Even if payment transactions are not entities we extend the entity
@@ -51,7 +53,7 @@ public function __construct()
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
if (!$entity instanceof BalanceInterface || null === $entity->getTransaction()) {
return;
@@ -80,7 +82,7 @@ public function validate(\stdClass $input, \stdClass $output, EntityInterface $e
// this a different way.
// TODO Validate organization object before it gets removed.
unset($expected->organization);
- $ro = new \ReflectionObject($lentity);
+ $ro = new ReflectionObject($lentity);
$orgProp = $ro->getProperty('organization');
$orgProp->setAccessible(true);
// Only way to clear organization.
diff --git a/tests/Api/Monetization/EntitySerializer/PropertyValidator/RatePlanDetailsPropertyValidator.php b/tests/Api/Monetization/EntitySerializer/PropertyValidator/RatePlanDetailsPropertyValidator.php
index 3fe248ece..33157017a 100644
--- a/tests/Api/Monetization/EntitySerializer/PropertyValidator/RatePlanDetailsPropertyValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/PropertyValidator/RatePlanDetailsPropertyValidator.php
@@ -23,6 +23,7 @@
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\PropertyValidatorInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use stdClass;
class RatePlanDetailsPropertyValidator implements PropertyValidatorInterface, \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface
{
@@ -30,7 +31,7 @@ class RatePlanDetailsPropertyValidator implements PropertyValidatorInterface, \A
setEntitySerializer as private traitSetEntitySerializer;
}
- /** @var \Apigee\Edge\Tests\Api\Monetization\EntitySerializer\PropertyValidator\OrganizationProfileEntityReferencePropertyValidator */
+ /** @var OrganizationProfileEntityReferencePropertyValidator */
protected $orgPropValidator;
/**
@@ -44,7 +45,7 @@ public function __construct()
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
if (!$entity instanceof RatePlanInterface) {
return;
diff --git a/tests/Api/Monetization/EntitySerializer/PropertyValidator/RatePlanEntityReferencePropertyValidator.php b/tests/Api/Monetization/EntitySerializer/PropertyValidator/RatePlanEntityReferencePropertyValidator.php
index a2982ac32..c6d68c252 100644
--- a/tests/Api/Monetization/EntitySerializer/PropertyValidator/RatePlanEntityReferencePropertyValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/PropertyValidator/RatePlanEntityReferencePropertyValidator.php
@@ -24,6 +24,7 @@
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\RemoveIfPropertyValidPropertyValidatorInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorTrait;
use PHPUnit\Framework\Assert;
+use stdClass;
class RatePlanEntityReferencePropertyValidator implements RemoveIfPropertyValidPropertyValidatorInterface, \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface
{
@@ -44,7 +45,7 @@ public function __construct()
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
if (!$entity instanceof AcceptedRatePlanInterface) {
return;
diff --git a/tests/Api/Monetization/EntitySerializer/RatePlanSerializerValidator.php b/tests/Api/Monetization/EntitySerializer/RatePlanSerializerValidator.php
index 9134b85d4..b0ef9fa89 100644
--- a/tests/Api/Monetization/EntitySerializer/RatePlanSerializerValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/RatePlanSerializerValidator.php
@@ -27,16 +27,17 @@
use Apigee\Edge\Tests\Api\Monetization\EntitySerializer\PropertyValidator\LegalEntityEntityReferencePropertyValidator;
use Apigee\Edge\Tests\Api\Monetization\EntitySerializer\PropertyValidator\ParentRatePlanEntityReferencePropertyValidator;
use Apigee\Edge\Tests\Api\Monetization\EntitySerializer\PropertyValidator\RatePlanDetailsPropertyValidator;
+use stdClass;
class RatePlanSerializerValidator extends OrganizationAwareEntitySerializerValidator
{
/**
* RatePlanSerializerValidator constructor.
*
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface $serializer
+ * @param EntitySerializerInterface $serializer
* @param array $propertyValidators
*/
- public function __construct(EntitySerializerInterface $serializer = null, array $propertyValidators = [])
+ public function __construct(?EntitySerializerInterface $serializer = null, array $propertyValidators = [])
{
$propertyValidators = array_merge($propertyValidators, [
new CurrencyEntityReferencePropertyValidator(),
@@ -55,7 +56,7 @@ public function __construct(EntitySerializerInterface $serializer = null, array
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, EntityInterface $entity): void
+ public function validate(stdClass $input, EntityInterface $entity): void
{
/* @var \Apigee\Edge\Api\Monetization\Entity\StandardRatePlanInterface $entity */
// According to engineering this is a transient property and it should
diff --git a/tests/Api/Monetization/EntitySerializer/ReportDefinitionSerializerValidator.php b/tests/Api/Monetization/EntitySerializer/ReportDefinitionSerializerValidator.php
index a2190db71..df159beef 100644
--- a/tests/Api/Monetization/EntitySerializer/ReportDefinitionSerializerValidator.php
+++ b/tests/Api/Monetization/EntitySerializer/ReportDefinitionSerializerValidator.php
@@ -19,13 +19,14 @@
namespace Apigee\Edge\Tests\Api\Monetization\EntitySerializer;
use Apigee\Edge\Entity\EntityInterface;
+use stdClass;
class ReportDefinitionSerializerValidator extends OrganizationAwareEntitySerializerValidator
{
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, EntityInterface $entity): void
+ public function validate(stdClass $input, EntityInterface $entity): void
{
// Developer property gets removed from the normalized output so we
// do not validate it here.
diff --git a/tests/ClientTest.php b/tests/ClientTest.php
index 9d7761894..6f7cbd94e 100644
--- a/tests/ClientTest.php
+++ b/tests/ClientTest.php
@@ -22,6 +22,7 @@
use Apigee\Edge\Exception\ClientErrorException;
use Apigee\Edge\HttpClient\Plugin\Authentication\NullAuthentication;
use Apigee\Edge\HttpClient\Utility\Builder;
+use Exception;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use Http\Client\Common\Plugin\HeaderAppendPlugin;
@@ -35,11 +36,12 @@
*
* @group client
* @group mock
+ *
* @small
*/
class ClientTest extends TestCase
{
- /** @var \Http\Mock\Client */
+ /** @var MockHttpClient */
protected static $httpClient;
/**
@@ -69,7 +71,7 @@ public function testDefaultConfiguration()
/**
* @depends testDefaultConfiguration
*
- * @param \Apigee\Edge\Client $client
+ * @param Client $client
*/
public function testEndpointShouldBeOverridden(Client $client): void
{
@@ -109,7 +111,7 @@ public function testApiNotReachable(): void
static::$httpClient->addException(new NetworkException('', new Request('GET', 'http://example.com')));
$builder = new Builder(self::$httpClient);
- $client = new Client(new NullAuthentication(), null, [\Apigee\Edge\Client::CONFIG_HTTP_CLIENT_BUILDER => $builder]);
+ $client = new Client(new NullAuthentication(), null, [Client::CONFIG_HTTP_CLIENT_BUILDER => $builder]);
$client->get('/');
}
@@ -177,7 +179,7 @@ public function testClientExceptionWithErrorResponse(): void
$client = new Client(new NullAuthentication(), null, [Client::CONFIG_HTTP_CLIENT_BUILDER => $builder]);
try {
$client->get('/');
- } catch (\Exception $e) {
+ } catch (Exception $e) {
$this->assertInstanceOf(ClientErrorException::class, $e);
/* @var \Apigee\Edge\Exception\ClientErrorException $e */
$this->assertEquals($e->getEdgeErrorCode(), $errorCode);
@@ -201,7 +203,7 @@ public function testClientExceptionWithFaultResponse(): void
$client = new Client(new NullAuthentication(), null, [Client::CONFIG_HTTP_CLIENT_BUILDER => $builder]);
try {
$client->get('/');
- } catch (\Exception $e) {
+ } catch (Exception $e) {
$this->assertInstanceOf(ClientErrorException::class, $e);
/* @var \Apigee\Edge\Exception\ClientErrorException $e */
$this->assertEquals($e->getEdgeErrorCode(), $errorCode);
diff --git a/tests/Controller/AbstractControllerTest.php b/tests/Controller/AbstractControllerTest.php
index e8fc23912..4e198eeba 100644
--- a/tests/Controller/AbstractControllerTest.php
+++ b/tests/Controller/AbstractControllerTest.php
@@ -32,13 +32,14 @@
*
* @group controller
* @group mock
+ *
* @small
*/
class AbstractControllerTest extends TestCase
{
use MockClientAwareTrait;
- /** @var \Apigee\Edge\Controller\AbstractEntityController */
+ /** @var AbstractEntityController */
private static $stub;
public static function setUpBeforeClass(): void
@@ -57,7 +58,7 @@ protected function getBaseEndpointUri(): UriInterface
/**
* Exposes protected parseResponseToArray method for testing.
*
- * @param \Psr\Http\Message\ResponseInterface $response
+ * @param ResponseInterface $response
*
* @return array
*/
diff --git a/tests/Controller/PaginationHelperTraitTest.php b/tests/Controller/PaginationHelperTraitTest.php
index bb7b7faa2..f016df52a 100644
--- a/tests/Controller/PaginationHelperTraitTest.php
+++ b/tests/Controller/PaginationHelperTraitTest.php
@@ -43,7 +43,7 @@ class PaginationHelperTraitTest extends TestCase
{
use MockClientAwareTrait;
- /** @var \Apigee\Edge\Tests\Controller\PaginationHelperTraitTestClass */
+ /** @var PaginationHelperTraitTestClass */
protected static $testController;
/**
diff --git a/tests/HttpClient/Plugin/ApigeeOnGcpOauth2Test.php b/tests/HttpClient/Plugin/ApigeeOnGcpOauth2Test.php
index 84145d20e..ff2714fd4 100644
--- a/tests/HttpClient/Plugin/ApigeeOnGcpOauth2Test.php
+++ b/tests/HttpClient/Plugin/ApigeeOnGcpOauth2Test.php
@@ -33,19 +33,20 @@
* Class ApigeeOnGcpOauth2Test.
*
* @group client
+ *
* @small
*/
class ApigeeOnGcpOauth2Test extends TestCase
{
private const API_ENDPOINT = 'http://api.example.com/v1';
- /** @var \Apigee\Edge\Tests\Test\HttpClient\MockHttpClient */
+ /** @var MockHttpClient */
protected static $httpClient;
/** @var \Apigee\Edge\HttpClient\Utility\JournalInterface */
private $journal;
- /** @var \Apigee\Edge\ClientInterface */
+ /** @var ClientInterface */
private $client;
/** @var \Apigee\Edge\HttpClient\Plugin\Authentication\OauthTokenStorageInterface */
@@ -171,7 +172,7 @@ public function testOauthReAuthenticationAfterExpiredAccessToken(): void
* @param array $options
* Client options.
*
- * @return \Apigee\Edge\ClientInterface
+ * @return ClientInterface
* API client for the test.
*/
private function buildClient(array $options = []): ClientInterface
diff --git a/tests/HttpClient/Plugin/HybridOauth2Test.php b/tests/HttpClient/Plugin/HybridOauth2Test.php
index e29156b7e..75eda7b1b 100644
--- a/tests/HttpClient/Plugin/HybridOauth2Test.php
+++ b/tests/HttpClient/Plugin/HybridOauth2Test.php
@@ -33,6 +33,7 @@
* Class HybridOauth2Test.
*
* @group client
+ *
* @small
*
* @deprecated in 2.0.9, will be removed in 3.0.0.
@@ -42,13 +43,13 @@ class HybridOauth2Test extends TestCase
{
private const API_ENDPOINT = 'http://api.example.com/v1';
- /** @var \Apigee\Edge\Tests\Test\HttpClient\MockHttpClient */
+ /** @var MockHttpClient */
protected static $httpClient;
/** @var \Apigee\Edge\HttpClient\Utility\JournalInterface */
private $journal;
- /** @var \Apigee\Edge\ClientInterface */
+ /** @var ClientInterface */
private $client;
/** @var \Apigee\Edge\HttpClient\Plugin\Authentication\OauthTokenStorageInterface */
@@ -174,7 +175,7 @@ public function testOauthReAuthenticationAfterExpiredAccessToken(): void
* @param array $options
* Client options.
*
- * @return \Apigee\Edge\ClientInterface
+ * @return ClientInterface
* API client for the test.
*/
private function buildClient(array $options = []): ClientInterface
diff --git a/tests/HttpClient/Plugin/OauthTest.php b/tests/HttpClient/Plugin/OauthTest.php
index 27998510d..5571e484c 100644
--- a/tests/HttpClient/Plugin/OauthTest.php
+++ b/tests/HttpClient/Plugin/OauthTest.php
@@ -33,19 +33,20 @@
* Class OauthTest.
*
* @group client
+ *
* @small
*/
class OauthTest extends TestCase
{
private const API_ENDPOINT = 'http://api.example.com/v1';
- /** @var \Apigee\Edge\Tests\Test\HttpClient\MockHttpClient */
+ /** @var MockHttpClient */
protected static $httpClient;
/** @var \Apigee\Edge\HttpClient\Utility\JournalInterface */
private $journal;
- /** @var \Apigee\Edge\ClientInterface */
+ /** @var ClientInterface */
private $client;
/**
@@ -243,7 +244,7 @@ public function testServerErrorMeanwhileRefreshingTokenWithRetryPlugin(): void
* @param array $options
* Client options.
*
- * @return \Apigee\Edge\ClientInterface
+ * @return ClientInterface
* API client for the test.
*/
private function buildClient(array $options = []): ClientInterface
diff --git a/tests/HttpClient/Utility/BuilderTest.php b/tests/HttpClient/Utility/BuilderTest.php
index 61a41bc79..6803ce203 100644
--- a/tests/HttpClient/Utility/BuilderTest.php
+++ b/tests/HttpClient/Utility/BuilderTest.php
@@ -31,11 +31,12 @@
* @group client
* @group mock
* @group offline
+ *
* @small
*/
class BuilderTest extends TestCase
{
- /** @var \Apigee\Edge\Tests\Test\HttpClient\MockHttpClient */
+ /** @var MockHttpClient */
protected static $httpClient;
/**
@@ -78,7 +79,7 @@ public function testShouldSetHeaders()
/**
* @depends testShouldSetHeaders
*
- * @param \Apigee\Edge\HttpClient\Utility\Builder $builder
+ * @param Builder $builder
*/
public function testShouldSetHeaderValue(Builder $builder): void
{
@@ -96,7 +97,7 @@ public function testShouldSetHeaderValue(Builder $builder): void
/**
* @depends testShouldSetHeaders
*
- * @param \Apigee\Edge\HttpClient\Utility\Builder $builder
+ * @param Builder $builder
*/
public function testShouldRemoveHeader(Builder $builder): void
{
@@ -112,7 +113,7 @@ public function testShouldRemoveHeader(Builder $builder): void
/**
* @depends testShouldSetHeaders
*
- * @param \Apigee\Edge\HttpClient\Utility\Builder $builder
+ * @param Builder $builder
*/
public function testShouldRemoveAllHeaders(Builder $builder): void
{
@@ -145,7 +146,7 @@ public function testShouldAddPlugin()
/**
* @depends testShouldAddPlugin
*
- * @param \Apigee\Edge\HttpClient\Utility\Builder $builder
+ * @param Builder $builder
*/
public function testShouldRemovePlugin(Builder $builder): void
{
diff --git a/tests/PropertyAccess/DeprecatedPropertyTraitTest.php b/tests/PropertyAccess/DeprecatedPropertyTraitTest.php
index 14c713154..cea8474fb 100644
--- a/tests/PropertyAccess/DeprecatedPropertyTraitTest.php
+++ b/tests/PropertyAccess/DeprecatedPropertyTraitTest.php
@@ -19,6 +19,8 @@
namespace Apigee\Edge\Tests\PropertyAccess;
use Apigee\Edge\Utility\DeprecatedPropertyTrait;
+use Exception;
+use LogicException;
use PHPUnit\Framework\TestCase;
class DeprecatedPropertyTraitTest extends TestCase
@@ -28,14 +30,14 @@ class DeprecatedPropertyTraitTest extends TestCase
*/
public function testUndeclaredDeprecatedProperties(): void
{
- $a = new class() {
+ $a = new class {
use DeprecatedPropertyTrait;
};
try {
$c = $a->b;
- } catch (\Exception $exception) {
- $this->assertInstanceOf(\LogicException::class, $exception);
+ } catch (Exception $exception) {
+ $this->assertInstanceOf(LogicException::class, $exception);
}
}
@@ -44,7 +46,7 @@ public function testUndeclaredDeprecatedProperties(): void
*/
public function testdeprecatedProperties(): void
{
- $a = new class() {
+ $a = new class {
use DeprecatedPropertyTrait;
public $new = 'ABC';
protected $deprecatedProperties = [
@@ -60,15 +62,15 @@ public function testdeprecatedProperties(): void
// Try accessing "removed" property.
try {
$c = $a->removed;
- } catch (\Exception $exception1) {
- $this->assertInstanceOf(\LogicException::class, $exception1);
+ } catch (Exception $exception1) {
+ $this->assertInstanceOf(LogicException::class, $exception1);
}
// Try accessing "invalid" property, where it's replacement "undeclared" is invalid.
try {
$c = $a->invalid;
- } catch (\Exception $exception2) {
- $this->assertInstanceOf(\LogicException::class, $exception2);
+ } catch (Exception $exception2) {
+ $this->assertInstanceOf(LogicException::class, $exception2);
} finally {
if (!isset($exception2)) {
$this->fail('An exception should have been thrown.');
diff --git a/tests/PropertyAccess/PropertyAccessorDecoratorTest.php b/tests/PropertyAccess/PropertyAccessorDecoratorTest.php
index 1f40fc186..205df29aa 100644
--- a/tests/PropertyAccess/PropertyAccessorDecoratorTest.php
+++ b/tests/PropertyAccess/PropertyAccessorDecoratorTest.php
@@ -20,17 +20,23 @@
use Apigee\Edge\Exception\UnexpectedValueException;
use Apigee\Edge\PropertyAccess\PropertyAccessorDecorator;
+use Exception;
+
+use const PHP_VERSION_ID;
+
+use ReflectionClass;
use Symfony\Component\PropertyAccess\Exception\AccessException;
use Symfony\Component\PropertyAccess\Exception\InvalidArgumentException;
use Symfony\Component\PropertyAccess\PropertyAccessor;
use Symfony\Component\PropertyAccess\Tests\PropertyAccessorTest;
+use TypeError;
class PropertyAccessorDecoratorTest extends PropertyAccessorTest
{
use PhpUnitBcBridgeTrait;
/**
- * @var \Apigee\Edge\PropertyAccess\PropertyAccessorDecorator
+ * @var PropertyAccessorDecorator
*/
private $propertyAccessor;
@@ -43,7 +49,7 @@ class PropertyAccessorDecoratorTest extends PropertyAccessorTest
public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();
- static::$testObj = new class() {
+ static::$testObj = new class {
/** @var string[] */
private $shouldBeAStringArray;
@@ -116,7 +122,7 @@ protected function setUp(): void
// Killing some kittens but still better than copy-pasting all tests
// from parent. Our decorator must work the same as the decorated
// class.
- $ro = new \ReflectionClass(PropertyAccessorTest::class);
+ $ro = new ReflectionClass(PropertyAccessorTest::class);
$property = $ro->getProperty('propertyAccessor');
$property->setAccessible(true);
$property->setValue($this, $this->propertyAccessor);
@@ -125,11 +131,11 @@ protected function setUp(): void
/**
* @dataProvider exceptionsToGetOnGetValue
*/
- public function testGetValueWithInvalidReturns(string $property, string $expectedException, string $expectedExceptionMessageRegexp = null): void
+ public function testGetValueWithInvalidReturns(string $property, string $expectedException, ?string $expectedExceptionMessageRegexp = null): void
{
try {
$this->propertyAccessor->getValue(static::$testObj, $property);
- } catch (\Exception | \TypeError $exception) {
+ } catch (Exception|TypeError $exception) {
$this->assertInstanceOf($expectedException, $exception);
if (null !== $expectedExceptionMessageRegexp) {
$this->assertMatchesRegularExpression($expectedExceptionMessageRegexp, $exception->getMessage());
@@ -159,7 +165,7 @@ public function testSetValueWithInvalidVariableLengthArgs(string $property, $val
{
try {
$this->propertyAccessor->setValue(static::$testObj, $property, $value);
- } catch (\Exception | \TypeError $exception) {
+ } catch (Exception|TypeError $exception) {
$this->assertInstanceOf($expectedException, $exception);
$this->assertMatchesRegularExpression($expectedExceptionMessage, $exception->getMessage());
} finally {
@@ -182,16 +188,15 @@ public function exceptionsToGetOnGetValue(): array
// https://github.com/symfony/property-access/commit/e1a6c91c0007e45bc1beba929c76548ca9fe8a85
$shouldBeAString = ['shouldBeAStringArray', AccessException::class];
- if (\PHP_VERSION_ID < 80000) {
+ if (PHP_VERSION_ID < 80000) {
return [
$shouldBeAString,
['shouldBeAString', UnexpectedValueException::class, '/Invalid value returned for shouldBeAString property on instance of class@anonymous.* class. Expected type "string", got "stdClass".$/'],
];
- }
- else{
+ } else {
return [
$shouldBeAString,
- ['shouldBeAString', \TypeError::class, '/Return value must be of type string, stdClass returned/'],
+ ['shouldBeAString', TypeError::class, '/Return value must be of type string, stdClass returned/'],
];
}
}
@@ -199,14 +204,13 @@ public function exceptionsToGetOnGetValue(): array
public function exceptionsToGetOnSetValue(): array
{
// We will be checking the php version as the exception returned in php 8 is different from php 7.
- if (\PHP_VERSION_ID < 80000) {
+ if (PHP_VERSION_ID < 80000) {
return [
['shouldBeAStringArray', [null], InvalidArgumentException::class, '/^Expected argument of type "string", "null" given/'],
];
- }
- else {
+ } else {
return [
- ['shouldBeAStringArray', [null], \TypeError::class, '/Argument #1 must be of type string, null given/'],
+ ['shouldBeAStringArray', [null], TypeError::class, '/Argument #1 must be of type string, null given/'],
];
}
}
diff --git a/tests/Serializer/EntitySerializerTest.php b/tests/Serializer/EntitySerializerTest.php
index 4fff02716..fad933293 100644
--- a/tests/Serializer/EntitySerializerTest.php
+++ b/tests/Serializer/EntitySerializerTest.php
@@ -27,11 +27,19 @@
use Apigee\Edge\Normalizer\PropertiesPropertyNormalizer;
use Apigee\Edge\Serializer\EntitySerializer;
use Apigee\Edge\Tests\Test\Entity\MockEntity;
+use DateTimeImmutable;
use GuzzleHttp\Psr7\Response;
use GuzzleHttp\Psr7\Utils;
+
+use const PHP_VERSION_ID;
+
use PHPUnit\Framework\TestCase;
+use ReflectionObject;
+use ReflectionProperty;
use SebastianBergmann\Comparator\ComparisonFailure;
use SebastianBergmann\Comparator\Factory as ComparisonFactory;
+use stdClass;
+use TypeError;
/**
* Class EntityTransformationTest.
@@ -44,11 +52,12 @@
*
* @group normalizer
* @group denormalizer
+ *
* @small
*/
class EntitySerializerTest extends TestCase
{
- /** @var \Apigee\Edge\Serializer\EntitySerializer */
+ /** @var EntitySerializer */
protected static $serializer;
/**
@@ -93,7 +102,7 @@ public function testNormalize()
$this->assertEquals('foo', $normalized->appCredential[0]->apiProducts[0]->apiproduct);
$this->assertEquals('foo', $normalized->appCredential[0]->attributes[0]->name);
$this->assertObjectNotHasAttribute('date', $normalized);
- $date = new \DateTimeImmutable();
+ $date = new DateTimeImmutable();
$entity->setDate($date);
$normalized = static::$serializer->normalize($entity);
$this->assertEquals($entity->getDate()->getTimestamp() * 1000, $normalized->date);
@@ -104,13 +113,13 @@ public function testNormalize()
/**
* @depends testNormalize
*
- * @param \stdClass $normalized
+ * @param stdClass $normalized
*/
public function testDenormalize(mixed $normalized): void
{
// Set value of this nullable value to ensure that a special condition is triggered in the EntityDenormalizer.
$normalized->nullable = null;
- /** @var \Apigee\Edge\Tests\Test\Entity\MockEntity $object */
+ /** @var MockEntity $object */
$object = static::$serializer->denormalize($normalized, MockEntity::class);
$this->assertTrue(true === $object->isBool());
$this->assertTrue(2 === $object->getInt());
@@ -127,7 +136,7 @@ public function testDenormalize(mixed $normalized): void
$this->assertNull($object->getAppCredential()[0]->getExpiresAt());
$this->assertEquals('foo', $object->getAppCredential()[0]->getApiProducts()[0]->getApiproduct());
$this->assertEquals('bar', $object->getAppCredential()[0]->getAttributeValue('foo'));
- $this->assertEquals(new \DateTimeImmutable('@' . $normalized->date / 1000), $object->getDate());
+ $this->assertEquals(new DateTimeImmutable('@' . $normalized->date / 1000), $object->getDate());
$renormalized = static::$serializer->normalize($object);
// Unset it to ensure that the two objects can be equal.
unset($normalized->nullable);
@@ -160,10 +169,10 @@ public function testSetPropertiesFromResponseWithValidValues(): void
$this->assertEquals($response->variableLengthArgs, $entity->getVariableLengthArgs());
// These properties should not change.
$this->assertEquals($original->getPropertyWithoutSetter(), $entity->getPropertyWithoutSetter());
- $roOriginal = new \ReflectionObject($original);
- $roEntity = new \ReflectionObject($entity);
- /** @var \ReflectionProperty $originalProperty */
- /** @var \ReflectionProperty $entityProperty */
+ $roOriginal = new ReflectionObject($original);
+ $roEntity = new ReflectionObject($entity);
+ /** @var ReflectionProperty $originalProperty */
+ /** @var ReflectionProperty $entityProperty */
$originalProperty = $roOriginal->getProperty('propertyWithoutGetter');
$originalProperty->setAccessible(true);
$entityProperty = $roEntity->getProperty('propertyWithoutGetter');
@@ -181,11 +190,11 @@ public function testSetPropertiesFromResponseWithValidValues(): void
public function testSetPropertiesFromResponseWithInvalidValue(): void
{
- if (\PHP_VERSION_ID < 80000) {
+ if (PHP_VERSION_ID < 80000) {
$this->expectException('\Symfony\Component\Serializer\Exception\NotNormalizableValueException');
$this->expectExceptionMessage('Expected argument of type "string", "object" given.');
} else {
- $this->expectException(\TypeError::class);
+ $this->expectException(TypeError::class);
$this->expectExceptionMessage('Argument #1 must be of type string, stdClass given');
}
diff --git a/tests/Structure/AttributesPropertyTransformationTest.php b/tests/Structure/AttributesPropertyTransformationTest.php
index 0dcff5521..577a66a46 100644
--- a/tests/Structure/AttributesPropertyTransformationTest.php
+++ b/tests/Structure/AttributesPropertyTransformationTest.php
@@ -33,14 +33,15 @@
* @group structure
* @group normalizer
* @group denormalizer
+ *
* @small
*/
class AttributesPropertyTransformationTest extends TestCase
{
- /** @var \Apigee\Edge\Normalizer\KeyValueMapNormalizer */
+ /** @var KeyValueMapNormalizer */
protected static $normalizer;
- /** @var \Apigee\Edge\Denormalizer\AttributesPropertyDenormalizer */
+ /** @var AttributesPropertyDenormalizer */
protected static $denormalizer;
/**
@@ -72,7 +73,7 @@ public function testNormalize()
*/
public function testDenormalize(array $normalized): void
{
- /** @var \Apigee\Edge\Structure\AttributesProperty $object */
+ /** @var AttributesProperty $object */
$object = static::$denormalizer->denormalize($normalized, AttributesProperty::class);
$this->assertTrue($object->has('foo'));
$this->assertEquals('bar', $object->getValue('foo'));
diff --git a/tests/Structure/PropertiesPropertyTransformationTest.php b/tests/Structure/PropertiesPropertyTransformationTest.php
index 8dff7849e..179e5bcea 100644
--- a/tests/Structure/PropertiesPropertyTransformationTest.php
+++ b/tests/Structure/PropertiesPropertyTransformationTest.php
@@ -24,6 +24,7 @@
use PHPUnit\Framework\TestCase;
use SebastianBergmann\Comparator\ComparisonFailure;
use SebastianBergmann\Comparator\Factory as ComparisonFactory;
+use stdClass;
/**
* Class PropertiesPropertyTransformationTest.
@@ -33,14 +34,15 @@
* @group structure
* @group normalizer
* @group denormalizer
+ *
* @small
*/
class PropertiesPropertyTransformationTest extends TestCase
{
- /** @var \Apigee\Edge\Normalizer\PropertiesPropertyNormalizer */
+ /** @var PropertiesPropertyNormalizer */
protected static $normalizer;
- /** @var \Apigee\Edge\Denormalizer\PropertiesPropertyDenormalizer */
+ /** @var PropertiesPropertyDenormalizer */
protected static $denormalizer;
/**
@@ -69,11 +71,11 @@ public function testNormalize()
/**
* @depends testNormalize
*
- * @param \stdClass $normalized
+ * @param stdClass $normalized
*/
public function testDenormalize(mixed $normalized): void
{
- /** @var \Apigee\Edge\Structure\PropertiesProperty $object */
+ /** @var PropertiesProperty $object */
$object = static::$denormalizer->denormalize($normalized, PropertiesProperty::class);
$this->assertTrue($object->has('features.isCpsEnabled'));
$this->assertEquals('true', $object->getValue('features.isCpsEnabled'));
diff --git a/tests/Test/Client.php b/tests/Test/Client.php
index 6007c70fe..c6d26e1f8 100644
--- a/tests/Test/Client.php
+++ b/tests/Test/Client.php
@@ -29,7 +29,7 @@ class Client extends OnlineClientBase implements OnlineClientInterface
/**
* Client constructor.
*
- * @param \Http\Message\Authentication $authentication
+ * @param Authentication $authentication
* @param string|null $endpoint
* @param array $options
*/
diff --git a/tests/Test/Controller/ControllerTestBase.php b/tests/Test/Controller/ControllerTestBase.php
index d7e28da59..fc224ef31 100644
--- a/tests/Test/Controller/ControllerTestBase.php
+++ b/tests/Test/Controller/ControllerTestBase.php
@@ -35,7 +35,7 @@ abstract class ControllerTestBase extends TestCase
/**
* {@inheritdoc}
*/
- public static function markOnlineTestSkipped(string $testName, ClientInterface $client = null): void
+ public static function markOnlineTestSkipped(string $testName, ?ClientInterface $client = null): void
{
$client = $client ?? static::defaultAPIClient();
if (TestClientFactory::isOfflineClient($client)) {
@@ -62,7 +62,7 @@ protected static function defaultAPIClient(): ClientInterface
/**
* Returns the same random generator in tests.
*
- * @return \Apigee\Edge\Tests\Test\Utility\RandomGeneratorInterface
+ * @return RandomGeneratorInterface
*/
protected static function randomGenerator(): RandomGeneratorInterface
{
diff --git a/tests/Test/Controller/DefaultAPIClientAwareTrait.php b/tests/Test/Controller/DefaultAPIClientAwareTrait.php
index 75b5c20b7..60db67ff4 100644
--- a/tests/Test/Controller/DefaultAPIClientAwareTrait.php
+++ b/tests/Test/Controller/DefaultAPIClientAwareTrait.php
@@ -28,7 +28,7 @@ trait DefaultAPIClientAwareTrait
* Default API client decided by TestClientFactory based on the predefined
* environment variables.
*
- * @return \Apigee\Edge\ClientInterface
+ * @return ClientInterface
*/
abstract protected static function defaultAPIClient(): ClientInterface;
}
diff --git a/tests/Test/Controller/DefaultTestOrganizationAwareTrait.php b/tests/Test/Controller/DefaultTestOrganizationAwareTrait.php
index 81968555d..fa04cc3f5 100644
--- a/tests/Test/Controller/DefaultTestOrganizationAwareTrait.php
+++ b/tests/Test/Controller/DefaultTestOrganizationAwareTrait.php
@@ -26,7 +26,7 @@ trait DefaultTestOrganizationAwareTrait
* Returns the name of the default test organization that is used in the
* current test run.
*
- * @param \Apigee\Edge\ClientInterface $client
+ * @param ClientInterface $client
*
* @return string
*/
diff --git a/tests/Test/Controller/EntityControllerAwareTestTrait.php b/tests/Test/Controller/EntityControllerAwareTestTrait.php
index 3799c2300..536dd6b98 100644
--- a/tests/Test/Controller/EntityControllerAwareTestTrait.php
+++ b/tests/Test/Controller/EntityControllerAwareTestTrait.php
@@ -25,9 +25,9 @@ trait EntityControllerAwareTestTrait
/**
* Returns the decorated entity controller used in a test.
*
- * @param \Apigee\Edge\ClientInterface|null $client
+ * @param ClientInterface|null $client
*
- * @return \Apigee\Edge\Tests\Test\Controller\EntityControllerTesterInterface
+ * @return EntityControllerTesterInterface
*/
- abstract protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface;
+ abstract protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface;
}
diff --git a/tests/Test/Controller/EntityControllerTestBase.php b/tests/Test/Controller/EntityControllerTestBase.php
index b902c2a0d..a7f14d19d 100644
--- a/tests/Test/Controller/EntityControllerTestBase.php
+++ b/tests/Test/Controller/EntityControllerTestBase.php
@@ -25,6 +25,7 @@
use Apigee\Edge\Tests\Test\EntitySerializer\EntitySerializerValidatorAwareTrait;
use Apigee\Edge\Tests\Test\EntitySerializer\EntitySerializerValidatorInterface;
use Apigee\Edge\Tests\Test\Utility\EntityStorage;
+use ReflectionObject;
abstract class EntityControllerTestBase extends ControllerTestBase
{
@@ -53,7 +54,7 @@ public function tearDown(): void
static::$validator = null;
}
- abstract protected static function entityController(ClientInterface $client = null): EntityControllerTesterInterface;
+ abstract protected static function entityController(?ClientInterface $client = null): EntityControllerTesterInterface;
/**
* {@inheritdoc}
@@ -63,10 +64,10 @@ protected function entitySerializer(): EntitySerializerInterface
if (null === static::$instance) {
// TODO Find a better way to expose the entity serializer used by
// a controller.
- $ro = new \ReflectionObject(static::entityController());
+ $ro = new ReflectionObject(static::entityController());
$property = $ro->getProperty('decorated');
$property->setAccessible(true);
- $ro = new \ReflectionObject($property->getValue(static::entityController()));
+ $ro = new ReflectionObject($property->getValue(static::entityController()));
$rm = $ro->getMethod('getEntitySerializer');
$rm->setAccessible(true);
diff --git a/tests/Test/Controller/EntityControllerTester.php b/tests/Test/Controller/EntityControllerTester.php
index 3c7646124..9a5a41084 100644
--- a/tests/Test/Controller/EntityControllerTester.php
+++ b/tests/Test/Controller/EntityControllerTester.php
@@ -22,6 +22,7 @@
use Apigee\Edge\Controller\EntityDeleteOperationControllerInterface;
use Apigee\Edge\Controller\EntityUpdateOperationControllerInterface;
use Apigee\Edge\Tests\Test\Utility\EntityStorage;
+use InvalidArgumentException;
final class EntityControllerTester extends EntityControllerTesterBase implements EntityControllerTesterInterface
{
@@ -51,7 +52,7 @@ protected function validateController($controller): void
parent::validateController($controller);
if ($controller instanceof EntityControllerTesterInterface) {
$name = get_class($controller);
- throw new \InvalidArgumentException("A test controller should not be decorated again. Got {$name}.");
+ throw new InvalidArgumentException("A test controller should not be decorated again. Got {$name}.");
}
}
}
diff --git a/tests/Test/Controller/EntityControllerTesterBase.php b/tests/Test/Controller/EntityControllerTesterBase.php
index de4b62639..1e709f520 100644
--- a/tests/Test/Controller/EntityControllerTesterBase.php
+++ b/tests/Test/Controller/EntityControllerTesterBase.php
@@ -18,6 +18,9 @@
namespace Apigee\Edge\Tests\Test\Controller;
+use InvalidArgumentException;
+use ReflectionObject;
+
/**
* @internal
*/
@@ -46,7 +49,7 @@ public function __call($name, $arguments)
} elseif (method_exists($this->decorated, $name)) {
$object = $this->decorated;
} else {
- throw new \InvalidArgumentException("Method not found {$name}.");
+ throw new InvalidArgumentException("Method not found {$name}.");
}
return call_user_func_array([$object, $name], $arguments);
@@ -54,7 +57,7 @@ public function __call($name, $arguments)
public function instanceOf(string $fqcn): bool
{
- $ro = new \ReflectionObject($this);
+ $ro = new ReflectionObject($this);
if ($this->decorated instanceof EntityControllerTesterInterface) {
return $this->decorated->instanceOf($fqcn);
}
@@ -65,12 +68,12 @@ public function instanceOf(string $fqcn): bool
/**
* @param object $controller
*
- * @throws \InvalidArgumentException
+ * @throws InvalidArgumentException
*/
protected function validateController($controller): void
{
if (!is_object($controller)) {
- throw new \InvalidArgumentException('Controller must be an object.');
+ throw new InvalidArgumentException('Controller must be an object.');
}
}
}
diff --git a/tests/Test/Controller/EntityCreateOperationControllerTestTrait.php b/tests/Test/Controller/EntityCreateOperationControllerTestTrait.php
index 2d22b9754..77731927a 100644
--- a/tests/Test/Controller/EntityCreateOperationControllerTestTrait.php
+++ b/tests/Test/Controller/EntityCreateOperationControllerTestTrait.php
@@ -23,6 +23,7 @@
use Apigee\Edge\Tests\Test\EntitySerializer\EntitySerializerAwareTestTrait;
use Apigee\Edge\Tests\Test\EntitySerializer\EntitySerializerValidatorAwareTrait;
use DMS\PHPUnitExtensions\ArraySubset\Assert;
+use stdClass;
/**
* Validates controllers that support entity create operations.
@@ -67,7 +68,7 @@ protected function alterArraysBeforeCompareSentAndReceivedPayloadsInCreate(array
{
}
- protected function alterObjectsBeforeCompareResponseAndCreatedEntity(\stdClass &$responseObject, EntityInterface $created): void
+ protected function alterObjectsBeforeCompareResponseAndCreatedEntity(stdClass &$responseObject, EntityInterface $created): void
{
}
@@ -79,7 +80,7 @@ protected function entityForCreateTest(): EntityInterface
/**
* Controller for entity create operation testing.
*
- * @return \Apigee\Edge\Tests\Test\Controller\EntityCreateOperationTestControllerTesterInterface
+ * @return EntityCreateOperationTestControllerTesterInterface
*/
protected static function controllerForEntityCreate(): EntityCreateOperationTestControllerTesterInterface
{
diff --git a/tests/Test/Controller/EntityCreateOperationControllerTester.php b/tests/Test/Controller/EntityCreateOperationControllerTester.php
index 5788a2264..ca170255b 100644
--- a/tests/Test/Controller/EntityCreateOperationControllerTester.php
+++ b/tests/Test/Controller/EntityCreateOperationControllerTester.php
@@ -21,13 +21,14 @@
use Apigee\Edge\Controller\EntityCreateOperationControllerInterface;
use Apigee\Edge\Entity\EntityInterface;
use Apigee\Edge\Tests\Test\Utility\EntityStorage;
+use InvalidArgumentException;
final class EntityCreateOperationControllerTester extends EntityControllerTesterBase implements EntityCreateOperationTestControllerTesterInterface
{
/**
* Creates an entity in Apigee Edge.
*
- * @param \Apigee\Edge\Entity\EntityInterface $entity
+ * @param EntityInterface $entity
*/
public function create(EntityInterface $entity): void
{
@@ -46,7 +47,7 @@ protected function validateController($controller): void
parent::validateController($controller);
if (!$controller instanceof EntityCreateOperationControllerInterface && !$controller instanceof EntityControllerTesterInterface) {
$class = get_class($controller);
- throw new \InvalidArgumentException("Controller must implement EntityCreateOperationControllerInterface or EntityControllerTesterInterface. Got {$class}.");
+ throw new InvalidArgumentException("Controller must implement EntityCreateOperationControllerInterface or EntityControllerTesterInterface. Got {$class}.");
}
}
}
diff --git a/tests/Test/Controller/EntityDeleteOperationControllerTestTrait.php b/tests/Test/Controller/EntityDeleteOperationControllerTestTrait.php
index 12386b8a0..e8a6dff22 100644
--- a/tests/Test/Controller/EntityDeleteOperationControllerTestTrait.php
+++ b/tests/Test/Controller/EntityDeleteOperationControllerTestTrait.php
@@ -40,9 +40,10 @@ trait EntityDeleteOperationControllerTestTrait
/**
* @depends testUpdate
+ *
* @group online
*
- * @param \Apigee\Edge\Entity\EntityInterface $entity
+ * @param EntityInterface $entity
*/
public function testDelete(EntityInterface $entity): void
{
@@ -66,7 +67,7 @@ protected function validateDeletedEntity(EntityInterface $entity): void
/**
* Controller for entity load operation testing.
*
- * @return \Apigee\Edge\Tests\Test\Controller\EntityDeleteOperationControllerTesterInterface
+ * @return EntityDeleteOperationControllerTesterInterface
*/
protected static function controllerForEntityDelete(): EntityDeleteOperationControllerTesterInterface
{
@@ -79,7 +80,7 @@ protected static function controllerForEntityDelete(): EntityDeleteOperationCont
/**
* Provided by EntityLoadOperationControllerTestTrait out of the box.
*
- * @return \Apigee\Edge\Tests\Test\Controller\EntityLoadOperationControllerTesterInterface
+ * @return EntityLoadOperationControllerTesterInterface
*/
abstract protected static function controllerForEntityLoad(): EntityLoadOperationControllerTesterInterface;
}
diff --git a/tests/Test/Controller/EntityDeleteOperationControllerTester.php b/tests/Test/Controller/EntityDeleteOperationControllerTester.php
index 37d1eab86..c99a6f94e 100644
--- a/tests/Test/Controller/EntityDeleteOperationControllerTester.php
+++ b/tests/Test/Controller/EntityDeleteOperationControllerTester.php
@@ -21,6 +21,7 @@
use Apigee\Edge\Controller\EntityDeleteOperationControllerInterface;
use Apigee\Edge\Entity\EntityInterface;
use Apigee\Edge\Tests\Test\Utility\EntityStorage;
+use InvalidArgumentException;
final class EntityDeleteOperationControllerTester extends EntityControllerTesterBase implements EntityDeleteOperationControllerTesterInterface
{
@@ -46,7 +47,7 @@ protected function validateController($controller): void
parent::validateController($controller);
if (!$controller instanceof EntityDeleteOperationControllerInterface && !$controller instanceof EntityControllerTesterInterface) {
$class = get_class($controller);
- throw new \InvalidArgumentException("Controller must implement EntityDeleteOperationControllerInterface or EntityControllerTesterInterface. Got {$class}.");
+ throw new InvalidArgumentException("Controller must implement EntityDeleteOperationControllerInterface or EntityControllerTesterInterface. Got {$class}.");
}
}
}
diff --git a/tests/Test/Controller/EntityLoadOperationControllerTestTrait.php b/tests/Test/Controller/EntityLoadOperationControllerTestTrait.php
index 9450abdc8..7145afbd3 100644
--- a/tests/Test/Controller/EntityLoadOperationControllerTestTrait.php
+++ b/tests/Test/Controller/EntityLoadOperationControllerTestTrait.php
@@ -22,6 +22,7 @@
use Apigee\Edge\Entity\Property\DescriptionPropertyInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\EntitySerializerAwareTestTrait;
use Apigee\Edge\Tests\Test\EntitySerializer\EntitySerializerValidatorAwareTrait;
+use stdClass;
/**
* Validates controllers that support entity load operations.
@@ -37,7 +38,7 @@ trait EntityLoadOperationControllerTestTrait
/**
* @depends testCreate
*
- * @param \Apigee\Edge\Entity\EntityInterface $created
+ * @param EntityInterface $created
*/
public function testLoad(EntityInterface $created): EntityInterface
{
@@ -61,14 +62,14 @@ protected function validateLoadedEntity(EntityInterface $expected, EntityInterfa
$this->entitySerializerValidator()->validate($expectedAsObject, $actual);
}
- protected function alterObjectsBeforeCompareExpectedAndLoadedEntity(\stdClass &$expectedAsObject, EntityInterface $loaded): void
+ protected function alterObjectsBeforeCompareExpectedAndLoadedEntity(stdClass &$expectedAsObject, EntityInterface $loaded): void
{
}
/**
* Controller for entity load operation testing.
*
- * @return \Apigee\Edge\Tests\Test\Controller\EntityLoadOperationControllerTesterInterface
+ * @return EntityLoadOperationControllerTesterInterface
*/
protected static function controllerForEntityLoad(): EntityLoadOperationControllerTesterInterface
{
diff --git a/tests/Test/Controller/EntityLoadOperationControllerTester.php b/tests/Test/Controller/EntityLoadOperationControllerTester.php
index 46338731f..8234811f2 100644
--- a/tests/Test/Controller/EntityLoadOperationControllerTester.php
+++ b/tests/Test/Controller/EntityLoadOperationControllerTester.php
@@ -20,6 +20,7 @@
use Apigee\Edge\Controller\EntityLoadOperationControllerInterface;
use Apigee\Edge\Entity\EntityInterface;
+use InvalidArgumentException;
final class EntityLoadOperationControllerTester extends EntityControllerTesterBase implements EntityLoadOperationControllerTesterInterface
{
@@ -39,7 +40,7 @@ protected function validateController($controller): void
parent::validateController($controller);
if (!$controller instanceof EntityLoadOperationControllerInterface && !$controller instanceof EntityControllerTesterInterface) {
$class = get_class($controller);
- throw new \InvalidArgumentException("Controller must implement EntityLoadOperationControllerInterface or EntityControllerTesterInterface. Got {$class}.");
+ throw new InvalidArgumentException("Controller must implement EntityLoadOperationControllerInterface or EntityControllerTesterInterface. Got {$class}.");
}
}
}
diff --git a/tests/Test/Controller/EntityUpdateOperationControllerTestTrait.php b/tests/Test/Controller/EntityUpdateOperationControllerTestTrait.php
index 0352b12bc..1b0dc47ab 100644
--- a/tests/Test/Controller/EntityUpdateOperationControllerTestTrait.php
+++ b/tests/Test/Controller/EntityUpdateOperationControllerTestTrait.php
@@ -22,6 +22,7 @@
use Apigee\Edge\Tests\Test\EntitySerializer\EntitySerializerAwareTestTrait;
use Apigee\Edge\Tests\Test\EntitySerializer\EntitySerializerValidatorAwareTrait;
use DMS\PHPUnitExtensions\ArraySubset\Assert;
+use stdClass;
/**
* Validates controllers that support entity update operations.
@@ -38,7 +39,7 @@ trait EntityUpdateOperationControllerTestTrait
/**
* @depends testLoad
*
- * @param \Apigee\Edge\Entity\EntityInterface $existing
+ * @param EntityInterface $existing
*/
public function testUpdate(EntityInterface $existing): EntityInterface
{
@@ -76,14 +77,14 @@ protected function alterArraysBeforeCompareSentAndReceivedPayloadsInUpdate(array
{
}
- protected function alterObjectsBeforeCompareResponseAndUpdateEntity(\stdClass &$responseObject, EntityInterface $created): void
+ protected function alterObjectsBeforeCompareResponseAndUpdateEntity(stdClass &$responseObject, EntityInterface $created): void
{
}
/**
* Controller for entity update operation testing.
*
- * @return \Apigee\Edge\Tests\Test\Controller\EntityUpdateOperationControllerTesterInterface
+ * @return EntityUpdateOperationControllerTesterInterface
*/
protected static function controllerForEntityUpdate(): EntityUpdateOperationControllerTesterInterface
{
diff --git a/tests/Test/Controller/EntityUpdateOperationControllerTester.php b/tests/Test/Controller/EntityUpdateOperationControllerTester.php
index 28a40465a..f25f49dee 100644
--- a/tests/Test/Controller/EntityUpdateOperationControllerTester.php
+++ b/tests/Test/Controller/EntityUpdateOperationControllerTester.php
@@ -21,6 +21,7 @@
use Apigee\Edge\Controller\EntityUpdateOperationControllerInterface;
use Apigee\Edge\Entity\EntityInterface;
use Apigee\Edge\Tests\Test\Utility\EntityStorage;
+use InvalidArgumentException;
final class EntityUpdateOperationControllerTester extends EntityControllerTesterBase implements EntityUpdateOperationControllerTesterInterface
{
@@ -44,7 +45,7 @@ protected function validateController($controller): void
parent::validateController($controller);
if (!$controller instanceof EntityUpdateOperationControllerInterface && !$controller instanceof EntityControllerTesterInterface) {
$class = get_class($controller);
- throw new \InvalidArgumentException("Controller must implement EntityUpdateControllerOperationInterface or EntityControllerTesterInterface. Got {$class}.");
+ throw new InvalidArgumentException("Controller must implement EntityUpdateControllerOperationInterface or EntityControllerTesterInterface. Got {$class}.");
}
}
}
diff --git a/tests/Test/Controller/FileSystemMockAPIClientAwareTrait.php b/tests/Test/Controller/FileSystemMockAPIClientAwareTrait.php
index 6969f8cd6..32d7143a0 100644
--- a/tests/Test/Controller/FileSystemMockAPIClientAwareTrait.php
+++ b/tests/Test/Controller/FileSystemMockAPIClientAwareTrait.php
@@ -26,11 +26,11 @@ trait FileSystemMockAPIClientAwareTrait
/**
* Returns mock API client that reads API responses from the file system.
*
- * @return \Apigee\Edge\Tests\Test\FileSystemMockClient
+ * @return FileSystemMockClient
*/
protected static function fileSystemMockClient(): FileSystemMockClient
{
- /** @var \Apigee\Edge\Tests\Test\FileSystemMockClient $client */
+ /** @var FileSystemMockClient $client */
$client = TestClientFactory::getClient(FileSystemMockClient::class);
return $client;
diff --git a/tests/Test/Controller/MockClientAwareTrait.php b/tests/Test/Controller/MockClientAwareTrait.php
index 582d8c665..4d9313fd5 100644
--- a/tests/Test/Controller/MockClientAwareTrait.php
+++ b/tests/Test/Controller/MockClientAwareTrait.php
@@ -26,11 +26,11 @@ trait MockClientAwareTrait
/**
* Returns a mock API client.
*
- * @return \Apigee\Edge\Tests\Test\MockClient
+ * @return MockClient
*/
protected static function mockApiClient(): MockClient
{
- /** @var \Apigee\Edge\Tests\Test\MockClient $client */
+ /** @var MockClient $client */
$client = TestClientFactory::getClient(MockClient::class);
return $client;
diff --git a/tests/Test/DebuggerClient.php b/tests/Test/DebuggerClient.php
index 8bca940bc..6591eef65 100644
--- a/tests/Test/DebuggerClient.php
+++ b/tests/Test/DebuggerClient.php
@@ -26,7 +26,7 @@ class DebuggerClient extends OnlineClientBase implements OnlineClientInterface
/**
* DebuggerClient constructor.
*
- * @param \Http\Message\Authentication $authentication
+ * @param Authentication $authentication
* @param string|null $endpoint
* @param array $options
*/
diff --git a/tests/Test/Entity/MockEntity.php b/tests/Test/Entity/MockEntity.php
index 829000112..e40f0c047 100644
--- a/tests/Test/Entity/MockEntity.php
+++ b/tests/Test/Entity/MockEntity.php
@@ -25,6 +25,8 @@
use Apigee\Edge\Structure\AttributesProperty;
use Apigee\Edge\Structure\CredentialProduct;
use Apigee\Edge\Structure\PropertiesProperty;
+use DateTimeImmutable;
+use ReflectionException;
/**
* Dummy entity that we can use in ours tests.
@@ -66,10 +68,10 @@ class MockEntity extends Entity
/** @var \Apigee\Edge\Api\Management\Entity\AppCredential[] */
private $appCredential = [];
- /** @var \Apigee\Edge\Structure\CredentialProduct */
+ /** @var CredentialProduct */
private $credentialProduct;
- /** @var \DateTimeImmutable|null */
+ /** @var DateTimeImmutable|null */
private $date;
/**
@@ -88,7 +90,7 @@ class MockEntity extends Entity
*
* @param array $values
*
- * @throws \ReflectionException
+ * @throws ReflectionException
*/
public function __construct(array $values = [])
{
@@ -109,17 +111,17 @@ public function __construct(array $values = [])
}
/**
- * @return \DateTimeImmutable|null
+ * @return DateTimeImmutable|null
*/
- public function getDate(): ?\DateTimeImmutable
+ public function getDate(): ?DateTimeImmutable
{
return $this->date;
}
/**
- * @param \DateTimeImmutable|null $date
+ * @param DateTimeImmutable|null $date
*/
- public function setDate(?\DateTimeImmutable $date): void
+ public function setDate(?DateTimeImmutable $date): void
{
$this->date = $date;
}
@@ -218,7 +220,7 @@ public function setString(string $string): void
}
/**
- * @return \Apigee\Edge\Structure\CredentialProduct
+ * @return CredentialProduct
*/
public function getCredentialProduct(): CredentialProduct
{
@@ -226,7 +228,7 @@ public function getCredentialProduct(): CredentialProduct
}
/**
- * @param \Apigee\Edge\Structure\CredentialProduct $credentialProduct
+ * @param CredentialProduct $credentialProduct
*/
public function setCredentialProduct(CredentialProduct $credentialProduct): void
{
diff --git a/tests/Test/Entity/NewEntityProviderTrait.php b/tests/Test/Entity/NewEntityProviderTrait.php
index 5855786fe..cda6b200b 100644
--- a/tests/Test/Entity/NewEntityProviderTrait.php
+++ b/tests/Test/Entity/NewEntityProviderTrait.php
@@ -25,7 +25,7 @@ trait NewEntityProviderTrait
/**
* Returns a new entity for testing.
*
- * @return \Apigee\Edge\Entity\EntityInterface
+ * @return EntityInterface
*/
abstract protected static function getNewEntity(): EntityInterface;
}
diff --git a/tests/Test/EntitySerializer/EntitySerializerAwareTestTrait.php b/tests/Test/EntitySerializer/EntitySerializerAwareTestTrait.php
index 4b6f26b5e..b22bf5e5c 100644
--- a/tests/Test/EntitySerializer/EntitySerializerAwareTestTrait.php
+++ b/tests/Test/EntitySerializer/EntitySerializerAwareTestTrait.php
@@ -25,7 +25,7 @@ trait EntitySerializerAwareTestTrait
/**
* Returns the entity serializer used by the tested controller.
*
- * @return \Apigee\Edge\Serializer\EntitySerializerInterface
+ * @return EntitySerializerInterface
*/
abstract protected function entitySerializer(): EntitySerializerInterface;
}
diff --git a/tests/Test/EntitySerializer/EntitySerializerValidator.php b/tests/Test/EntitySerializer/EntitySerializerValidator.php
index a0163f386..5172f1295 100644
--- a/tests/Test/EntitySerializer/EntitySerializerValidator.php
+++ b/tests/Test/EntitySerializer/EntitySerializerValidator.php
@@ -24,23 +24,24 @@
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\PropertyValidatorsAwareValidatorInterface;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\PropertyValidatorsAwareValidatorTrait;
use Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\SerializerAwarePropertyValidatorInterface;
+use stdClass;
class EntitySerializerValidator implements EntitySerializerValidatorInterface
{
use PropertyValidatorsAwareValidatorTrait;
/**
- * @var \Apigee\Edge\Serializer\EntitySerializerInterface
+ * @var EntitySerializerInterface
*/
protected $serializer;
/**
* EntitySerializerValidator constructor.
*
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface $serializer
+ * @param EntitySerializerInterface $serializer
* @param array $propertyValidators
*/
- public function __construct(EntitySerializerInterface $serializer = null, array $propertyValidators = [])
+ public function __construct(?EntitySerializerInterface $serializer = null, array $propertyValidators = [])
{
$serializer = $serializer ?? new EntitySerializer();
$this->serializer = $serializer;
@@ -62,7 +63,7 @@ public function __construct(EntitySerializerInterface $serializer = null, array
/**
* {@inheritdoc}
*/
- public function validate(\stdClass $input, EntityInterface $entity): void
+ public function validate(stdClass $input, EntityInterface $entity): void
{
$output = json_decode($this->serializer->serialize($entity, 'json'));
$this->propertyValidatorsValidate($input, $output, $entity);
diff --git a/tests/Test/EntitySerializer/EntitySerializerValidatorAwareTrait.php b/tests/Test/EntitySerializer/EntitySerializerValidatorAwareTrait.php
index eaf9be5c9..fe211979b 100644
--- a/tests/Test/EntitySerializer/EntitySerializerValidatorAwareTrait.php
+++ b/tests/Test/EntitySerializer/EntitySerializerValidatorAwareTrait.php
@@ -23,7 +23,7 @@ trait EntitySerializerValidatorAwareTrait
/**
* Returns the entity serializer validator.
*
- * @return \Apigee\Edge\Tests\Test\EntitySerializer\EntitySerializerValidatorInterface
+ * @return EntitySerializerValidatorInterface
*/
abstract protected function entitySerializerValidator(): EntitySerializerValidatorInterface;
}
diff --git a/tests/Test/EntitySerializer/EntitySerializerValidatorInterface.php b/tests/Test/EntitySerializer/EntitySerializerValidatorInterface.php
index 83251a028..25dc6a782 100644
--- a/tests/Test/EntitySerializer/EntitySerializerValidatorInterface.php
+++ b/tests/Test/EntitySerializer/EntitySerializerValidatorInterface.php
@@ -19,16 +19,17 @@
namespace Apigee\Edge\Tests\Test\EntitySerializer;
use Apigee\Edge\Entity\EntityInterface;
+use stdClass;
interface EntitySerializerValidatorInterface
{
/**
* Validates entity objects created from API responses.
*
- * @param \stdClass $input
+ * @param stdClass $input
* JSON decoded raw API response as object.
- * @param \Apigee\Edge\Entity\EntityInterface $entity
+ * @param EntityInterface $entity
* Created entity object from the API response by a serializer.
*/
- public function validate(\stdClass $input, EntityInterface $entity): void;
+ public function validate(stdClass $input, EntityInterface $entity): void;
}
diff --git a/tests/Test/EntitySerializer/PropertyValidator/PropertyValidatorInterface.php b/tests/Test/EntitySerializer/PropertyValidator/PropertyValidatorInterface.php
index a557b1ae0..d7fceb19e 100644
--- a/tests/Test/EntitySerializer/PropertyValidator/PropertyValidatorInterface.php
+++ b/tests/Test/EntitySerializer/PropertyValidator/PropertyValidatorInterface.php
@@ -19,6 +19,8 @@
namespace Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator;
use Apigee\Edge\Entity\EntityInterface;
+use Exception;
+use stdClass;
/**
* Extra validation for serialized and deserialized values of complex
@@ -29,17 +31,17 @@ interface PropertyValidatorInterface
/**
* Validates a property.
*
- * @param \stdClass $input
+ * @param stdClass $input
* JSON decoded value of the input from Apigee Edge.
- * @param \stdClass $output
+ * @param stdClass $output
* JSON decoded value of the API request body generated by a serializer.
- * @param \Apigee\Edge\Entity\EntityInterface $entity
+ * @param EntityInterface $entity
* The original entity object - the source of the generated output.
*
- * @throws \Exception
+ * @throws Exception
* When the validation fails.
*/
- public function validate(\stdClass $input, \stdClass $output, EntityInterface $entity): void;
+ public function validate(stdClass $input, stdClass $output, EntityInterface $entity): void;
/**
* The name of the validated property in the input and output.
diff --git a/tests/Test/EntitySerializer/PropertyValidator/PropertyValidatorsAwareValidatorTrait.php b/tests/Test/EntitySerializer/PropertyValidator/PropertyValidatorsAwareValidatorTrait.php
index 5539fc3ea..18f1a310b 100644
--- a/tests/Test/EntitySerializer/PropertyValidator/PropertyValidatorsAwareValidatorTrait.php
+++ b/tests/Test/EntitySerializer/PropertyValidator/PropertyValidatorsAwareValidatorTrait.php
@@ -19,12 +19,14 @@
namespace Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator;
use Apigee\Edge\Entity\EntityInterface;
+use Exception;
use PHPUnit\Framework\Assert;
+use stdClass;
/**
* Trait PropertyValidatorsAwareValidatorTrait.
*
- * @see \Apigee\Edge\Tests\Test\EntitySerializer\PropertyValidator\PropertyValidatorsAwareValidatorInterface
+ * @see PropertyValidatorsAwareValidatorInterface
*/
trait PropertyValidatorsAwareValidatorTrait
{
@@ -42,17 +44,17 @@ public function setPropertyValidators(array $propertyValidators): void
/**
* Validates properties in input & output with available validators.
*
- * @param \stdClass $input
+ * @param stdClass $input
* JSON decoded raw API response as object.
- * @param \stdClass $output
+ * @param stdClass $output
* API request payload generated by an entity serializer.
- * @param \Apigee\Edge\Entity\EntityInterface $entity
+ * @param EntityInterface $entity
* Entity object in which the output got generated.
*
- * @throws \Exception
+ * @throws Exception
* By Assert, if validation fails.
*/
- private function propertyValidatorsValidate(\stdClass $input, \stdClass $output, EntityInterface $entity): void
+ private function propertyValidatorsValidate(stdClass $input, stdClass $output, EntityInterface $entity): void
{
foreach ($this->propertyValidators as $validator) {
$validator->validate(clone $input, clone $output, $entity);
diff --git a/tests/Test/EntitySerializer/PropertyValidator/SerializerAwarePropertyValidatorTrait.php b/tests/Test/EntitySerializer/PropertyValidator/SerializerAwarePropertyValidatorTrait.php
index f788b0a70..7303d7797 100644
--- a/tests/Test/EntitySerializer/PropertyValidator/SerializerAwarePropertyValidatorTrait.php
+++ b/tests/Test/EntitySerializer/PropertyValidator/SerializerAwarePropertyValidatorTrait.php
@@ -23,12 +23,12 @@
trait SerializerAwarePropertyValidatorTrait
{
/**
- * @var \Apigee\Edge\Serializer\EntitySerializerInterface
+ * @var EntitySerializerInterface
*/
protected $entitySerializer;
/**
- * @param \Apigee\Edge\Serializer\EntitySerializerInterface $entitySerializer
+ * @param EntitySerializerInterface $entitySerializer
*/
public function setEntitySerializer(EntitySerializerInterface $entitySerializer): void
{
diff --git a/tests/Test/FileSystemMockClient.php b/tests/Test/FileSystemMockClient.php
index 8fc080a1a..198d6dd45 100644
--- a/tests/Test/FileSystemMockClient.php
+++ b/tests/Test/FileSystemMockClient.php
@@ -26,15 +26,15 @@
class FileSystemMockClient extends OfflineClientBase implements OfflineClientInterface
{
- /** @var \Apigee\Edge\Tests\Test\HttpClient\FileSystemHttpMockClient */
+ /** @var FileSystemHttpMockClient */
private $httpClient;
/**
* FileSystemMockClient constructor.
*
- * @param \League\Flysystem\AdapterInterface|null $adapter
+ * @param AdapterInterface|null $adapter
*/
- public function __construct(AdapterInterface $adapter = null)
+ public function __construct(?AdapterInterface $adapter = null)
{
$this->httpClient = new FileSystemHttpMockClient($adapter);
parent::__construct([Client::CONFIG_HTTP_CLIENT_BUILDER => new Builder($this->httpClient)]);
diff --git a/tests/Test/HttpClient/DebuggerHttpClient.php b/tests/Test/HttpClient/DebuggerHttpClient.php
index 72c0959d0..93fd2abf3 100644
--- a/tests/Test/HttpClient/DebuggerHttpClient.php
+++ b/tests/Test/HttpClient/DebuggerHttpClient.php
@@ -46,12 +46,12 @@ class DebuggerHttpClient implements ClientInterface, HttpAsyncClient
private $client;
/**
- * @var \Http\Message\Formatter
+ * @var Formatter
*/
private $formatter;
/**
- * @var \Psr\Log\LoggerInterface
+ * @var LoggerInterface
*/
private $logger;
@@ -64,8 +64,8 @@ class DebuggerHttpClient implements ClientInterface, HttpAsyncClient
* DebuggerHttpClient constructor.
*
* @param array $config
- * @param \Http\Message\Formatter|null $formatter
- * @param \Psr\Log\LoggerInterface|null $logger
+ * @param Formatter|null $formatter
+ * @param LoggerInterface|null $logger
* @param string|null $logFormat
*/
public function __construct(array $config = [], ?Formatter $formatter = null, ?LoggerInterface $logger = null, ?string $logFormat = null)
diff --git a/tests/Test/HttpClient/FileSystemHttpMockClient.php b/tests/Test/HttpClient/FileSystemHttpMockClient.php
index 5ab1c9ad1..45e185826 100644
--- a/tests/Test/HttpClient/FileSystemHttpMockClient.php
+++ b/tests/Test/HttpClient/FileSystemHttpMockClient.php
@@ -19,6 +19,7 @@
namespace Apigee\Edge\Tests\Test\HttpClient;
use Apigee\Edge\Tests\Test\HttpClient\Exception\MockHttpClientException;
+use Exception;
use Http\Client\Common\HttpAsyncClientEmulator;
use League\Flysystem\AdapterInterface;
use Psr\Http\Message\RequestInterface;
@@ -37,9 +38,9 @@ class FileSystemHttpMockClient implements MockHttpClientInterface
/**
* FileSystemMockClient constructor.
*
- * @param \League\Flysystem\AdapterInterface|null $adapter
+ * @param AdapterInterface|null $adapter
*/
- public function __construct(AdapterInterface $adapter = null)
+ public function __construct(?AdapterInterface $adapter = null)
{
$this->fileSystemResponseFactory = new FileSystemResponseFactory($adapter);
}
@@ -53,7 +54,7 @@ public function sendRequest(RequestInterface $request): ResponseInterface
{
try {
return $this->fileSystemResponseFactory->createResponseForRequest($request, 200, null, ['Content-Type' => 'application/json']);
- } catch (\Exception $e) {
+ } catch (Exception $e) {
throw new MockHttpClientException($e->getMessage(), $e->getCode(), $e);
}
}
diff --git a/tests/Test/HttpClient/FileSystemResponseFactory.php b/tests/Test/HttpClient/FileSystemResponseFactory.php
index 185eaa6c5..fbc0ef498 100644
--- a/tests/Test/HttpClient/FileSystemResponseFactory.php
+++ b/tests/Test/HttpClient/FileSystemResponseFactory.php
@@ -34,21 +34,21 @@
*/
class FileSystemResponseFactory implements ResponseFactory
{
- /** @var \League\Flysystem\Filesystem */
+ /** @var Filesystem */
private $filesystem;
- /** @var \Symfony\Component\Serializer\Encoder\DecoderInterface */
+ /** @var DecoderInterface */
private $decoder;
/**
* FileSystemResponseFactory constructor.
*
- * @param \League\Flysystem\AdapterInterface|null $adapter
+ * @param AdapterInterface|null $adapter
* FlySystem adapter.
* @param DecoderInterface|null $decoder
* Decoder interface for reading request bodies. Default is JsonDecode.
*/
- public function __construct(AdapterInterface $adapter = null, DecoderInterface $decoder = null)
+ public function __construct(?AdapterInterface $adapter = null, ?DecoderInterface $decoder = null)
{
if (null === $adapter) {
$defaultFolder = realpath(sprintf(
@@ -73,7 +73,7 @@ public function createResponse(
$reasonPhrase = null,
array $headers = [],
$body = null,
- $protocolVersion = '1.1'
+ $protocolVersion = '1.1',
) {
return new Response(
$statusCode,
@@ -100,7 +100,7 @@ public function createResponseForRequest(
$statusCode = 200,
$reasonPhrase = null,
array $headers = [],
- $protocolVersion = '1.1'
+ $protocolVersion = '1.1',
) {
$path = $this->transformRequestToPath($request);
try {
@@ -118,7 +118,7 @@ public function createResponseForRequest(
/**
* Transforms a request to a valid file system path.
*
- * @param \Psr\Http\Message\RequestInterface $request
+ * @param RequestInterface $request
*
* @return string
*/
@@ -132,12 +132,12 @@ protected function transformRequestToPath(RequestInterface $request): string
parse_str($request->getUri()->getQuery(), $raw_query_params);
$raw_query_params = preg_replace('/[\W]/', '', $raw_query_params);
ksort($raw_query_params);
- $query_params = http_build_query($raw_query_params, null, '-');
+ $query_params = http_build_query($raw_query_params, '', '-');
$fileName .= $query_params;
}
$fileName .= '.json';
$filePath .= DIRECTORY_SEPARATOR . $fileName;
- return rawurldecode(($filePath));
+ return rawurldecode($filePath);
}
}
diff --git a/tests/Test/HttpClient/MockHttpClient.php b/tests/Test/HttpClient/MockHttpClient.php
index 59018a48c..5ed5509c9 100644
--- a/tests/Test/HttpClient/MockHttpClient.php
+++ b/tests/Test/HttpClient/MockHttpClient.php
@@ -19,9 +19,11 @@
namespace Apigee\Edge\Tests\Test\HttpClient;
use Apigee\Edge\Tests\Test\HttpClient\Exception\MockHttpClientException;
+use Exception;
use Http\Client\Common\HttpAsyncClientEmulator;
use Http\Message\ResponseFactory;
use Http\Mock\Client;
+use InvalidArgumentException;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
@@ -39,15 +41,15 @@ class MockHttpClient implements MockHttpClientInterface
{
use HttpAsyncClientEmulator;
- /** @var \Http\Mock\Client */
+ /** @var Client */
private $decorated;
/**
* MockHttpClient constructor.
*
- * @param \Http\Message\ResponseFactory|null $responseFactory
+ * @param ResponseFactory|null $responseFactory
*/
- public function __construct(ResponseFactory $responseFactory = null)
+ public function __construct(?ResponseFactory $responseFactory = null)
{
$this->decorated = new Client($responseFactory);
}
@@ -63,7 +65,7 @@ public function __call($name, $arguments)
} elseif (method_exists($this->decorated, $name)) {
$object = $this->decorated;
} else {
- throw new \InvalidArgumentException("Method not found {$name}.");
+ throw new InvalidArgumentException("Method not found {$name}.");
}
return call_user_func_array([$object, $name], $arguments);
@@ -78,7 +80,7 @@ public function sendRequest(RequestInterface $request): ResponseInterface
{
try {
return $this->decorated->sendRequest($request);
- } catch (\Exception $e) {
+ } catch (Exception $e) {
throw new MockHttpClientException($e->getMessage(), $e->getCode(), $e);
}
}
diff --git a/tests/Test/HttpClient/Plugin/MockApigeeOnGcpOauth2.php b/tests/Test/HttpClient/Plugin/MockApigeeOnGcpOauth2.php
index 230ca95c0..a4ed79f86 100644
--- a/tests/Test/HttpClient/Plugin/MockApigeeOnGcpOauth2.php
+++ b/tests/Test/HttpClient/Plugin/MockApigeeOnGcpOauth2.php
@@ -36,11 +36,11 @@ class MockApigeeOnGcpOauth2 extends ApigeeOnGcpOauth2
{
public const AUTH_SERVER = 'http://example.com/oauth/token';
/**
- * @var \Apigee\Edge\HttpClient\Utility\JournalInterface
+ * @var JournalInterface
*/
private $journal;
/**
- * @var \Psr\Http\Client\ClientInterface
+ * @var HttpClient
*/
private $httpClient;
@@ -48,9 +48,9 @@ public function __construct(
string $email,
string $privateKey,
OauthTokenStorageInterface $tokenStorage,
- HttpClient $httpClient = null,
- JournalInterface $journal = null,
- ?string $authServer = null
+ ?HttpClient $httpClient = null,
+ ?JournalInterface $journal = null,
+ ?string $authServer = null,
) {
parent::__construct($email, $privateKey, $tokenStorage, $authServer);
$this->journal = $journal ?: new TestJournal();
diff --git a/tests/Test/HttpClient/Plugin/MockHybridOauth2.php b/tests/Test/HttpClient/Plugin/MockHybridOauth2.php
index f6dde69a7..44cca8674 100644
--- a/tests/Test/HttpClient/Plugin/MockHybridOauth2.php
+++ b/tests/Test/HttpClient/Plugin/MockHybridOauth2.php
@@ -39,11 +39,11 @@ class MockHybridOauth2 extends HybridOauth2
{
public const AUTH_SERVER = 'http://example.com/oauth/token';
/**
- * @var \Apigee\Edge\HttpClient\Utility\JournalInterface
+ * @var JournalInterface
*/
private $journal;
/**
- * @var \Psr\Http\Client\ClientInterface
+ * @var HttpClient
*/
private $httpClient;
@@ -51,9 +51,9 @@ public function __construct(
string $email,
string $privateKey,
OauthTokenStorageInterface $tokenStorage,
- HttpClient $httpClient = null,
- JournalInterface $journal = null,
- ?string $authServer = null
+ ?HttpClient $httpClient = null,
+ ?JournalInterface $journal = null,
+ ?string $authServer = null,
) {
parent::__construct($email, $privateKey, $tokenStorage, $authServer);
$this->journal = $journal ?: new TestJournal();
diff --git a/tests/Test/HttpClient/Plugin/MockOauth.php b/tests/Test/HttpClient/Plugin/MockOauth.php
index 4bfeaa115..64728eb4a 100644
--- a/tests/Test/HttpClient/Plugin/MockOauth.php
+++ b/tests/Test/HttpClient/Plugin/MockOauth.php
@@ -36,11 +36,11 @@ class MockOauth extends Oauth
{
public const AUTH_SERVER = 'http://example.com/oauth/token';
/**
- * @var \Apigee\Edge\HttpClient\Utility\JournalInterface
+ * @var JournalInterface
*/
private $journal;
/**
- * @var \Psr\Http\Client\ClientInterface
+ * @var HttpClient
*/
private $httpClient;
@@ -48,13 +48,13 @@ public function __construct(
string $username,
string $password,
OauthTokenStorageInterface $tokenStorage,
- HttpClient $httpClient = null,
- JournalInterface $journal = null,
+ ?HttpClient $httpClient = null,
+ ?JournalInterface $journal = null,
?string $mfaToken = null,
?string $clientId = null,
?string $clientSecret = null,
?string $scope = null,
- ?string $authServer = null
+ ?string $authServer = null,
) {
parent::__construct($username, $password, $tokenStorage, $mfaToken, $clientId, $clientSecret, $scope, $authServer);
$this->journal = $journal ?: new TestJournal();
diff --git a/tests/Test/MockClient.php b/tests/Test/MockClient.php
index 20886bdbd..cac7b75a9 100644
--- a/tests/Test/MockClient.php
+++ b/tests/Test/MockClient.php
@@ -26,7 +26,7 @@
class MockClient extends OfflineClientBase implements OfflineClientInterface
{
- /** @var \Apigee\Edge\Tests\Test\HttpClient\MockHttpClientInterface */
+ /** @var MockHttpClientInterface */
private $httpClient;
/**
diff --git a/tests/Test/OfflineClientInterface.php b/tests/Test/OfflineClientInterface.php
index 39771a2ca..93388940f 100644
--- a/tests/Test/OfflineClientInterface.php
+++ b/tests/Test/OfflineClientInterface.php
@@ -31,7 +31,7 @@ interface OfflineClientInterface extends ClientInterface
/**
* Exposes the underlying mock http client.
*
- * @return \Apigee\Edge\Tests\Test\HttpClient\MockHttpClientInterface
+ * @return MockHttpClientInterface
*/
public function getMockHttpClient(): MockHttpClientInterface;
}
diff --git a/tests/Test/OnlineClientBase.php b/tests/Test/OnlineClientBase.php
index d21eeba63..5d2003ff0 100644
--- a/tests/Test/OnlineClientBase.php
+++ b/tests/Test/OnlineClientBase.php
@@ -31,7 +31,7 @@ abstract class OnlineClientBase extends Client implements OnlineClientInterface
/**
* OnlineClientBase constructor.
*
- * @param \Http\Message\Authentication $authentication
+ * @param Authentication $authentication
* @param string|null $endpoint
* @param array $options
*/
diff --git a/tests/Test/TestClientFactory.php b/tests/Test/TestClientFactory.php
index fe99bef78..89a917928 100644
--- a/tests/Test/TestClientFactory.php
+++ b/tests/Test/TestClientFactory.php
@@ -22,11 +22,13 @@
use Apigee\Edge\Tests\Test\HttpClient\DebuggerHttpClient;
use Http\Message\Authentication\BasicAuth;
use Http\Message\Formatter\CurlCommandFormatter;
+use InvalidArgumentException;
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use Monolog\Processor\PsrLogMessageProcessor;
use ReflectionClass;
+use ReflectionException;
/**
* Class TestClientFactory.
@@ -60,9 +62,9 @@ public function __wakeup(): void
* Enforces factory to rebuild the test client instead of returning it
* from its static cache.
*
- * @return \Apigee\Edge\ClientInterface
+ * @return ClientInterface
*/
- public static function getClient(string $fqcn = null, bool $reset = false): ClientInterface
+ public static function getClient(?string $fqcn = null, bool $reset = false): ClientInterface
{
$fqcn = $fqcn ?: getenv('APIGEE_EDGE_PHP_CLIENT_API_CLIENT') ?: FileSystemMockClient::class;
@@ -71,9 +73,9 @@ public static function getClient(string $fqcn = null, bool $reset = false): Clie
}
try {
- $clientRC = new \ReflectionClass($fqcn);
- } catch (\ReflectionException $e) {
- throw new \InvalidArgumentException("Unable to initialize client class with {$fqcn} name.", $e->getCode(), $e);
+ $clientRC = new ReflectionClass($fqcn);
+ } catch (ReflectionException $e) {
+ throw new InvalidArgumentException("Unable to initialize client class with {$fqcn} name.", $e->getCode(), $e);
}
if ($clientRC->implementsInterface(OnlineClientInterface::class)) {
@@ -104,7 +106,7 @@ public static function getClient(string $fqcn = null, bool $reset = false): Clie
/* @var \Apigee\Edge\Tests\Test\OfflineClientInterface $client */
self::$instances[$fqcn] = $clientRC->newInstance();
} else {
- throw new \InvalidArgumentException(
+ throw new InvalidArgumentException(
sprintf(
'Class must implements either %s interface or %s interface. Got %s.',
OnlineClientInterface::class,
@@ -120,7 +122,7 @@ public static function getClient(string $fqcn = null, bool $reset = false): Clie
/**
* Helper function that returns whether an API client is offline or not.
*
- * @param \Apigee\Edge\ClientInterface $client
+ * @param ClientInterface $client
* API client.
*
* @return bool
diff --git a/tests/Test/Utility/EntityStorage.php b/tests/Test/Utility/EntityStorage.php
index d8a99b521..47c2c1ab4 100644
--- a/tests/Test/Utility/EntityStorage.php
+++ b/tests/Test/Utility/EntityStorage.php
@@ -22,6 +22,9 @@
use Apigee\Edge\Controller\EntityDeleteOperationControllerInterface;
use Apigee\Edge\Entity\EntityInterface;
use Apigee\Edge\Tests\Test\HttpClient\Exception\MockHttpClientException;
+use Exception;
+use InvalidArgumentException;
+use ReflectionObject;
/**
* Stores created test entities meanwhile a test run.
@@ -50,7 +53,7 @@ private function __construct()
}
/**
- * @return \Apigee\Edge\Tests\Test\Utility\EntityStorage
+ * @return EntityStorage
*/
public static function getInstance(): EntityStorage
{
@@ -62,13 +65,13 @@ public static function getInstance(): EntityStorage
}
/**
- * @param \Apigee\Edge\Entity\EntityInterface $entity
+ * @param EntityInterface $entity
* @param object $controller
*/
public function addEntity(EntityInterface $entity, $controller): void
{
if (!is_object($controller)) {
- throw new \InvalidArgumentException('Controller must be an object.');
+ throw new InvalidArgumentException('Controller must be an object.');
}
$controllerId = $this->getControllerId($controller);
if (!array_key_exists($controllerId, self::$controllers)) {
@@ -84,7 +87,7 @@ public function addEntity(EntityInterface $entity, $controller): void
public function removeEntity(string $entityId, $controller): void
{
if (!is_object($controller)) {
- throw new \InvalidArgumentException('Controller must be an object.');
+ throw new InvalidArgumentException('Controller must be an object.');
}
$controllerId = $this->getControllerId($controller);
unset(self::$createdEntities[$controllerId][$entityId]);
@@ -102,7 +105,7 @@ public function removeEntity(string $entityId, $controller): void
public function getCreatedEntitiesByStorage($controller): array
{
if (!is_object($controller)) {
- throw new \InvalidArgumentException('Controller must be an object.');
+ throw new InvalidArgumentException('Controller must be an object.');
}
return self::$createdEntities[$this->getControllerId($controller)]['entity'] ?? [];
@@ -125,14 +128,14 @@ public function purgeCreatedEntities(): void
});
foreach (static::$controllers as $controllerId => $controller) {
if ($controller instanceof EntityDeleteOperationControllerInterface) {
- /** @var \Apigee\Edge\Entity\EntityInterface $entity */
+ /** @var EntityInterface $entity */
foreach (self::$createdEntities[$controllerId] as $entity) {
try {
$controller->delete($entity->id());
} catch (MockHttpClientException $e) {
// Nothing to do, if an offline client was being used
// there is no need for a clean up.
- } catch (\Exception $e) {
+ } catch (Exception $e) {
// Do not fail test if the removal of a test entity
// failed but log the failed attempt.
// It could happen that an entity has been already
@@ -154,7 +157,7 @@ public function purgeCreatedEntities(): void
private function resetStorageByController($controller): void
{
if (!is_object($controller)) {
- throw new \InvalidArgumentException('Controller must be an object.');
+ throw new InvalidArgumentException('Controller must be an object.');
}
$controllerId = $this->getControllerId($controller);
unset(self::$createdEntities[$controllerId]);
@@ -169,10 +172,10 @@ private function resetStorageByController($controller): void
private function getControllerId($controller): string
{
if (!is_object($controller)) {
- throw new \InvalidArgumentException('Controller must be an object.');
+ throw new InvalidArgumentException('Controller must be an object.');
}
- $ro = new \ReflectionObject($controller);
+ $ro = new ReflectionObject($controller);
return $ro->getName() . '-' . spl_object_hash($controller);
}
diff --git a/tests/Test/Utility/MarkOnlineTestSkippedAwareTrait.php b/tests/Test/Utility/MarkOnlineTestSkippedAwareTrait.php
index f091727bc..e0664fb3e 100644
--- a/tests/Test/Utility/MarkOnlineTestSkippedAwareTrait.php
+++ b/tests/Test/Utility/MarkOnlineTestSkippedAwareTrait.php
@@ -27,7 +27,7 @@ trait MarkOnlineTestSkippedAwareTrait
* API client.
*
* @param string $testName
- * @param \Apigee\Edge\ClientInterface|null $client
+ * @param ClientInterface|null $client
*/
- abstract public static function markOnlineTestSkipped(string $testName, ClientInterface $client = null): void;
+ abstract public static function markOnlineTestSkipped(string $testName, ?ClientInterface $client = null): void;
}
diff --git a/tests/Test/Utility/RandomGeneratorAwareTrait.php b/tests/Test/Utility/RandomGeneratorAwareTrait.php
index 77d8ce55d..f7b079b57 100644
--- a/tests/Test/Utility/RandomGeneratorAwareTrait.php
+++ b/tests/Test/Utility/RandomGeneratorAwareTrait.php
@@ -23,7 +23,7 @@ trait RandomGeneratorAwareTrait
/**
* Returns a random generator.
*
- * @return \Apigee\Edge\Tests\Test\Utility\RandomGeneratorInterface
+ * @return RandomGeneratorInterface
*/
abstract protected static function randomGenerator(): RandomGeneratorInterface;
}
diff --git a/tests/Utility/OrganizationFeaturesTest.php b/tests/Utility/OrganizationFeaturesTest.php
index a2797e188..60709fa85 100644
--- a/tests/Utility/OrganizationFeaturesTest.php
+++ b/tests/Utility/OrganizationFeaturesTest.php
@@ -36,7 +36,7 @@ class OrganizationFeaturesTest extends TestCase
*/
public function testOrganizationFeatures(?string $propertyValue, bool $expectedResult): void
{
- /** @var \Apigee\Edge\Api\Management\Entity\OrganizationInterface $organization */
+ /** @var OrganizationInterface $organization */
$organization = $this->getMockBuilder(OrganizationInterface::class)->getMock();
$organization->method('getPropertyValue')->willReturn($propertyValue);
$this->assertEquals($expectedResult, OrganizationFeatures::isCpsEnabled($organization));
@@ -65,7 +65,7 @@ public function featurePropertyValueProvider(): array
*/
public function testPaginationAvailable($isCpsEnabled, $isHybridEnabled, $expected, $message): void
{
- /** @var \Apigee\Edge\Api\Management\Entity\OrganizationInterface $organization */
+ /** @var OrganizationInterface $organization */
$organization = $this->getMockBuilder(OrganizationInterface::class)->getMock();
$organization->method('getPropertyValue')->will($this->returnValueMap([
['features.isCpsEnabled', $isCpsEnabled],
@@ -97,7 +97,7 @@ public function paginationAvailableValueProvider(): array
*/
public function testCompaniesAvailable($isHybridEnabled, $expected, $message): void
{
- /** @var \Apigee\Edge\Api\Management\Entity\OrganizationInterface $organization */
+ /** @var OrganizationInterface $organization */
$organization = $this->getMockBuilder(OrganizationInterface::class)->getMock();
$organization->method('getPropertyValue')->willReturn($isHybridEnabled);
$this->assertEquals($expected, OrganizationFeatures::isCompaniesFeatureAvailable($organization), $message);
diff --git a/tests/Utility/ResponseToArrayHelperTest.php b/tests/Utility/ResponseToArrayHelperTest.php
index 9cdcbe285..8d593bc6c 100644
--- a/tests/Utility/ResponseToArrayHelperTest.php
+++ b/tests/Utility/ResponseToArrayHelperTest.php
@@ -19,6 +19,7 @@
namespace Apigee\Edge\Tests\Utility;
use Apigee\Edge\Tests\Test\Utility\ResponseToArrayHelper;
+use GuzzleHttp\Psr7\Utils;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ResponseInterface;
@@ -47,16 +48,16 @@ protected function setUp(): void
*/
public function testExpandCompatibility($edgeResponse, $hybridResponse): void
{
- /** @var \Psr\Http\Message\ResponseInterface $response1 */
+ /** @var ResponseInterface $response1 */
$response1 = $this->getMockBuilder(ResponseInterface::class)->getMock();
$response1->method('getHeaderLine')->willReturn('application/json');
- $response1->method('getBody')->willReturn($edgeResponse);
+ $response1->method('getBody')->willReturn(Utils::streamFor($edgeResponse));
$decodedEdgeStyle = $this->responseToArrayHelper->convertResponseToArray($response1, false);
- /** @var \Psr\Http\Message\ResponseInterface $response2 */
+ /** @var ResponseInterface $response2 */
$response2 = $this->getMockBuilder(ResponseInterface::class)->getMock();
$response2->method('getHeaderLine')->willReturn('application/json');
- $response2->method('getBody')->willReturn($hybridResponse);
+ $response2->method('getBody')->willReturn(Utils::streamFor($hybridResponse));
$decodedWithCompatibility = $this->responseToArrayHelper->convertResponseToArray($response2, true);
$this->assertEquals($decodedEdgeStyle, $decodedWithCompatibility);
diff --git a/tests/offline-test-data/v1/organizations/phpunit/apiproducts/POST.json b/tests/offline-test-data/v1/organizations/phpunit/apiproducts/POST.json
index 398921d59..3f3bd2f39 100644
--- a/tests/offline-test-data/v1/organizations/phpunit/apiproducts/POST.json
+++ b/tests/offline-test-data/v1/organizations/phpunit/apiproducts/POST.json
@@ -7,11 +7,11 @@
"value": "bar"
}
],
- "createdAt": 648345600000,
+ "createdAt": "648345600000",
"createdBy": "phpunit@example.com",
"displayName": "PHP Unit Test product",
"environments": [],
- "lastModifiedAt": 648345600000,
+ "lastModifiedAt": "648345600000",
"lastModifiedBy": "phpunit@example.com",
"name": "phpunit_test",
"proxies": [],
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/GET.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/GET.json
new file mode 100644
index 000000000..5085a7b2e
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/GET.json
@@ -0,0 +1,69 @@
+{
+ "appGroups": [
+ {
+ "name": "phpunit",
+ "displayName": "A PHPUnit appgroup",
+ "status": "active",
+ "attributes": [
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "createdAt": 1691588699000,
+ "lastModifiedAt": 1691588699617
+ },
+ {
+ "name": "1phpunit",
+ "displayName": "A PHPUnit appgroup",
+ "status": "active",
+ "attributes": [
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "createdAt": 1691588699000,
+ "lastModifiedAt": 1691588699617
+ },
+ {
+ "name": "2phpunit",
+ "displayName": "A PHPUnit appgroup",
+ "status": "active",
+ "attributes": [
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "createdAt": 1691588699000,
+ "lastModifiedAt": 1691588699617
+ },
+ {
+ "name": "3phpunit",
+ "displayName": "A PHPUnit appgroup",
+ "status": "active",
+ "attributes": [
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "createdAt": 1691588699000,
+ "lastModifiedAt": 1691588699617
+ },
+ {
+ "name": "4phpunit",
+ "displayName": "A PHPUnit appgroup",
+ "status": "active",
+ "attributes": [
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "createdAt": 1691588699000,
+ "lastModifiedAt": 1691588699617
+ }
+ ]
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/GET_pageSize=1000.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/GET_pageSize=1000.json
new file mode 100644
index 000000000..5085a7b2e
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/GET_pageSize=1000.json
@@ -0,0 +1,69 @@
+{
+ "appGroups": [
+ {
+ "name": "phpunit",
+ "displayName": "A PHPUnit appgroup",
+ "status": "active",
+ "attributes": [
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "createdAt": 1691588699000,
+ "lastModifiedAt": 1691588699617
+ },
+ {
+ "name": "1phpunit",
+ "displayName": "A PHPUnit appgroup",
+ "status": "active",
+ "attributes": [
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "createdAt": 1691588699000,
+ "lastModifiedAt": 1691588699617
+ },
+ {
+ "name": "2phpunit",
+ "displayName": "A PHPUnit appgroup",
+ "status": "active",
+ "attributes": [
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "createdAt": 1691588699000,
+ "lastModifiedAt": 1691588699617
+ },
+ {
+ "name": "3phpunit",
+ "displayName": "A PHPUnit appgroup",
+ "status": "active",
+ "attributes": [
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "createdAt": 1691588699000,
+ "lastModifiedAt": 1691588699617
+ },
+ {
+ "name": "4phpunit",
+ "displayName": "A PHPUnit appgroup",
+ "status": "active",
+ "attributes": [
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "createdAt": 1691588699000,
+ "lastModifiedAt": 1691588699617
+ }
+ ]
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/GET_pageSize=2-pageToken=3phpunit.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/GET_pageSize=2-pageToken=3phpunit.json
new file mode 100644
index 000000000..c79ecfa46
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/GET_pageSize=2-pageToken=3phpunit.json
@@ -0,0 +1,30 @@
+{
+ "appGroups": [
+ {
+ "name": "3phpunit",
+ "displayName": "A PHPUnit appgroup",
+ "status": "active",
+ "attributes": [
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "createdAt": 1691588699617,
+ "lastModifiedAt": 1691588699617
+ },
+ {
+ "name": "4phpunit",
+ "displayName": "A PHPUnit appgroup",
+ "status": "active",
+ "attributes": [
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "createdAt": 1691588699617,
+ "lastModifiedAt": 1691588699617
+ }
+ ]
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/GET_pageToken=4phpunit.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/GET_pageToken=4phpunit.json
new file mode 100644
index 000000000..790f29ce2
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/GET_pageToken=4phpunit.json
@@ -0,0 +1,30 @@
+{
+ "appGroups": [
+ {
+ "name": "4phpunit",
+ "displayName": "A PHPUnit appgroup",
+ "status": "active",
+ "attributes": [
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "createdAt": 1691588699617,
+ "lastModifiedAt": 1691588699617
+ },
+ {
+ "name": "5phpunit",
+ "displayName": "A PHPUnit appgroup",
+ "status": "active",
+ "attributes": [
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "createdAt": 1691588699617,
+ "lastModifiedAt": 1691588699617
+ }
+ ]
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/GET_pageToken=5phpunit.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/GET_pageToken=5phpunit.json
new file mode 100644
index 000000000..6ed88898c
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/GET_pageToken=5phpunit.json
@@ -0,0 +1,17 @@
+{
+ "appGroups": [
+ {
+ "name": "5phpunit",
+ "displayName": "A PHPUnit appgroup",
+ "status": "active",
+ "attributes": [
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "createdAt": 1691588699617,
+ "lastModifiedAt": 1691588699617
+ }
+ ]
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/POST.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/POST.json
new file mode 100644
index 000000000..253d2117a
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/POST.json
@@ -0,0 +1,17 @@
+{
+ "channelUri": "http:\/\/example.com",
+ "channelId": "devportal",
+ "name": "phpunit",
+ "displayName": "A PHPUnit appgroup",
+ "status": "active",
+ "attributes": [
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "createdAt": 1691588699000,
+ "createdBy": "phpunit@example.com",
+ "lastModifiedAt": 1691588699000,
+ "lastModifiedBy": "phpunit@example.com"
+}
\ No newline at end of file
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/GET.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/GET.json
new file mode 100644
index 000000000..554c27b77
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/GET.json
@@ -0,0 +1,19 @@
+{
+ "name": "phpunit",
+ "displayName": "A PHPUnit appgroup",
+ "status": "active",
+ "attributes": [
+ {
+ "name": "foo",
+ "value": "bar"
+ },
+ {
+ "name": "__apigee_reserved__developer_details",
+ "value": "[{\"developer\":\"phpunit@example.com\",\"roles\":[\"admin\"]}, {\"developer\":\"phpunit2@example.com\",\"roles\":[\"admin\"]}]"
+ }
+ ],
+ "createdAt": 1691588699000,
+ "createdBy": "phpunit@example.com",
+ "lastModifiedAt": 1691588699000,
+ "lastModifiedBy": "phpunit@example.com"
+}
\ No newline at end of file
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/PUT.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/PUT.json
new file mode 100644
index 000000000..c3dc9c68a
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/PUT.json
@@ -0,0 +1,25 @@
+{
+ "channelUri": "http:\/\/example.com",
+ "channelId": "devportal",
+ "name": "phpunit",
+ "displayName": "(Edited) A PHPUnit appgroup",
+ "status": "active",
+ "attributes": [
+ {
+ "name": "foo",
+ "value": "foo"
+ },
+ {
+ "name": "bar",
+ "value": "baz"
+ },
+ {
+ "name": "__apigee_reserved__developer_details",
+ "value": "[{\"developer\":\"phpunit@example.com\",\"roles\":[\"simple member\"]}]"
+ }
+ ],
+ "createdAt": 1691588699000,
+ "createdBy": "phpunit@example.com",
+ "lastModifiedAt": 1691588699000,
+ "lastModifiedBy": "phpunit@example.com"
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/GET.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/GET.json
new file mode 100644
index 000000000..e3c1950cd
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/GET.json
@@ -0,0 +1,206 @@
+{
+ "app": [
+ {
+ "appFamily": "default",
+ "appId": "a47891c5-ca20-4f2f-975e-0e7588ec81f0",
+ "attributes": [
+ {
+ "name": "DisplayName",
+ "value": "PHP Unit: Test app"
+ },
+ {
+ "name": "Notes",
+ "value": "This is a test app created by PHP Unit."
+ },
+ {
+ "name": "foo",
+ "value": "foo"
+ },
+ {
+ "name": "bar",
+ "value": "baz"
+ }
+ ],
+ "callbackUrl": "http://foo.example.com",
+ "createdAt": 648345600000,
+ "createdBy": "phpunit@example.com",
+ "credentials": [
+ {
+ "apiProducts": [],
+ "attributes": [],
+ "consumerKey": "Zww6GKaGRxQFGkfE36vgSN0eoac1Ymk3",
+ "consumerSecret": "LtdYkcmgDYV7kzxz",
+ "issuedAt": 648345600000,
+ "scopes": [],
+ "status": "approved"
+ }
+ ],
+ "appGroup": "phpunit",
+ "lastModifiedAt": 648345600000,
+ "lastModifiedBy": "phpunit@example.com",
+ "name": "phpunit_test_app",
+ "scopes": [],
+ "status": "approved"
+ },
+ {
+ "appFamily": "default",
+ "appId": "b3e71cbb-7eb5-1111-b384-ac82bca1d9dc",
+ "attributes": [
+ {
+ "name": "DisplayName",
+ "value": "PHP Unit: Test app"
+ },
+ {
+ "name": "Notes",
+ "value": "This is a test app created by PHP Unit."
+ },
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "callbackUrl": "http://example.com",
+ "createdAt": 648345600000,
+ "createdBy": "phpunit@example.com",
+ "credentials": [
+ {
+ "apiProducts": [],
+ "attributes": [],
+ "consumerKey": "Zww6GKaGRxQFGkfE36vgSN0eoac1Ymk3",
+ "consumerSecret": "LtdYkcmgDYV7kzxz",
+ "issuedAt": 648345600000,
+ "scopes": [],
+ "status": "approved"
+ }
+ ],
+ "appGroup": "phpunit",
+ "lastModifiedAt": 648345600000,
+ "lastModifiedBy": "phpunit@example.com",
+ "name": "1phpunit_test_app",
+ "scopes": [],
+ "status": "approved"
+ },
+ {
+ "appFamily": "default",
+ "appId": "b3e71cbb-7eb5-2222-b384-ac82bca1d9dc",
+ "attributes": [
+ {
+ "name": "DisplayName",
+ "value": "PHP Unit: Test app"
+ },
+ {
+ "name": "Notes",
+ "value": "This is a test app created by PHP Unit."
+ },
+ {
+ "name": "foo",
+ "value": "foo"
+ },
+ {
+ "name": "bar",
+ "value": "baz"
+ }
+ ],
+ "callbackUrl": "http://example.com",
+ "createdAt": 648345600000,
+ "createdBy": "phpunit@example.com",
+ "credentials": [
+ {
+ "apiProducts": [],
+ "attributes": [],
+ "consumerKey": "wAXAIiOr2oJOVGqFltnm3Jwr2LE0GEuY",
+ "consumerSecret": "S8YjnsjmdBqDAegR",
+ "issuedAt": 648345600000,
+ "scopes": [],
+ "status": "approved"
+ }
+ ],
+ "appGroup": "phpunit",
+ "lastModifiedAt": 648345600000,
+ "lastModifiedBy": "phpunit@example.com",
+ "name": "2phpunit_test_app",
+ "scopes": [],
+ "status": "approved"
+ },
+ {
+ "appFamily": "default",
+ "appId": "b3e71cbb-7eb5-3333-b384-ac82bca1d9dc",
+ "attributes": [
+ {
+ "name": "DisplayName",
+ "value": "PHP Unit: Test app"
+ },
+ {
+ "name": "Notes",
+ "value": "This is a test app created by PHP Unit."
+ },
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "callbackUrl": "http://example.com",
+ "createdAt": 648345600000,
+ "createdBy": "phpunit@example.com",
+ "credentials": [
+ {
+ "apiProducts": [],
+ "attributes": [],
+ "consumerKey": "wAXAIiOr2oJOVGqFltnm3Jwr2LE0GEuY",
+ "consumerSecret": "S8YjnsjmdBqDAegR",
+ "issuedAt": 648345600000,
+ "scopes": [],
+ "status": "approved"
+ }
+ ],
+ "appGroup": "phpunit",
+ "lastModifiedAt": 648345600000,
+ "lastModifiedBy": "phpunit@example.com",
+ "name": "3phpunit_test_app",
+ "scopes": [],
+ "status": "approved"
+ },
+ {
+ "appFamily": "default",
+ "appId": "b3e71cbb-7eb5-4444-b384-ac82bca1d9dc",
+ "attributes": [
+ {
+ "name": "DisplayName",
+ "value": "PHP Unit: Test app"
+ },
+ {
+ "name": "Notes",
+ "value": "This is a test app created by PHP Unit."
+ },
+ {
+ "name": "foo",
+ "value": "foo"
+ },
+ {
+ "name": "bar",
+ "value": "baz"
+ }
+ ],
+ "callbackUrl": "http://example.com",
+ "createdAt": 648345600000,
+ "createdBy": "phpunit@example.com",
+ "credentials": [
+ {
+ "apiProducts": [],
+ "attributes": [],
+ "consumerKey": "wAXAIiOr2oJOVGqFltnm3Jwr2LE0GEuY",
+ "consumerSecret": "S8YjnsjmdBqDAegR",
+ "issuedAt": 648345600000,
+ "scopes": [],
+ "status": "approved"
+ }
+ ],
+ "appGroup": "phpunit",
+ "lastModifiedAt": 648345600000,
+ "lastModifiedBy": "phpunit@example.com",
+ "name": "4phpunit_test_app",
+ "scopes": [],
+ "status": "approved"
+ }
+ ]
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/GET_pageSize=1000.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/GET_pageSize=1000.json
new file mode 100644
index 000000000..e3c1950cd
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/GET_pageSize=1000.json
@@ -0,0 +1,206 @@
+{
+ "app": [
+ {
+ "appFamily": "default",
+ "appId": "a47891c5-ca20-4f2f-975e-0e7588ec81f0",
+ "attributes": [
+ {
+ "name": "DisplayName",
+ "value": "PHP Unit: Test app"
+ },
+ {
+ "name": "Notes",
+ "value": "This is a test app created by PHP Unit."
+ },
+ {
+ "name": "foo",
+ "value": "foo"
+ },
+ {
+ "name": "bar",
+ "value": "baz"
+ }
+ ],
+ "callbackUrl": "http://foo.example.com",
+ "createdAt": 648345600000,
+ "createdBy": "phpunit@example.com",
+ "credentials": [
+ {
+ "apiProducts": [],
+ "attributes": [],
+ "consumerKey": "Zww6GKaGRxQFGkfE36vgSN0eoac1Ymk3",
+ "consumerSecret": "LtdYkcmgDYV7kzxz",
+ "issuedAt": 648345600000,
+ "scopes": [],
+ "status": "approved"
+ }
+ ],
+ "appGroup": "phpunit",
+ "lastModifiedAt": 648345600000,
+ "lastModifiedBy": "phpunit@example.com",
+ "name": "phpunit_test_app",
+ "scopes": [],
+ "status": "approved"
+ },
+ {
+ "appFamily": "default",
+ "appId": "b3e71cbb-7eb5-1111-b384-ac82bca1d9dc",
+ "attributes": [
+ {
+ "name": "DisplayName",
+ "value": "PHP Unit: Test app"
+ },
+ {
+ "name": "Notes",
+ "value": "This is a test app created by PHP Unit."
+ },
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "callbackUrl": "http://example.com",
+ "createdAt": 648345600000,
+ "createdBy": "phpunit@example.com",
+ "credentials": [
+ {
+ "apiProducts": [],
+ "attributes": [],
+ "consumerKey": "Zww6GKaGRxQFGkfE36vgSN0eoac1Ymk3",
+ "consumerSecret": "LtdYkcmgDYV7kzxz",
+ "issuedAt": 648345600000,
+ "scopes": [],
+ "status": "approved"
+ }
+ ],
+ "appGroup": "phpunit",
+ "lastModifiedAt": 648345600000,
+ "lastModifiedBy": "phpunit@example.com",
+ "name": "1phpunit_test_app",
+ "scopes": [],
+ "status": "approved"
+ },
+ {
+ "appFamily": "default",
+ "appId": "b3e71cbb-7eb5-2222-b384-ac82bca1d9dc",
+ "attributes": [
+ {
+ "name": "DisplayName",
+ "value": "PHP Unit: Test app"
+ },
+ {
+ "name": "Notes",
+ "value": "This is a test app created by PHP Unit."
+ },
+ {
+ "name": "foo",
+ "value": "foo"
+ },
+ {
+ "name": "bar",
+ "value": "baz"
+ }
+ ],
+ "callbackUrl": "http://example.com",
+ "createdAt": 648345600000,
+ "createdBy": "phpunit@example.com",
+ "credentials": [
+ {
+ "apiProducts": [],
+ "attributes": [],
+ "consumerKey": "wAXAIiOr2oJOVGqFltnm3Jwr2LE0GEuY",
+ "consumerSecret": "S8YjnsjmdBqDAegR",
+ "issuedAt": 648345600000,
+ "scopes": [],
+ "status": "approved"
+ }
+ ],
+ "appGroup": "phpunit",
+ "lastModifiedAt": 648345600000,
+ "lastModifiedBy": "phpunit@example.com",
+ "name": "2phpunit_test_app",
+ "scopes": [],
+ "status": "approved"
+ },
+ {
+ "appFamily": "default",
+ "appId": "b3e71cbb-7eb5-3333-b384-ac82bca1d9dc",
+ "attributes": [
+ {
+ "name": "DisplayName",
+ "value": "PHP Unit: Test app"
+ },
+ {
+ "name": "Notes",
+ "value": "This is a test app created by PHP Unit."
+ },
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "callbackUrl": "http://example.com",
+ "createdAt": 648345600000,
+ "createdBy": "phpunit@example.com",
+ "credentials": [
+ {
+ "apiProducts": [],
+ "attributes": [],
+ "consumerKey": "wAXAIiOr2oJOVGqFltnm3Jwr2LE0GEuY",
+ "consumerSecret": "S8YjnsjmdBqDAegR",
+ "issuedAt": 648345600000,
+ "scopes": [],
+ "status": "approved"
+ }
+ ],
+ "appGroup": "phpunit",
+ "lastModifiedAt": 648345600000,
+ "lastModifiedBy": "phpunit@example.com",
+ "name": "3phpunit_test_app",
+ "scopes": [],
+ "status": "approved"
+ },
+ {
+ "appFamily": "default",
+ "appId": "b3e71cbb-7eb5-4444-b384-ac82bca1d9dc",
+ "attributes": [
+ {
+ "name": "DisplayName",
+ "value": "PHP Unit: Test app"
+ },
+ {
+ "name": "Notes",
+ "value": "This is a test app created by PHP Unit."
+ },
+ {
+ "name": "foo",
+ "value": "foo"
+ },
+ {
+ "name": "bar",
+ "value": "baz"
+ }
+ ],
+ "callbackUrl": "http://example.com",
+ "createdAt": 648345600000,
+ "createdBy": "phpunit@example.com",
+ "credentials": [
+ {
+ "apiProducts": [],
+ "attributes": [],
+ "consumerKey": "wAXAIiOr2oJOVGqFltnm3Jwr2LE0GEuY",
+ "consumerSecret": "S8YjnsjmdBqDAegR",
+ "issuedAt": 648345600000,
+ "scopes": [],
+ "status": "approved"
+ }
+ ],
+ "appGroup": "phpunit",
+ "lastModifiedAt": 648345600000,
+ "lastModifiedBy": "phpunit@example.com",
+ "name": "4phpunit_test_app",
+ "scopes": [],
+ "status": "approved"
+ }
+ ]
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/GET_pageToken=4phpunit_test_app.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/GET_pageToken=4phpunit_test_app.json
new file mode 100644
index 000000000..b29c7b36d
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/GET_pageToken=4phpunit_test_app.json
@@ -0,0 +1,84 @@
+{
+ "app": [
+ {
+ "appFamily": "default",
+ "appId": "b3e71cbb-7eb5-4444-b384-ac82bca1d9dc",
+ "attributes": [
+ {
+ "name": "DisplayName",
+ "value": "PHP Unit: Test app"
+ },
+ {
+ "name": "Notes",
+ "value": "This is a test app created by PHP Unit."
+ },
+ {
+ "name": "foo",
+ "value": "foo"
+ },
+ {
+ "name": "bar",
+ "value": "baz"
+ }
+ ],
+ "callbackUrl": "http://example.com",
+ "createdAt": 648345600000,
+ "createdBy": "phpunit@example.com",
+ "credentials": [
+ {
+ "apiProducts": [],
+ "attributes": [],
+ "consumerKey": "wAXAIiOr2oJOVGqFltnm3Jwr2LE0GEuY",
+ "consumerSecret": "S8YjnsjmdBqDAegR",
+ "issuedAt": 648345600000,
+ "scopes": [],
+ "status": "approved"
+ }
+ ],
+ "appGroup": "phpunit",
+ "lastModifiedAt": 648345600000,
+ "lastModifiedBy": "phpunit@example.com",
+ "name": "4phpunit_test_app",
+ "scopes": [],
+ "status": "approved"
+ },
+ {
+ "appFamily": "default",
+ "appId": "b3e71cbb-7eb5-3333-b384-ac82bca1d9dc",
+ "attributes": [
+ {
+ "name": "DisplayName",
+ "value": "PHP Unit: Test app"
+ },
+ {
+ "name": "Notes",
+ "value": "This is a test app created by PHP Unit."
+ },
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "callbackUrl": "http://example.com",
+ "createdAt": 648345600000,
+ "createdBy": "phpunit@example.com",
+ "credentials": [
+ {
+ "apiProducts": [],
+ "attributes": [],
+ "consumerKey": "wAXAIiOr2oJOVGqFltnm3Jwr2LE0GEuY",
+ "consumerSecret": "S8YjnsjmdBqDAegR",
+ "issuedAt": 648345600000,
+ "scopes": [],
+ "status": "approved"
+ }
+ ],
+ "appGroup": "phpunit",
+ "lastModifiedAt": 648345600000,
+ "lastModifiedBy": "phpunit@example.com",
+ "name": "5phpunit_test_app",
+ "scopes": [],
+ "status": "approved"
+ }
+ ]
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/GET_pageToken=5phpunit_test_app.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/GET_pageToken=5phpunit_test_app.json
new file mode 100644
index 000000000..2b6031ce9
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/GET_pageToken=5phpunit_test_app.json
@@ -0,0 +1,42 @@
+{
+ "app": [
+ {
+ "appFamily": "default",
+ "appId": "b3e71cbb-7eb5-3333-b384-ac82bca1d9dc",
+ "attributes": [
+ {
+ "name": "DisplayName",
+ "value": "PHP Unit: Test app"
+ },
+ {
+ "name": "Notes",
+ "value": "This is a test app created by PHP Unit."
+ },
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "callbackUrl": "http://example.com",
+ "createdAt": 648345600000,
+ "createdBy": "phpunit@example.com",
+ "credentials": [
+ {
+ "apiProducts": [],
+ "attributes": [],
+ "consumerKey": "wAXAIiOr2oJOVGqFltnm3Jwr2LE0GEuY",
+ "consumerSecret": "S8YjnsjmdBqDAegR",
+ "issuedAt": 648345600000,
+ "scopes": [],
+ "status": "approved"
+ }
+ ],
+ "appGroup": "phpunit",
+ "lastModifiedAt": 648345600000,
+ "lastModifiedBy": "phpunit@example.com",
+ "name": "5phpunit_test_app",
+ "scopes": [],
+ "status": "approved"
+ }
+ ]
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/POST.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/POST.json
new file mode 100644
index 000000000..3bfce4a01
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/POST.json
@@ -0,0 +1,38 @@
+{
+ "appId": "f98678b9-4d1b-4927-ba17-62e6efaadfcc",
+ "attributes": [
+ {
+ "name": "DisplayName",
+ "value": "PHP Unit: Test app"
+ },
+ {
+ "name": "Notes",
+ "value": "This is a test app created by PHP Unit."
+ },
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "callbackUrl": "http://example.com",
+ "createdAt": 648345600000,
+ "createdBy": "phpunit@example.com",
+ "credentials": [
+ {
+ "apiProducts": [],
+ "attributes": [],
+ "consumerKey": "0YQxigR9Fcbo1vKLBrM5QRWgXx6nU1k1",
+ "consumerSecret": "6DwTp11hKT4fap65",
+ "expiresAt": -1,
+ "issuedAt": 648345600000,
+ "scopes": [],
+ "status": "approved"
+ }
+ ],
+ "appGroup": "phpunit",
+ "lastModifiedAt": 648345600000,
+ "lastModifiedBy": "phpunit@example.com",
+ "name": "phpunit_test_app",
+ "scopes": [],
+ "status": "approved"
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/GET.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/GET.json
new file mode 100644
index 000000000..0f9aa94ab
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/GET.json
@@ -0,0 +1,39 @@
+{
+ "appFamily": "default",
+ "appId": "f98678b9-4d1b-4927-ba17-62e6efaadfcc",
+ "attributes": [
+ {
+ "name": "DisplayName",
+ "value": "PHP Unit: Test app"
+ },
+ {
+ "name": "Notes",
+ "value": "This is a test app created by PHP Unit."
+ },
+ {
+ "name": "foo",
+ "value": "bar"
+ }
+ ],
+ "callbackUrl": "http://example.com",
+ "createdAt": 648345600000,
+ "createdBy": "phpunit@example.com",
+ "credentials": [
+ {
+ "apiProducts": [],
+ "attributes": [],
+ "consumerKey": "0YQxigR9Fcbo1vKLBrM5QRWgXx6nU1k1",
+ "consumerSecret": "6DwTp11hKT4fap65",
+ "expiresAt": -1,
+ "issuedAt": 648345600000,
+ "scopes": [],
+ "status": "approved"
+ }
+ ],
+ "appGroup": "phpunit",
+ "lastModifiedAt": 648345600000,
+ "lastModifiedBy": "phpunit@example.com",
+ "name": "phpunit_test_app",
+ "scopes": [],
+ "status": "approved"
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/PUT.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/PUT.json
new file mode 100644
index 000000000..38f828f6e
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/PUT.json
@@ -0,0 +1,42 @@
+{
+ "appId": "f98678b9-4d1b-4927-ba17-62e6efaadfcc",
+ "attributes": [
+ {
+ "name": "foo",
+ "value": "foo"
+ },
+ {
+ "name": "bar",
+ "value": "baz"
+ },
+ {
+ "name": "DisplayName",
+ "value": "(Edited) PHP Unit: Test app"
+ },
+ {
+ "name": "Notes",
+ "value": "(Edited) This is a test app created by PHP Unit."
+ }
+ ],
+ "callbackUrl": "http://foo.example.com",
+ "createdAt": 648345600000,
+ "createdBy": "phpunit@example.com",
+ "credentials": [
+ {
+ "apiProducts": [],
+ "attributes": [],
+ "consumerKey": "0YQxigR9Fcbo1vKLBrM5QRWgXx6nU1k1",
+ "consumerSecret": "6DwTp11hKT4fap65",
+ "expiresAt": -1,
+ "issuedAt": 648345600000,
+ "scopes": [],
+ "status": "approved"
+ }
+ ],
+ "appGroup": "phpunit",
+ "lastModifiedAt": 648345600000,
+ "lastModifiedBy": "phpunit@example.com",
+ "name": "phpunit_test_app",
+ "scopes": [],
+ "status": "approved"
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/attributes/GET.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/attributes/GET.json
new file mode 100644
index 000000000..b8e46ed55
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/attributes/GET.json
@@ -0,0 +1,16 @@
+{
+ "attribute": [
+ {
+ "name": "foo",
+ "value": "bar"
+ },
+ {
+ "name": "name1",
+ "value": "value1"
+ },
+ {
+ "name": "name2",
+ "value": "value2"
+ }
+ ]
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/attributes/POST.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/attributes/POST.json
new file mode 100644
index 000000000..ef0e23103
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/attributes/POST.json
@@ -0,0 +1,24 @@
+{
+ "attribute": [
+ {
+ "name": "foo",
+ "value": "bar"
+ },
+ {
+ "name": "name1",
+ "value": "value1"
+ },
+ {
+ "name": "name2",
+ "value": "value2"
+ },
+ {
+ "name": "DisplayName",
+ "value": "PHP Unit: Test app"
+ },
+ {
+ "name": "Notes",
+ "value": "This is a test app created by PHP Unit."
+ }
+ ]
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/attributes/name1/GET.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/attributes/name1/GET.json
new file mode 100644
index 000000000..70781593c
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/attributes/name1/GET.json
@@ -0,0 +1,4 @@
+{
+ "name": "name1",
+ "value": "value1"
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/attributes/name1/POST.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/attributes/name1/POST.json
new file mode 100644
index 000000000..9edebb0aa
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/attributes/name1/POST.json
@@ -0,0 +1,4 @@
+{
+ "name": "name1",
+ "value": "value1-edited"
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/keys/create/POST.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/keys/create/POST.json
new file mode 100644
index 000000000..c9ab77b81
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/keys/create/POST.json
@@ -0,0 +1,9 @@
+{
+ "apiProducts": [],
+ "attributes": [],
+ "consumerKey": "phpunit_test_app_key",
+ "consumerSecret": "phpunit_test_app_secret",
+ "issuedAt": 648345600000,
+ "scopes": [],
+ "status": "approved"
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/keys/phpunit_test_app_key/GET.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/keys/phpunit_test_app_key/GET.json
new file mode 100644
index 000000000..77813e989
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/keys/phpunit_test_app_key/GET.json
@@ -0,0 +1,10 @@
+{
+ "apiProducts": [],
+ "attributes": [],
+ "consumerKey": "phpunit_test_app_key",
+ "consumerSecret": "phpunit_test_app_secret",
+ "expiresAt": -1,
+ "issuedAt": 648345600000,
+ "scopes": [],
+ "status": "approved"
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/keys/phpunit_test_app_key/POST.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/keys/phpunit_test_app_key/POST.json
new file mode 100644
index 000000000..d868a7333
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/keys/phpunit_test_app_key/POST.json
@@ -0,0 +1,15 @@
+{
+ "apiProducts": [
+ {
+ "apiproduct": "phpunit_test",
+ "status": "approved"
+ }
+ ],
+ "attributes": [],
+ "consumerKey": "phpunit_test_app_key",
+ "consumerSecret": "phpunit_test_app_secret",
+ "expiresAt": -1,
+ "issuedAt": 648345600000,
+ "scopes": [],
+ "status": "approved"
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/keys/phpunit_test_app_key/PUT.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/keys/phpunit_test_app_key/PUT.json
new file mode 100644
index 000000000..287985358
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/apps/phpunit_test_app/keys/phpunit_test_app_key/PUT.json
@@ -0,0 +1,17 @@
+{
+ "apiProducts": [
+ {
+ "apiproduct": "phpunit_test",
+ "status": "approved"
+ }
+ ],
+ "attributes": [],
+ "consumerKey": "phpunit_test_app_key",
+ "consumerSecret": "phpunit_test_app_secret",
+ "expiresAt": -1,
+ "issuedAt": 648345600000,
+ "scopes": [
+ "scope 1"
+ ],
+ "status": "approved"
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/attributes/GET.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/attributes/GET.json
new file mode 100644
index 000000000..b8e46ed55
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/attributes/GET.json
@@ -0,0 +1,16 @@
+{
+ "attribute": [
+ {
+ "name": "foo",
+ "value": "bar"
+ },
+ {
+ "name": "name1",
+ "value": "value1"
+ },
+ {
+ "name": "name2",
+ "value": "value2"
+ }
+ ]
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/attributes/POST.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/attributes/POST.json
new file mode 100644
index 000000000..b8e46ed55
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/attributes/POST.json
@@ -0,0 +1,16 @@
+{
+ "attribute": [
+ {
+ "name": "foo",
+ "value": "bar"
+ },
+ {
+ "name": "name1",
+ "value": "value1"
+ },
+ {
+ "name": "name2",
+ "value": "value2"
+ }
+ ]
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/attributes/name1/GET.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/attributes/name1/GET.json
new file mode 100644
index 000000000..70781593c
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/attributes/name1/GET.json
@@ -0,0 +1,4 @@
+{
+ "name": "name1",
+ "value": "value1"
+}
diff --git a/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/attributes/name1/POST.json b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/attributes/name1/POST.json
new file mode 100644
index 000000000..9edebb0aa
--- /dev/null
+++ b/tests/offline-test-data/v1/organizations/phpunit/appgroups/phpunit/attributes/name1/POST.json
@@ -0,0 +1,4 @@
+{
+ "name": "name1",
+ "value": "value1-edited"
+}