Conversation
pmaasz
commented
Aug 30, 2024
- adding support to only name one php file as cli option
- single class diagram generation
- auto detection if file or directory is given
- extending error output accordingly
| exit(-1); | ||
| if (!is_file($directory) && !is_dir($directory)) { | ||
| if(!is_file($directory)) { | ||
| fwrite(STDERR, sprintf("ERROR: specified file dose not exists. file: %s\n", $directory)); |
There was a problem hiding this comment.
The error message displayed when you think you have specified a directory but the path is wrong is `ERROR: specified file dose not exist.
Since it is the basic policy that the default argument is a directory, [ERROR: specified directory dose not exist.] should be displayed.
It is better to use file_exists to check for the existence of a file or directory, and the error message if it does not exist should always be [ERROR: specified directory dose not exist.].
There was a problem hiding this comment.
Including a single file in the processing for Main.php would require a lot of modifications.
This is a more ad-hoc solution, but how about the following change in bin/php-class-diagram?
if (is_file($directory)) {
$options['include'] = basename($directory);
$directory = dirname($directory);
}There was a problem hiding this comment.
My actual goal is to have a file and draw all existing dependencies of the specified file disregarding the directory. I wanted to do this step by step so I don't tear the project apart. I can mark this MR as a draft and just work on this further. Thanks very much for your input!
There was a problem hiding this comment.
@pmaasz
Perhaps this repository is closer to your goal.
https://github.com/hirokinoue/dependency-visualizer
@hirokinoue
There was a problem hiding this comment.
Ok, I had a look at the suggested repo and tried it out but the drawn graph is sadly also missing the information I want.