src/Rocketeer/Services/Config/ContextualConfiguration.php
protected function getForContext($option, $type, $original, ConnectionKey $connectionKey)
    {
        // Switch context
        switch ($type) {
            case 'servers':
                $contextual = sprintf('connections.%s.servers.%d.config.%s', $connectionKey->name, $connectionKey->server, $option);
                break;

            case 'stages':
                $contextual = sprintf('on.stages.%s.%s', $connectionKey->stage, $option);
                break;

            case 'connections':
                $contextual = sprintf('on.connections.%s.%s', $connectionKey->name, $option);
                break;

            default:
                $contextual = $option;
                break;
        }

        // Merge with defaults
        $value = $this->configuration->get($contextual);
        if (is_array($value) && $original) {
            $value = array_replace($original, $value);
        }

        return $value;
    }
protected function getForContext($option, $type, $original, ConnectionKey $connectionKey)
    {
        // Switch context
        switch ($type) {
            case 'servers':
                $contextual = sprintf('connections.%s.servers.%d.config.%s', $connectionKey->name, $connectionKey->server, $option);
                break;

            case 'stages':
                $contextual = sprintf('on.stages.%s.%s', $connectionKey->stage, $option);
                break;

            case 'connections':
                $contextual = sprintf('on.connections.%s.%s', $connectionKey->name, $option);
                break;

            default:
                $contextual = $option;
                break;
        }

        // Merge with defaults
        $value = $this->configuration->get($contextual);
        if (is_array($value) && $original) {
            $value = array_replace($original, $value);
        }

        return $value;
    }
protected function getForContext ( $ option , $ type , $ original , ConnectionKey $ connectionKey ) { // Switch context switch ( $ type ) { case 'servers' : $ contextual = sprintf ( 'connections.%s.servers.%d.config.%s' , $ connectionKey -> name , $ connectionKey -> server , $ option ) ; break ; case 'stages' : $ contextual = sprintf ( 'on.stages.%s.%s' , $ connectionKey -> stage , $ option ) ; break ; case 'connections' : $ contextual = sprintf ( 'on.connections.%s.%s' , $ connectionKey -> name , $ option ) ; break ; default : $ contextual = $ option ; break ; } // Merge with defaults $ value = $ this -> configuration -> get ( $ contextual ) ; if ( is_array ( $ value ) && $ original ) { $ value = array_replace ( $ original , $ value ) ; } return $ value ; }
Get a contextual option.

@param string             $option
@param string             $type
@param string|array|null  $original
@param ConnectionKey|null $connectionKey

@return array|Closure|string
Get a contextual option .