Platformsh\Cli\Event\EnvironmentsChangedEvent::getEnvironments PHP Method

getEnvironments() public method

public getEnvironments ( )
    public function getEnvironments()
    {
        return $this->environments;
    }

Usage Example

 /**
  * Update the user's local Drush aliases.
  *
  * This is called via the 'environments_changed' event.
  *
  * @see Api::getEnvironments()
  *
  * @param EnvironmentsChangedEvent $event
  */
 public function updateDrushAliases(EnvironmentsChangedEvent $event)
 {
     $projectRoot = $this->getProjectRoot();
     if (!$projectRoot) {
         return;
     }
     // Double-check that the passed project is the current one.
     $currentProject = $this->getCurrentProject();
     if (!$currentProject || $currentProject->id != $event->getProject()->id) {
         return;
     }
     // Ignore the project if it doesn't contain a Drupal application.
     if (!Drupal::isDrupal($projectRoot)) {
         return;
     }
     $this->debug('Updating Drush aliases');
     /** @var \Platformsh\Cli\Helper\DrushHelper $drushHelper */
     $drushHelper = $this->getHelper('drush');
     $drushHelper->setHomeDir($this->getHomeDir());
     $drushHelper->createAliases($event->getProject(), $projectRoot, $event->getEnvironments());
 }