public function credentials(string $relationship, int $index = 0) : array
    {

        if (empty($this->relationshipsDef)) {
            if ($this->inBuild()) {
                throw new BuildTimeVariableAccessException('Relationships are not available during the build phase.');
            }
            throw new NotValidPlatformException('No relationships are defined. Are you sure you are on Platform.sh?'
                . '  If you\'re running on your local system you may need to create a tunnel'
                . ' to access your environment services.  See https://docs.platform.sh/gettingstarted/local/tethered.html');
        }

        if (empty($this->relationshipsDef[$relationship])) {
            throw new \InvalidArgumentException(sprintf('No relationship defined: %s.  Check your .platform.app.yaml file.', $relationship));
        }
        if (empty($this->relationshipsDef[$relationship][$index])) {
            throw new \InvalidArgumentException(sprintf('No index %d defined for relationship: %s.  Check your .platform.app.yaml file.', $index, $relationship));
        }

        return $this->relationshipsDef[$relationship][$index];
    }