You are here

abstract class AbstractAppCredentialEvent in Apigee Edge 8

Base class for app credential create, generate and add products events.

Hierarchy

Expanded class hierarchy of AbstractAppCredentialEvent

2 files declare their use of AbstractAppCredentialEvent
DeveloperAppCredentialController.php in src/Entity/Controller/DeveloperAppCredentialController.php
TeamAppCredentialController.php in modules/apigee_edge_teams/src/Entity/Controller/TeamAppCredentialController.php

File

src/Event/AbstractAppCredentialEvent.php, line 29

Namespace

Drupal\apigee_edge\Event
View source
abstract class AbstractAppCredentialEvent extends Event {

  /**
   * Team app type.
   *
   * @var string
   */
  const APP_TYPE_TEAM = 'team';

  /**
   * Developer app type.
   *
   * @var string
   */
  const APP_TYPE_DEVELOPER = 'developer';

  /**
   * Type of the app.
   *
   * @var string
   */
  private $appType;

  /**
   * ID of the app owner.
   *
   * @var string
   */
  private $ownerId;

  /**
   * Name of the app.
   *
   * @var string
   */
  private $appName;

  /**
   * App credential.
   *
   * @var \Apigee\Edge\Api\Management\Entity\AppCredentialInterface
   */
  private $credential;

  /**
   * AppCredentialGenerateEvent constructor.
   *
   * @param string $app_type
   *   Either company or developer.
   * @param string $owner_id
   *   Company name or developer id (UUID by default) depending on the appType.
   * @param string $app_name
   *   Name of the app.
   * @param \Apigee\Edge\Api\Management\Entity\AppCredentialInterface $credential
   *   The app credential that has been created.
   */
  public function __construct(string $app_type, string $owner_id, string $app_name, AppCredentialInterface $credential) {
    if (!in_array($app_type, [
      self::APP_TYPE_DEVELOPER,
      self::APP_TYPE_TEAM,
    ])) {
      throw new \InvalidArgumentException('App type must be either team or developer.');
    }
    $this->appType = $app_type;
    $this->ownerId = $owner_id;
    $this->appName = $app_name;
    $this->credential = $credential;
  }

  /**
   * Returns the app type which is either "company" or "developer".
   *
   * @return string
   *   The app type.
   */
  public function getAppType() : string {
    return $this->appType;
  }

  /**
   * Returns owner id which is either a company name or a developer id (email).
   *
   * @return string
   *   The owner id.
   */
  public function getOwnerId() : string {
    return $this->ownerId;
  }

  /**
   * Returns the name of the app.
   *
   * @return string
   *   The app name.
   */
  public function getAppName() : string {
    return $this->appName;
  }

  /**
   * Returns the app credential.
   *
   * @return \Apigee\Edge\Api\Management\Entity\AppCredentialInterface
   *   The app credential.
   */
  public function getCredential() : AppCredentialInterface {
    return $this->credential;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AbstractAppCredentialEvent::$appName private property Name of the app.
AbstractAppCredentialEvent::$appType private property Type of the app.
AbstractAppCredentialEvent::$credential private property App credential.
AbstractAppCredentialEvent::$ownerId private property ID of the app owner.
AbstractAppCredentialEvent::APP_TYPE_DEVELOPER constant Developer app type.
AbstractAppCredentialEvent::APP_TYPE_TEAM constant Team app type.
AbstractAppCredentialEvent::getAppName public function Returns the name of the app.
AbstractAppCredentialEvent::getAppType public function Returns the app type which is either "company" or "developer".
AbstractAppCredentialEvent::getCredential public function Returns the app credential.
AbstractAppCredentialEvent::getOwnerId public function Returns owner id which is either a company name or a developer id (email).
AbstractAppCredentialEvent::__construct public function AppCredentialGenerateEvent constructor. 2