private function resolveInclude($value, $filename, $configKey = '')
    {
        if (is_string($value)) {
            $includeType = 'yaml';
            $includePath = $value;
        } elseif (is_array($value)) {
            if ($missing = array_diff(['type', 'path'], array_keys($value))) {
                throw new InvalidConfigException('The !include tag is missing the key(s): ' . implode(', ', $missing), $filename, $configKey);
            }
            $includeType = $value['type'];
            $includePath = $value['path'];
        } else {
            throw new InvalidConfigException('The !include tag must be a string (for a YAML include), or an object containing "type" and "path".', $filename, $configKey);
        }
        $dir = dirname($filename);
        if (!$realDir = realpath($dir)) {
            throw new \RuntimeException('Failed to resolve directory: ' . $dir);
        }
        $includeFile = rtrim($realDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . ltrim($includePath, DIRECTORY_SEPARATOR);

        try {
            switch ($includeType) {
                // Ignore binary and archive values (for now at least).
                case 'archive':
                case 'binary':
                    return $value;

                case 'yaml':
                    return $this->parseFile($includeFile);

                case 'string':
                    return $this->readFile($includeFile);

                default:
                    throw new InvalidConfigException(sprintf(
                        'Unrecognized !include tag type "%s"',
                        $includeType
                    ), $filename, $configKey);
            }
        } catch (\Exception $e) {
            if ($e instanceof InvalidConfigException) {
                throw $e;
            }
            throw new InvalidConfigException($e->getMessage(), $filename, $configKey);
        }
    }
private function resolveInclude($value, $filename, $configKey = '')
    {
        if (is_string($value)) {
            $includeType = 'yaml';
            $includePath = $value;
        } elseif (is_array($value)) {
            if ($missing = array_diff(['type', 'path'], array_keys($value))) {
                throw new InvalidConfigException('The !include tag is missing the key(s): ' . implode(', ', $missing), $filename, $configKey);
            }
            $includeType = $value['type'];
            $includePath = $value['path'];
        } else {
            throw new InvalidConfigException('The !include tag must be a string (for a YAML include), or an object containing "type" and "path".', $filename, $configKey);
        }
        $dir = dirname($filename);
        if (!$realDir = realpath($dir)) {
            throw new \RuntimeException('Failed to resolve directory: ' . $dir);
        }
        $includeFile = rtrim($realDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . ltrim($includePath, DIRECTORY_SEPARATOR);

        try {
            switch ($includeType) {
                // Ignore binary and archive values (for now at least).
                case 'archive':
                case 'binary':
                    return $value;

                case 'yaml':
                    return $this->parseFile($includeFile);

                case 'string':
                    return $this->readFile($includeFile);

                default:
                    throw new InvalidConfigException(sprintf(
                        'Unrecognized !include tag type "%s"',
                        $includeType
                    ), $filename, $configKey);
            }
        } catch (\Exception $e) {
            if ($e instanceof InvalidConfigException) {
                throw $e;
            }
            throw new InvalidConfigException($e->getMessage(), $filename, $configKey);
        }
    }
private function resolveInclude ( $ value , $ filename , $ configKey = '' ) { if ( is_string ( $ value ) ) { $ includeType = 'yaml' ; $ includePath = $ value ; } elseif ( is_array ( $ value ) ) { if ( $ missing = array_diff ( [ 'type' , 'path' ] , array_keys ( $ value ) ) ) { throw new InvalidConfigException ( 'The !include tag is missing the key(s): ' . implode ( ', ' , $ missing ) , $ filename , $ configKey ) ; } $ includeType = $ value [ 'type' ] ; $ includePath = $ value [ 'path' ] ; } else { throw new InvalidConfigException ( 'The !include tag must be a string (for a YAML include), or an object containing "type" and "path".' , $ filename , $ configKey ) ; } $ dir = dirname ( $ filename ) ; if ( ! $ realDir = realpath ( $ dir ) ) { throw new \ RuntimeException ( 'Failed to resolve directory: ' . $ dir ) ; } $ includeFile = rtrim ( $ realDir , DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR . ltrim ( $ includePath , DIRECTORY_SEPARATOR ) ; try { switch ( $ includeType ) { // Ignore binary and archive values (for now at least). case 'archive' : case 'binary' : return $ value ; case 'yaml' : return $ this -> parseFile ( $ includeFile ) ; case 'string' : return $ this -> readFile ( $ includeFile ) ; default : throw new InvalidConfigException ( sprintf ( 'Unrecognized !include tag type "%s"' , $ includeType ) , $ filename , $ configKey ) ; } } catch ( \ Exception $ e ) { if ( $ e instanceof InvalidConfigException ) { throw $ e ; } throw new InvalidConfigException ( $ e -> getMessage ( ) , $ filename , $ configKey ) ; } }
Resolve an !include config tag value.

@param mixed  $value
@param string $filename
@param string $configKey

@throws \Platformsh\Cli\Exception\InvalidConfigException

@return string|array
Resolve an !include config tag value .