Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wildcard class #11

Open
mhf-ir opened this issue Jan 9, 2019 · 2 comments
Open

wildcard class #11

mhf-ir opened this issue Jan 9, 2019 · 2 comments

Comments

@mhf-ir
Copy link

mhf-ir commented Jan 9, 2019

How to add entire namespace to documentation generation not one by one class

@StephanKrauss
Copy link

Hello,

i look for a good php documentation tool.
I have the same problem.
I need a way to generate documentation from a directory recursivly.
In my project my files are under ./src/App/

Your sincerly

Stephan

@StephanKrauss
Copy link

Hello,

i have wrote a quick and dirty script to generate the config file.

function getDirContents($dir, &$classes = array()) {
$files = scandir($dir);

    foreach ($files as $key => $value) {
        $path = realpath($dir . DIRECTORY_SEPARATOR . $value);

        if (!is_dir($path)) {
            $pathParts = explode("src", $path);

            $class = substr($pathParts[1], 0,-4,);
            $class = "'".$class."'";
            $classes[] = $class;
        }
        else if ($value != "." && $value != "..") {
            getDirContents($path, $classes);
            // $classes[] = $path;
        }
    }

    return $classes;
}

$classes = getDirContents('src/');
$classes = implode(",\n" , $classes);

$fp = fopen('.phpdoc-md',"w");

$file = "
    <?php
    return (object)[
        'rootNamespace' => 'App',
        'destDirectory' => '_docs',
        'format' => 'github',
        'classes' => [
            ".$classes."
        ],
    ];
";

fputs($fp,$file);

fclose($fp);

Your sincerly

Stephan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants