Skip to content

Commit

Permalink
use generators, add cli processing info
Browse files Browse the repository at this point in the history
  • Loading branch information
zamoroka committed Oct 14, 2020
1 parent 3966136 commit 3c5a4f3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 1 addition & 3 deletions app/ClassFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ class ClassFinder
*/
public function getAllClasses($dir)
{
$classList = [];
foreach ($this->rSearch($dir, "/.*\.php$/") as $filename) {
try {
$classList[] = [
yield [
'file_name' => $filename,
'class_name' => $this->getClassFullNameFromFile($filename),
];
Expand All @@ -33,7 +32,6 @@ public function getAllClasses($dir)
}
}

return $classList;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions app/DependencyCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ private function getDependenciesForDir(string $dir)
$classLoader = require $this->projectDir . 'vendor/autoload.php';
$astLocator = (new BetterReflection())->astLocator();
$reflector = new ClassReflector(new ComposerSourceLocator($classLoader, $astLocator));
$classes = $this->classFinder->getAllClasses($dir);
foreach ($classes as $class) {
foreach ($this->classFinder->getAllClasses($dir) as $class) {
try {
$classInfo = $reflector->reflect($class['class_name']);
// --- current module ---
Expand Down
2 changes: 2 additions & 0 deletions getDependencyGraph.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ fi
FILE_MAGENTO="$1/bin/magento"

if [ -f "$FILE_MAGENTO" ]; then
echo "Starting .dot generation at: $(date +%Y\.%m\.%d) $(date +%H:%M:%S)"
php index.php --magento-dir "$1" --module-vendor "$2" >"$(date +%Y-%m-%d)".dot
echo "Completed .dot generation at: $(date +%Y\.%m\.%d) $(date +%H:%M:%S)"
dot -Tpdf -o"$(date +%Y-%m-%d)".pdf -Tsvg -o"$(date +%Y-%m-%d)".svg "$(date +%Y-%m-%d)".dot
else
echoerr "Provided directory is missing Magento 2 files"
Expand Down

0 comments on commit 3c5a4f3

Please sign in to comment.