protected function createDirFromNamespace($path, $namespace = null)
    {
        if ($namespace) {
            $path .= '/' . str_replace('\\', '/', trim($namespace, '\\'));
            if (is_dir($path)) {
                return $path . '/';
            }
            if (file_exists($path)) {
                throw new \Exception(sprintf('Path %s already exists', $path));
            }
            mkdir($path, 0777, true);
        }

        return $path;
    }
protected function createDirFromNamespace($path, $namespace = null)
    {
        if ($namespace) {
            $path .= '/' . str_replace('\\', '/', trim($namespace, '\\'));
            if (is_dir($path)) {
                return $path . '/';
            }
            if (file_exists($path)) {
                throw new \Exception(sprintf('Path %s already exists', $path));
            }
            mkdir($path, 0777, true);
        }

        return $path;
    }
protected function createDirFromNamespace ( $ path , $ namespace = null ) { if ( $ namespace ) { $ path .= '/' . str_replace ( '\\' , '/' , trim ( $ namespace , '\\' ) ) ; if ( is_dir ( $ path ) ) { return $ path . '/' ; } if ( file_exists ( $ path ) ) { throw new \ Exception ( sprintf ( 'Path %s already exists' , $ path ) ) ; } mkdir ( $ path , 0777 , true ) ; } return $ path ; }
Determines directory from long class name

Creates directory if not exists

@param string $path      The path to generate classes
@param string $namespace The namespace of the class

@throws \Exception

@return string Directory name
Determines directory from long class name