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];
    }
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];
    }
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 ] ; }
Retrieves the credentials for accessing a relationship.

The relationship must be defined in the .platform.app.yaml file.

@param string $relationship
The relationship name as defined in .platform.app.yaml.
@param int $index
The index within the relationship to access.  This is always 0, but reserved
for future extension.
@return array
The credentials array for the service pointed to by the relationship.
@throws BuildTimeVariableAccessException
Thrown if called in a in the build phase, where relationships are not defined.
@throws \InvalidArgumentException
If the relationship/index pair requested does not exist.
Retrieves the credentials for accessing a relationship .