public function getAliases($groupName, $reset = false)
    {
        if (!$reset && isset($this->aliases[$groupName])) {
            return $this->aliases[$groupName];
        }

        // Drush 9 uses 'site:alias', Drush <9 uses 'site-alias'. Fortunately
        // the alias 'sa' exists in both.
        $args = [$this->getDrushExecutable(), '@none', 'sa', '--format=json', '@' . $groupName];

        $aliases = [];

        // Run the command with a 5-second timeout. An exception will be thrown
        // if it fails.
        try {
            $result = $this->shellHelper->execute($args, null, true, true, [], 5);
            if (is_string($result)) {
                $aliases = (array) json_decode($result, true);
            }
        } catch (ProcessFailedException $e) {
            // The command will fail if the alias is not found. Throw an
            // exception for any other failures.
            if (stripos($e->getProcess()->getErrorOutput(), 'not found') === false) {
                throw $e;
            }
        }

        $this->aliases[$groupName] = $aliases;

        return $aliases;
    }
public function getAliases($groupName, $reset = false)
    {
        if (!$reset && isset($this->aliases[$groupName])) {
            return $this->aliases[$groupName];
        }

        // Drush 9 uses 'site:alias', Drush <9 uses 'site-alias'. Fortunately
        // the alias 'sa' exists in both.
        $args = [$this->getDrushExecutable(), '@none', 'sa', '--format=json', '@' . $groupName];

        $aliases = [];

        // Run the command with a 5-second timeout. An exception will be thrown
        // if it fails.
        try {
            $result = $this->shellHelper->execute($args, null, true, true, [], 5);
            if (is_string($result)) {
                $aliases = (array) json_decode($result, true);
            }
        } catch (ProcessFailedException $e) {
            // The command will fail if the alias is not found. Throw an
            // exception for any other failures.
            if (stripos($e->getProcess()->getErrorOutput(), 'not found') === false) {
                throw $e;
            }
        }

        $this->aliases[$groupName] = $aliases;

        return $aliases;
    }
public function getAliases ( $ groupName , $ reset = false ) { if ( ! $ reset && isset ( $ this -> aliases [ $ groupName ] ) ) { return $ this -> aliases [ $ groupName ] ; } // Drush 9 uses 'site:alias', Drush <9 uses 'site-alias'. Fortunately // the alias 'sa' exists in both. $ args = [ $ this -> getDrushExecutable ( ) , '@none' , 'sa' , '--format=json' , '@' . $ groupName ] ; $ aliases = [ ] ; // Run the command with a 5-second timeout. An exception will be thrown // if it fails. try { $ result = $ this -> shellHelper -> execute ( $ args , null , true , true , [ ] , 5 ) ; if ( is_string ( $ result ) ) { $ aliases = ( array ) json_decode ( $ result , true ) ; } } catch ( ProcessFailedException $ e ) { // The command will fail if the alias is not found. Throw an // exception for any other failures. if ( stripos ( $ e -> getProcess ( ) -> getErrorOutput ( ) , 'not found' ) === false ) { throw $ e ; } } $ this -> aliases [ $ groupName ] = $ aliases ; return $ aliases ; }
Get existing Drush aliases for a group.

@param string $groupName
@param bool   $reset

@throws \Exception If the "drush sa" command fails.

@return array
Get existing Drush aliases for a group .