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

Single class diagram #76

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

Conversation

pmaasz
Copy link
Contributor

@pmaasz 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

Copy link
Owner

@smeghead smeghead left a 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.

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));
Copy link
Owner

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
Copy link
Owner

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);
}

Copy link
Contributor Author

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!

Copy link
Owner

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

Copy link
Contributor Author

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.

@pmaasz pmaasz marked this pull request as draft August 31, 2024 09:32
@jose-ba jose-ba mentioned this pull request Nov 30, 2024
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

Successfully merging this pull request may close these issues.

2 participants