protected function translate($name)
    {
        preg_match_all('/^(?P<bundle>[^:]+):(?P<directory>[^:]*:)?(?P<file>.+)$/', $name, $matches, \PREG_SET_ORDER);

        foreach (['bundle', 'file'] as $offset) {
            if (empty($matches[0][$offset])) {
                throw new ViewException(sprintf('Invalid or missing "%s" node in view filename "%s"', $offset, $name));
            }
        }

        $placeholders = [
            '{bundle}' => $matches[0]['bundle'],
            '{file}' => $matches[0]['file'],
            '{directory}' => isset($matches[0]['directory']) ? str_replace(':', '\\', $matches[0]['directory']) : null,
        ];

        $file = strtr($this->pattern, $placeholders);
        $file = str_replace(array('\\', '_', '//'), '/', $file);

        return $file;
    }
protected function translate($name)
    {
        preg_match_all('/^(?P<bundle>[^:]+):(?P<directory>[^:]*:)?(?P<file>.+)$/', $name, $matches, \PREG_SET_ORDER);

        foreach (['bundle', 'file'] as $offset) {
            if (empty($matches[0][$offset])) {
                throw new ViewException(sprintf('Invalid or missing "%s" node in view filename "%s"', $offset, $name));
            }
        }

        $placeholders = [
            '{bundle}' => $matches[0]['bundle'],
            '{file}' => $matches[0]['file'],
            '{directory}' => isset($matches[0]['directory']) ? str_replace(':', '\\', $matches[0]['directory']) : null,
        ];

        $file = strtr($this->pattern, $placeholders);
        $file = str_replace(array('\\', '_', '//'), '/', $file);

        return $file;
    }
protected function translate ( $ name ) { preg_match_all ( '/^(?P<bundle>[^:]+):(?P<directory>[^:]*:)?(?P<file>.+)$/' , $ name , $ matches , \ PREG_SET_ORDER ) ; foreach ( [ 'bundle' , 'file' ] as $ offset ) { if ( empty ( $ matches [ 0 ] [ $ offset ] ) ) { throw new ViewException ( sprintf ( 'Invalid or missing "%s" node in view filename "%s"' , $ offset , $ name ) ) ; } } $ placeholders = [ '{bundle}' => $ matches [ 0 ] [ 'bundle' ] , '{file}' => $ matches [ 0 ] [ 'file' ] , '{directory}' => isset ( $ matches [ 0 ] [ 'directory' ] ) ? str_replace ( ':' , '\\' , $ matches [ 0 ] [ 'directory' ] ) : null , ] ; $ file = strtr ( $ this -> pattern , $ placeholders ) ; $ file = str_replace ( array ( '\\' , '_' , '//' ) , '/' , $ file ) ; return $ file ; }
Translates view identifier to path

@param string $name

@return string
@throws ViewException
Translates view identifier to path