You are here

class CliService in Apigee Edge 8

A CLI service which defines all the commands logic and delegates the methods.

Hierarchy

Expanded class hierarchy of CliService

1 string reference to 'CliService'
apigee_edge.services.yml in ./apigee_edge.services.yml
apigee_edge.services.yml
1 service uses CliService
apigee_edge.cli in ./apigee_edge.services.yml
Drupal\apigee_edge\CliService

File

src/CliService.php, line 29

Namespace

Drupal\apigee_edge
View source
class CliService implements CliServiceInterface {

  /**
   * The service that makes calls to the Apigee API.
   *
   * @var \Drupal\apigee_edge\Command\Util\ApigeeEdgeManagementCliServiceInterface
   */
  private $apigeeEdgeManagementCliService;

  /**
   * CliService constructor.
   *
   * @param \Drupal\apigee_edge\Command\Util\ApigeeEdgeManagementCliServiceInterface $apigeeEdgeManagementCliService
   *   The ApigeeEdgeManagementCliService to make calls to Apigee Edge.
   */
  public function __construct(ApigeeEdgeManagementCliServiceInterface $apigeeEdgeManagementCliService) {
    $this->apigeeEdgeManagementCliService = $apigeeEdgeManagementCliService;
  }

  /**
   * {@inheritdoc}
   */
  public function sync(StyleInterface $io, callable $t) {
    $io
      ->title($t('Developer - User synchronization'));
    $batch = DeveloperSyncController::getBatch();
    $last_message = '';
    foreach ($batch['operations'] as $operation) {
      $context = [
        'finished' => 0,
      ];
      while ($context['finished'] < 1) {
        call_user_func_array($operation[0], array_merge($operation[1], [
          &$context,
        ]));
        if (isset($context['message']) && $context['message'] !== $last_message) {
          $io
            ->text($t($context['message']));
        }
        $last_message = $context['message'];
        gc_collect_cycles();
      }
    }
  }

  /**
   * {@inheritdoc}
   */
  public function createEdgeRoleForDrupal(StyleInterface $io, callable $t, string $org, string $email, string $password, ?string $base_url, ?string $role_name, ?bool $force) {
    $this->apigeeEdgeManagementCliService
      ->createEdgeRoleForDrupal($io, $t, $org, $email, $password, $base_url, $role_name, $force);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CliService::$apigeeEdgeManagementCliService private property The service that makes calls to the Apigee API.
CliService::createEdgeRoleForDrupal public function Create an Apigee role for Drupal use. Overrides CliServiceInterface::createEdgeRoleForDrupal
CliService::sync public function Handle the sync interaction. Overrides CliServiceInterface::sync
CliService::__construct public function CliService constructor.