protected function generateRemoteAlias(Environment $environment, LocalApplication $app)
    {
        if (!$environment->hasLink('ssh')) {
            return false;
        }

        $sshUrl = $environment->getSshUrl($app->getName());

        $alias = [
            'options' => [
                $this->getAutoRemoveKey() => true,
            ],
        ];

        // For most environments, we know the application root directory is
        // '/app'. It's different in Enterprise environments.
        if ($environment->deployment_target !== 'local') {
            $appRoot = $this->drush->getCachedAppRoot($sshUrl);
            if ($appRoot) {
                $alias['root'] = rtrim($appRoot, '/') . '/' . $app->getDocumentRoot();
            }
        } else {
            $alias['root'] = '/app/' . $app->getDocumentRoot();
        }

        list($alias['user'], $alias['host']) = explode('@', $sshUrl, 2);

        if ($url = $this->getUrl($environment)) {
            $alias['uri'] = $url;
        }

        return $alias;
    }