public function getNamespace($namespace, $documentsDirectory = null)
    {
        if (!$documentsDirectory) {
            $documentsDirectory = $this->documentDir;
        }

        if (strpos($namespace, ':') !== false) {
            list($bundle, $document) = explode(':', $namespace);
            $bundle = $this->getBundleClass($bundle);

            // If bundle has a sub-namespace it needs to be replaced
            if (strpos($documentsDirectory, '\\')) {
                $bundleSubNamespace = substr(
                    $bundle,
                    $start = strpos($bundle, '\\') + 1,
                    strrpos($bundle, '\\') - $start + 1
                );

                $documentsDirectory = str_replace(
                    $bundleSubNamespace,
                    '',
                    $documentsDirectory
                );
            }

            $namespace = substr($bundle, 0, strrpos($bundle, '\\')) . '\\' .
                $documentsDirectory . '\\' . $document;
        }

        return $namespace;
    }
public function getNamespace($namespace, $documentsDirectory = null)
    {
        if (!$documentsDirectory) {
            $documentsDirectory = $this->documentDir;
        }

        if (strpos($namespace, ':') !== false) {
            list($bundle, $document) = explode(':', $namespace);
            $bundle = $this->getBundleClass($bundle);

            // If bundle has a sub-namespace it needs to be replaced
            if (strpos($documentsDirectory, '\\')) {
                $bundleSubNamespace = substr(
                    $bundle,
                    $start = strpos($bundle, '\\') + 1,
                    strrpos($bundle, '\\') - $start + 1
                );

                $documentsDirectory = str_replace(
                    $bundleSubNamespace,
                    '',
                    $documentsDirectory
                );
            }

            $namespace = substr($bundle, 0, strrpos($bundle, '\\')) . '\\' .
                $documentsDirectory . '\\' . $document;
        }

        return $namespace;
    }
public function getNamespace ( $ namespace , $ documentsDirectory = null ) { if ( ! $ documentsDirectory ) { $ documentsDirectory = $ this -> documentDir ; } if ( strpos ( $ namespace , ':' ) !== false ) { list ( $ bundle , $ document ) = explode ( ':' , $ namespace ) ; $ bundle = $ this -> getBundleClass ( $ bundle ) ; // If bundle has a sub-namespace it needs to be replaced if ( strpos ( $ documentsDirectory , '\\' ) ) { $ bundleSubNamespace = substr ( $ bundle , $ start = strpos ( $ bundle , '\\' ) + 1 , strrpos ( $ bundle , '\\' ) - $ start + 1 ) ; $ documentsDirectory = str_replace ( $ bundleSubNamespace , '' , $ documentsDirectory ) ; } $ namespace = substr ( $ bundle , 0 , strrpos ( $ bundle , '\\' ) ) . '\\' . $ documentsDirectory . '\\' . $ document ; } return $ namespace ; }
Formats namespace from short syntax.

@param string $namespace
@param string $documentsDirectory Directory name where documents are stored in the bundle.

@return string
Formats namespace from short syntax .