Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
imanghafoori1 committed Dec 25, 2023
1 parent 350e973 commit 5984e33
Show file tree
Hide file tree
Showing 33 changed files with 719 additions and 516 deletions.
9 changes: 5 additions & 4 deletions microscope
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter;
use Imanghafoori\LaravelMicroscope\Features\CheckImports\CheckImportReporter;
use Imanghafoori\LaravelMicroscope\Features\CheckImports\Checks\CheckClassReferencesAreValid;
use Imanghafoori\LaravelMicroscope\Features\CheckImports\Handlers\PrintWrongClassRefs;
use Imanghafoori\LaravelMicroscope\Features\CheckImports\Reporters\CheckImportReporter;
use Imanghafoori\LaravelMicroscope\Features\CheckImports\Reporters\Psr4Report;
use Imanghafoori\LaravelMicroscope\FileReaders\FilePath;
use Imanghafoori\LaravelMicroscope\ForPsr4LoadedClasses;
use Imanghafoori\TokenAnalyzer\ParseUseStatement;
Expand Down Expand Up @@ -55,6 +56,6 @@ $psr4Stats = ForPsr4LoadedClasses::check([CheckClassReferencesAreValid::class],
$output = new ConsoleOutput();
ErrorPrinter::singleton($output)->logErrors();

$output->writeln(CheckImportReporter::totalImportsMsg());
$output->writeln(CheckImportReporter::printPsr4($psr4Stats));
$output->writeln(CheckImportReporter::printErrorsCount());
$output->writeln(CheckImportReporter::totalImportsMsg(1));
$output->writeln(Psr4Report::printPsr4($psr4Stats));
//$output->writeln(CheckImportReporter::printErrorsCount());
10 changes: 5 additions & 5 deletions src/Analyzers/ComposerJson.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ public static function getClassMaps($basePath)
$result = [];
foreach (self::make()->readAutoloadClassMap() as $compPath => $classMaps) {
foreach ($classMaps as $classmap) {
$compPath = trim($compPath, '/');
$compPath = $compPath ? $compPath.DIRECTORY_SEPARATOR : '';
$classmap = $basePath.DIRECTORY_SEPARATOR.$compPath.$classmap;
$classmap = array_values(ClassMapGenerator::createMap($classmap));
$result = array_merge($classmap, $result);
$compPath1 = trim($compPath, '/');
$compPath1 = $compPath1 ? $compPath1.DIRECTORY_SEPARATOR : '';
$classmapFullPath = $basePath.DIRECTORY_SEPARATOR.$compPath1.$classmap;
$classes = array_values(ClassMapGenerator::createMap($classmapFullPath));
$result[$compPath][$classmap] = $classes;
}
}

Expand Down
103 changes: 0 additions & 103 deletions src/BladeFiles.php

This file was deleted.

1 change: 1 addition & 0 deletions src/Commands/CheckBadPractice.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ private function checkPsr4Classes()
LaravelPaths::configDirs()
);

$configs = iterator_to_array($configs);
foreach (ComposerJson::readAutoload() as $psr4) {
foreach ($psr4 as $dirPath) {
foreach (FilePath::getAllPhpFiles($dirPath) as $filePath) {
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/CheckBladeQueries.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Imanghafoori\LaravelMicroscope\Commands;

use Illuminate\Console\Command;
use Imanghafoori\LaravelMicroscope\BladeFiles;
use Imanghafoori\LaravelMicroscope\Checks\CheckIsQuery;
use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter;
use Imanghafoori\LaravelMicroscope\Iterators\BladeFiles;
use Imanghafoori\LaravelMicroscope\Traits\LogsErrors;

class CheckBladeQueries extends Command
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/CheckExtractBladeIncludes.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Imanghafoori\LaravelMicroscope\Commands;

use Illuminate\Console\Command;
use Imanghafoori\LaravelMicroscope\BladeFiles;
use Imanghafoori\LaravelMicroscope\Checks\ExtractBladePartial;
use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter;
use Imanghafoori\LaravelMicroscope\Iterators\BladeFiles;
use Imanghafoori\LaravelMicroscope\Traits\LogsErrors;

class CheckExtractBladeIncludes extends Command
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/CheckRoutes.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
use Illuminate\Filesystem\Filesystem;
use Illuminate\Routing\Router;
use Illuminate\Support\Str;
use Imanghafoori\LaravelMicroscope\BladeFiles;
use Imanghafoori\LaravelMicroscope\Checks\CheckRouteCalls;
use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter;
use Imanghafoori\LaravelMicroscope\Features\ActionComments\ActionsComments;
use Imanghafoori\LaravelMicroscope\ForPsr4LoadedClasses;
use Imanghafoori\LaravelMicroscope\Iterators\BladeFiles;
use Imanghafoori\LaravelMicroscope\Traits\LogsErrors;

class CheckRoutes extends Command
Expand Down
178 changes: 0 additions & 178 deletions src/Features/CheckImports/CheckImportReporter.php

This file was deleted.

Loading

0 comments on commit 5984e33

Please sign in to comment.