-
Notifications
You must be signed in to change notification settings - Fork 9
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
Single class diagram #76
base: main
Are you sure you want to change the base?
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pmaasz
Thank you very much.
I have added a comment for the changed file, please confirm.
bin/php-class-diagram
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.].
src/Main.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pmaasz
Perhaps this repository is closer to your goal.
https://github.com/hirokinoue/dependency-visualizer
@hirokinoue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.