Skip to content

Commit

Permalink
Changes for PHPCS Fixes (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
kedarkhaire authored Oct 3, 2024
1 parent a56e3fe commit f43f83e
Show file tree
Hide file tree
Showing 453 changed files with 1,511 additions and 1,326 deletions.
8 changes: 4 additions & 4 deletions examples/authentication.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -122,7 +122,7 @@ class ClientFactory
/**
* Returns a configured API client.
*
* @return \Apigee\Edge\ClientInterface
* @return ClientInterface
*/
public function getClient(): ClientInterface
{
Expand Down
4 changes: 2 additions & 2 deletions examples/create_new_app_with_credential.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']));
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions examples/developer_app_analytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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}')")
Expand Down
4 changes: 2 additions & 2 deletions examples/list_multiple_entities.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down Expand Up @@ -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";
}
Expand Down
10 changes: 5 additions & 5 deletions src/Api/ApigeeX/Controller/AcceptedRatePlanController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/Api/ApigeeX/Controller/ApiProductController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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();

Expand All @@ -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())) {
Expand All @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Api/ApigeeX/Controller/AppByOwnerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ abstract class AppByOwnerController extends PaginatedEntityController implements
* @param ClientInterface $client
* @param EntitySerializerInterface|null $entitySerializer
*/
public function __construct(string $organization, ClientInterface $client, EntitySerializerInterface $entitySerializer = null)
public function __construct(string $organization, ClientInterface $client, ?EntitySerializerInterface $entitySerializer = null)
{
$entitySerializer = $entitySerializer ?? new AppEntitySerializer();
parent::__construct($organization, $client, $entitySerializer);
Expand Down
22 changes: 11 additions & 11 deletions src/Api/ApigeeX/Controller/AppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ class AppController extends PaginatedEntityController implements AppControllerIn
* AppController 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
?OrganizationControllerInterface $organizationController = null,
) {
$entitySerializer = $entitySerializer ?? new AppGroupEntitySerializer();
parent::__construct($organization, $client, $entitySerializer, $organizationController);
Expand All @@ -77,15 +77,15 @@ public function loadAppGroup(string $appId): AppInterface
/**
* {@inheritdoc}
*/
public function listAppIds(PagerInterface $pager = null): array
public function listAppIds(?PagerInterface $pager = null): array
{
return $this->listEntityIds($pager, []);
}

/**
* {@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',
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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;

Expand Down
22 changes: 11 additions & 11 deletions src/Api/ApigeeX/Controller/AppControllerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,47 +58,47 @@ 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;

/**
* 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.
Expand All @@ -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[]
Expand All @@ -116,19 +116,19 @@ public function listAppIdsByStatus(string $status, PagerInterface $pager = null)
public function listAppsByStatus(
string $status,
bool $includeCredentials = true,
PagerInterface $pager = null
?PagerInterface $pager = null,
): array;

/**
* Returns a list of app ids filtered by app type from Edge.
*
* @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;
}
14 changes: 7 additions & 7 deletions src/Api/ApigeeX/Controller/AppGroupAppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AppGroupAppController extends AppByOwnerController implements AppGroupAppC
use AppGroupAwareControllerTrait;

/**
* @var \Apigee\Edge\Api\Management\Controller\OrganizationControllerInterface
* @var OrganizationControllerInterface
*/
protected $organizationController;

Expand All @@ -44,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
?EntitySerializerInterface $entitySerializer = null,
?OrganizationControllerInterface $organizationController = null,
) {
$this->appGroup = $appGroup;
$entitySerializer = $entitySerializer ?? new AppGroupEntitySerializer();
Expand All @@ -68,7 +68,7 @@ public function __construct(
*
* {@inheritdoc}
*/
public function getEntityIds(PagerInterface $pager = null): array
public function getEntityIds(?PagerInterface $pager = null): array
{
$uri = $this->getBaseEndpointUri();
$response = $this->getClient()->get($uri);
Expand Down
Loading

0 comments on commit f43f83e

Please sign in to comment.