| @@ 11-33 (lines=23) @@ | ||
| 8 | use Imanghafoori\LaravelMicroscope\Psr4Classes; |
|
| 9 | use Imanghafoori\LaravelMicroscope\Traits\LogsErrors; |
|
| 10 | ||
| 11 | class CheckActionComments extends Command |
|
| 12 | { |
|
| 13 | use LogsErrors; |
|
| 14 | ||
| 15 | protected $signature = 'check:action_comments'; |
|
| 16 | ||
| 17 | protected $description = 'Adds route definition to the controller actions'; |
|
| 18 | ||
| 19 | public function handle(ErrorPrinter $errorPrinter) |
|
| 20 | { |
|
| 21 | $errorPrinter->printer = $this->output; |
|
| 22 | ||
| 23 | $this->info('Commentify Route Actions...'); |
|
| 24 | ||
| 25 | ActionsComments::$command = $this; |
|
| 26 | ||
| 27 | Psr4Classes::check([ActionsComments::class]); |
|
| 28 | ||
| 29 | $this->finishCommand($errorPrinter); |
|
| 30 | ||
| 31 | return $errorPrinter->hasErrors() ? 1 : 0; |
|
| 32 | } |
|
| 33 | } |
|
| 34 | ||
| @@ 11-34 (lines=24) @@ | ||
| 8 | use Imanghafoori\LaravelMicroscope\ErrorReporters\ErrorPrinter; |
|
| 9 | use Imanghafoori\LaravelMicroscope\Traits\LogsErrors; |
|
| 10 | ||
| 11 | class CheckBladeQueries extends Command |
|
| 12 | { |
|
| 13 | use LogsErrors; |
|
| 14 | ||
| 15 | protected $signature = 'check:blade_queries {--d|detailed : Show files being checked}'; |
|
| 16 | ||
| 17 | protected $description = 'Checks db queries in blade files'; |
|
| 18 | ||
| 19 | public function handle(ErrorPrinter $errorPrinter) |
|
| 20 | { |
|
| 21 | event('microscope.start.command'); |
|
| 22 | $this->info('Checking blade files for db queries...'); |
|
| 23 | ||
| 24 | $errorPrinter->printer = $this->output; |
|
| 25 | ||
| 26 | // checks the blade files for database queries. |
|
| 27 | BladeFiles::check([CheckIsQuery::class]); |
|
| 28 | ||
| 29 | $this->finishCommand($errorPrinter); |
|
| 30 | $errorPrinter->printTime(); |
|
| 31 | ||
| 32 | return $errorPrinter->hasErrors() ? 1 : 0; |
|
| 33 | } |
|
| 34 | } |
|
| 35 | ||
| @@ 11-35 (lines=25) @@ | ||
| 8 | use Imanghafoori\LaravelMicroscope\Psr4Classes; |
|
| 9 | use Imanghafoori\LaravelMicroscope\Traits\LogsErrors; |
|
| 10 | ||
| 11 | class CheckDeadControllers extends Command |
|
| 12 | { |
|
| 13 | use LogsErrors; |
|
| 14 | ||
| 15 | protected $signature = 'check:dead_controllers'; |
|
| 16 | ||
| 17 | protected $description = 'Checks that public controller methods have routes'; |
|
| 18 | ||
| 19 | public function handle(ErrorPrinter $errorPrinter) |
|
| 20 | { |
|
| 21 | event('microscope.start.command'); |
|
| 22 | $this->info('Checking for route-less controllers...'); |
|
| 23 | ||
| 24 | $errorPrinter->printer = $this->output; |
|
| 25 | ||
| 26 | // checks calls like this: route('admin.user') |
|
| 27 | // in the psr-4 loaded classes. |
|
| 28 | Psr4Classes::check([RoutelessActions::class]); |
|
| 29 | ||
| 30 | $this->finishCommand($errorPrinter); |
|
| 31 | $errorPrinter->printTime(); |
|
| 32 | ||
| 33 | return $errorPrinter->hasErrors() ? 1 : 0; |
|
| 34 | } |
|
| 35 | } |
|
| 36 | ||
| @@ 11-33 (lines=23) @@ | ||
| 8 | use Imanghafoori\LaravelMicroscope\Psr4Classes; |
|
| 9 | use Imanghafoori\LaravelMicroscope\Traits\LogsErrors; |
|
| 10 | ||
| 11 | class CheckGenericActionComments extends Command |
|
| 12 | { |
|
| 13 | use LogsErrors; |
|
| 14 | ||
| 15 | protected $signature = 'check:docblocks'; |
|
| 16 | ||
| 17 | protected $description = 'Removes generic docblocks from controllers'; |
|
| 18 | ||
| 19 | public function handle(ErrorPrinter $errorPrinter) |
|
| 20 | { |
|
| 21 | $errorPrinter->printer = $this->output; |
|
| 22 | ||
| 23 | $this->info('removing generic docblocks...'); |
|
| 24 | ||
| 25 | ActionsUnDocblock::$command = $this; |
|
| 26 | ||
| 27 | Psr4Classes::check([ActionsUnDocblock::class]); |
|
| 28 | ||
| 29 | $this->finishCommand($errorPrinter); |
|
| 30 | ||
| 31 | return $errorPrinter->hasErrors() ? 1 : 0; |
|
| 32 | } |
|
| 33 | } |
|
| 34 | ||