{"repo_name": "essentials", "file_name": "/essentials/src/Commands/EssentialsPintCommand.php", "inference_info": {"prefix_code": "option('force') && ! $this->components->confirm('Do you wish to publish the Pint configuration file? This will override the existing [pint.json] file.', true)) {\n return 0;\n }\n $stub_path = __DIR__.'/../../stubs/pint.stub';\n $destination_path = base_path('pint.json');\n if (! File::exists($stub_path)) {\n $this->components->error('Pint configuration stub file not found.');\n return 1;\n }\n if (File::exists($destination_path) && $this->option('backup')) {\n File::copy($destination_path, $destination_path.'.backup');\n $this->components->info('Backup created at: '.$destination_path.'.backup');\n }\n $this->components->info('Publishing Pint configuration file...');\n if (! File::copy($stub_path, $destination_path)) {\n $this->components->error('Failed to publish the Pint configuration file.');\n return 1;\n }\n $this->components->info('Pint configuration file published successfully at: '.$destination_path);\n return 0;\n }", "code_description": null, "fill_type": "FUNCTION_TYPE", "language_type": "php", "sub_task_type": null}, "context_code": [["/essentials/src/Commands/EssentialsRectorCommand.php", "option('force') && ! $this->components->confirm('Do you wish to publish the Rector configuration file? This will override the existing [rector.php] file.', true)) {\n return 0;\n }\n\n $stub_path = __DIR__.'/../../stubs/rector.stub';\n $destination_path = base_path('rector.php');\n\n if (! File::exists($stub_path)) {\n $this->components->error('Rector configuration stub file not found.');\n\n return 1;\n }\n\n if (File::exists($destination_path) && $this->option('backup')) {\n File::copy($destination_path, $destination_path.'.backup');\n $this->components->info('Backup created at: '.$destination_path.'.backup');\n }\n\n $this->components->info('Publishing Rector configuration file...');\n\n if (! File::copy($stub_path, $destination_path)) {\n $this->components->error('Failed to publish the Rector configuration file.');\n\n return 1;\n }\n\n $this->components->info('Rector configuration file published successfully at: '.$destination_path);\n\n return 0;\n }\n}\n"], ["/essentials/src/Commands/MakeActionCommand.php", "alreadyExists($this->getNameInput())) {\n $this->error($this->type.' already exists!');\n\n return 1;\n }\n\n return parent::handle();\n }\n\n /**\n * Get the name input.\n */\n protected function getNameInput(): string\n {\n /** @var string $name */\n $name = $this->argument('name');\n\n return Str::of(mb_trim($name))\n ->replaceEnd('.php', '')\n ->replaceEnd('Action', '')\n ->append('Action')\n ->toString();\n }\n\n /**\n * Get the stub file for the generator.\n */\n protected function getStub(): string\n {\n return $this->resolveStubPath('/stubs/action.stub');\n }\n\n /**\n * Get the default namespace for the class.\n */\n protected function getDefaultNamespace($rootNamespace): string\n {\n return $rootNamespace.'\\Actions';\n }\n\n /**\n * Get the destination class path.\n */\n protected function getPath($name): string\n {\n $name = Str::replaceFirst($this->rootNamespace(), '', $name);\n\n // Use the app_path helper to get the correct path\n return app_path(str_replace('\\\\', '/', $name).'.php');\n }\n\n /**\n * Resolve the fully-qualified path to the stub.\n */\n private function resolveStubPath(string $stub): string\n {\n $basePath = $this->laravel->basePath(mb_trim($stub, '/'));\n\n return file_exists($basePath)\n ? $basePath\n : __DIR__.'/../../'.$stub;\n }\n}\n"], ["/essentials/src/EssentialsServiceProvider.php", ">\n */\n private array $configurables = [\n Configurables\\AggressivePrefetching::class,\n Configurables\\AutomaticallyEagerLoadRelationships::class,\n Configurables\\FakeSleep::class,\n Configurables\\ForceScheme::class,\n Configurables\\ImmutableDates::class,\n Configurables\\PreventStrayRequests::class,\n Configurables\\ProhibitDestructiveCommands::class,\n Configurables\\SetDefaultPassword::class,\n Configurables\\ShouldBeStrict::class,\n Configurables\\Unguard::class,\n ];\n\n /**\n * The list of commands.\n *\n * @var list>\n */\n private array $commandsList = [\n Commands\\EssentialsRectorCommand::class,\n Commands\\EssentialsPintCommand::class,\n Commands\\MakeActionCommand::class,\n ];\n\n /**\n * Bootstrap the application services.\n */\n public function boot(): void\n {\n collect($this->configurables)\n ->map(fn (string $configurable) => $this->app->make($configurable))\n ->filter(fn (Configurable $configurable): bool => $configurable->enabled())\n ->each(fn (Configurable $configurable) => $configurable->configure());\n\n if ($this->app->runningInConsole()) {\n $this->commands($this->commandsList);\n\n $this->publishes([\n __DIR__.'/../stubs' => $this->app->basePath('stubs'),\n ], 'essentials-stubs');\n\n $this->publishes([\n __DIR__.'/../config/essentials.php' => config_path('essentials.php'),\n ]);\n }\n }\n}\n"], ["/essentials/src/Configurables/AutomaticallyEagerLoadRelationships.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n if (! method_exists($this->modelClass, 'automaticallyEagerLoadRelationships')) {\n return;\n }\n\n Model::automaticallyEagerLoadRelationships();\n }\n}\n"], ["/essentials/src/Configurables/PreventStrayRequests.php", "boolean(sprintf('essentials.%s', self::class), true);\n $testing = app()->runningUnitTests();\n\n return $enabled && $testing;\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Http::preventStrayRequests();\n }\n}\n"], ["/essentials/src/Configurables/FakeSleep.php", "boolean(sprintf('essentials.%s', self::class), true);\n $testing = app()->runningUnitTests();\n\n return $enabled && $testing;\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Sleep::fake();\n }\n}\n"], ["/essentials/src/Configurables/ProhibitDestructiveCommands.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n DB::prohibitDestructiveCommands(\n app()->isProduction(),\n );\n }\n}\n"], ["/essentials/src/Configurables/ForceScheme.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n URL::forceHttps();\n }\n}\n"], ["/essentials/src/Configurables/AggressivePrefetching.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Vite::useAggressivePrefetching();\n }\n}\n"], ["/essentials/src/Configurables/ImmutableDates.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Date::use(CarbonImmutable::class);\n }\n}\n"], ["/essentials/src/Configurables/SetDefaultPassword.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * {@inheritDoc}\n */\n public function configure(): void\n {\n Password::defaults(fn (): ?Password => app()->isProduction() ? Password::min(12)->max(255)->uncompromised() : null);\n }\n}\n"], ["/essentials/src/Configurables/ShouldBeStrict.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Model::shouldBeStrict();\n }\n}\n"], ["/essentials/src/Configurables/Unguard.php", "boolean(sprintf('essentials.%s', self::class), false);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Model::unguard();\n }\n}\n"], ["/essentials/rector.php", "withPaths([\n __DIR__.'/src',\n __DIR__.'/tests',\n ])\n ->withSkip([\n AddOverrideAttributeToOverriddenMethodsRector::class,\n ])\n ->withPreparedSets(\n deadCode: true,\n codeQuality: true,\n typeDeclarations: true,\n privatization: true,\n earlyReturn: true,\n strictBooleans: true,\n )\n ->withPhpSets();\n"], ["/essentials/src/Contracts/Configurable.php", "option('force')) {\n if (! $this->confirm('pint.json already exists. Do you want to overwrite it?')) {\n $this->comment('Command canceled');\n\n return 0;\n }\n }\n\n if ($this->option('backup') && File::exists($configPath)) {\n File::copy($configPath, \"$configPath.backup\");\n $this->info('Successfully created backup file: '.realpath(\"$configPath.backup\"));\n }\n\n File::copy(__DIR__.'/../../../stubs/pint.stub', $configPath);\n $this->info('Successfully published pint.json to '.realpath($configPath));\n\n return 0;\n}\n[TASK_END]\n```", "inference_time": "2025-08-20 21-26-15"}, "editdistance_info": {"edit_distance": 21.1765, "calculate_time": "2025-08-20 21:26:15", "true_code_clean": "public function handle(): int\n {\n if (! $this->option('force') && ! $this->components->confirm('Do you wish to publish the Pint configuration file? This will override the existing [pint.json] file.', true)) {\n return 0;\n }\n $stub_path = __DIR__.'/../../stubs/pint.stub';\n $destination_path = base_path('pint.json');\n if (! File::exists($stub_path)) {\n $this->components->error('Pint configuration stub file not found.');\n return 1;\n }\n if (File::exists($destination_path) && $this->option('backup')) {\n File::copy($destination_path, $destination_path.'.backup');\n $this->components->info('Backup created at: '.$destination_path.'.backup');\n }\n $this->components->info('Publishing Pint configuration file...');\n if (! File::copy($stub_path, $destination_path)) {\n $this->components->error('Failed to publish the Pint configuration file.');\n return 1;\n }\n $this->components->info('Pint configuration file published successfully at: '.$destination_path);\n return 0;\n }", "predict_code_clean": "public function handle(): int\n{\n $configPath = base_path('pint.json');\n if (File::exists($configPath) && ! $this->option('force')) {\n if (! $this->confirm('pint.json already exists. Do you want to overwrite it?')) {\n $this->comment('Command canceled');\n return 0;\n }\n }\n if ($this->option('backup') && File::exists($configPath)) {\n File::copy($configPath, \"$configPath.backup\");\n $this->info('Successfully created backup file: '.realpath(\"$configPath.backup\"));\n }\n File::copy(__DIR__.'/../../../stubs/pint.stub', $configPath);\n $this->info('Successfully published pint.json to '.realpath($configPath));\n return 0;\n}"}} {"repo_name": "essentials", "file_name": "/essentials/src/Commands/EssentialsRectorCommand.php", "inference_info": {"prefix_code": "option('force') && ! $this->components->confirm('Do you wish to publish the Rector configuration file? This will override the existing [rector.php] file.', true)) {\n return 0;\n }\n $stub_path = __DIR__.'/../../stubs/rector.stub';\n $destination_path = base_path('rector.php');\n if (! File::exists($stub_path)) {\n $this->components->error('Rector configuration stub file not found.');\n return 1;\n }\n if (File::exists($destination_path) && $this->option('backup')) {\n File::copy($destination_path, $destination_path.'.backup');\n $this->components->info('Backup created at: '.$destination_path.'.backup');\n }\n $this->components->info('Publishing Rector configuration file...');\n if (! File::copy($stub_path, $destination_path)) {\n $this->components->error('Failed to publish the Rector configuration file.');\n return 1;\n }\n $this->components->info('Rector configuration file published successfully at: '.$destination_path);\n return 0;\n }", "code_description": null, "fill_type": "FUNCTION_TYPE", "language_type": "php", "sub_task_type": null}, "context_code": [["/essentials/src/Commands/EssentialsPintCommand.php", "option('force') && ! $this->components->confirm('Do you wish to publish the Pint configuration file? This will override the existing [pint.json] file.', true)) {\n return 0;\n }\n\n $stub_path = __DIR__.'/../../stubs/pint.stub';\n $destination_path = base_path('pint.json');\n\n if (! File::exists($stub_path)) {\n $this->components->error('Pint configuration stub file not found.');\n\n return 1;\n }\n\n if (File::exists($destination_path) && $this->option('backup')) {\n File::copy($destination_path, $destination_path.'.backup');\n $this->components->info('Backup created at: '.$destination_path.'.backup');\n }\n\n $this->components->info('Publishing Pint configuration file...');\n\n if (! File::copy($stub_path, $destination_path)) {\n $this->components->error('Failed to publish the Pint configuration file.');\n\n return 1;\n }\n\n $this->components->info('Pint configuration file published successfully at: '.$destination_path);\n\n return 0;\n }\n}\n"], ["/essentials/src/Commands/MakeActionCommand.php", "alreadyExists($this->getNameInput())) {\n $this->error($this->type.' already exists!');\n\n return 1;\n }\n\n return parent::handle();\n }\n\n /**\n * Get the name input.\n */\n protected function getNameInput(): string\n {\n /** @var string $name */\n $name = $this->argument('name');\n\n return Str::of(mb_trim($name))\n ->replaceEnd('.php', '')\n ->replaceEnd('Action', '')\n ->append('Action')\n ->toString();\n }\n\n /**\n * Get the stub file for the generator.\n */\n protected function getStub(): string\n {\n return $this->resolveStubPath('/stubs/action.stub');\n }\n\n /**\n * Get the default namespace for the class.\n */\n protected function getDefaultNamespace($rootNamespace): string\n {\n return $rootNamespace.'\\Actions';\n }\n\n /**\n * Get the destination class path.\n */\n protected function getPath($name): string\n {\n $name = Str::replaceFirst($this->rootNamespace(), '', $name);\n\n // Use the app_path helper to get the correct path\n return app_path(str_replace('\\\\', '/', $name).'.php');\n }\n\n /**\n * Resolve the fully-qualified path to the stub.\n */\n private function resolveStubPath(string $stub): string\n {\n $basePath = $this->laravel->basePath(mb_trim($stub, '/'));\n\n return file_exists($basePath)\n ? $basePath\n : __DIR__.'/../../'.$stub;\n }\n}\n"], ["/essentials/src/EssentialsServiceProvider.php", ">\n */\n private array $configurables = [\n Configurables\\AggressivePrefetching::class,\n Configurables\\AutomaticallyEagerLoadRelationships::class,\n Configurables\\FakeSleep::class,\n Configurables\\ForceScheme::class,\n Configurables\\ImmutableDates::class,\n Configurables\\PreventStrayRequests::class,\n Configurables\\ProhibitDestructiveCommands::class,\n Configurables\\SetDefaultPassword::class,\n Configurables\\ShouldBeStrict::class,\n Configurables\\Unguard::class,\n ];\n\n /**\n * The list of commands.\n *\n * @var list>\n */\n private array $commandsList = [\n Commands\\EssentialsRectorCommand::class,\n Commands\\EssentialsPintCommand::class,\n Commands\\MakeActionCommand::class,\n ];\n\n /**\n * Bootstrap the application services.\n */\n public function boot(): void\n {\n collect($this->configurables)\n ->map(fn (string $configurable) => $this->app->make($configurable))\n ->filter(fn (Configurable $configurable): bool => $configurable->enabled())\n ->each(fn (Configurable $configurable) => $configurable->configure());\n\n if ($this->app->runningInConsole()) {\n $this->commands($this->commandsList);\n\n $this->publishes([\n __DIR__.'/../stubs' => $this->app->basePath('stubs'),\n ], 'essentials-stubs');\n\n $this->publishes([\n __DIR__.'/../config/essentials.php' => config_path('essentials.php'),\n ]);\n }\n }\n}\n"], ["/essentials/src/Configurables/AutomaticallyEagerLoadRelationships.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n if (! method_exists($this->modelClass, 'automaticallyEagerLoadRelationships')) {\n return;\n }\n\n Model::automaticallyEagerLoadRelationships();\n }\n}\n"], ["/essentials/rector.php", "withPaths([\n __DIR__.'/src',\n __DIR__.'/tests',\n ])\n ->withSkip([\n AddOverrideAttributeToOverriddenMethodsRector::class,\n ])\n ->withPreparedSets(\n deadCode: true,\n codeQuality: true,\n typeDeclarations: true,\n privatization: true,\n earlyReturn: true,\n strictBooleans: true,\n )\n ->withPhpSets();\n"], ["/essentials/src/Configurables/PreventStrayRequests.php", "boolean(sprintf('essentials.%s', self::class), true);\n $testing = app()->runningUnitTests();\n\n return $enabled && $testing;\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Http::preventStrayRequests();\n }\n}\n"], ["/essentials/src/Configurables/FakeSleep.php", "boolean(sprintf('essentials.%s', self::class), true);\n $testing = app()->runningUnitTests();\n\n return $enabled && $testing;\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Sleep::fake();\n }\n}\n"], ["/essentials/src/Configurables/ProhibitDestructiveCommands.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n DB::prohibitDestructiveCommands(\n app()->isProduction(),\n );\n }\n}\n"], ["/essentials/src/Configurables/ForceScheme.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n URL::forceHttps();\n }\n}\n"], ["/essentials/src/Configurables/AggressivePrefetching.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Vite::useAggressivePrefetching();\n }\n}\n"], ["/essentials/src/Configurables/ImmutableDates.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Date::use(CarbonImmutable::class);\n }\n}\n"], ["/essentials/src/Configurables/SetDefaultPassword.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * {@inheritDoc}\n */\n public function configure(): void\n {\n Password::defaults(fn (): ?Password => app()->isProduction() ? Password::min(12)->max(255)->uncompromised() : null);\n }\n}\n"], ["/essentials/src/Configurables/ShouldBeStrict.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Model::shouldBeStrict();\n }\n}\n"], ["/essentials/src/Configurables/Unguard.php", "boolean(sprintf('essentials.%s', self::class), false);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Model::unguard();\n }\n}\n"], ["/essentials/src/Contracts/Configurable.php", "option('force')) {\n if (! $this->confirm('The rector.php file already exists. Do you want to overwrite it?')) {\n $this->info('Operation cancelled.');\n return self::FAILURE;\n }\n }\n\n // Create backup if requested and file exists\n if ($this->option('backup') && File::exists($rectorConfigPath)) {\n File::copy($rectorConfigPath, $rectorConfigPath.'.backup');\n $this->info('Created backup at '.$rectorConfigPath.'.backup');\n }\n\n // Copy stub configuration file\n File::copy(\n __DIR__.'/../../../stubs/rector.php.stub',\n $rectorConfigPath\n );\n\n $this->info('Rector configuration file published successfully.');\n\n return self::SUCCESS;\n}\n[TASK_END]\n```", "inference_time": "2025-08-20 21-26-21"}, "editdistance_info": {"edit_distance": 20.3125, "calculate_time": "2025-08-20 21:26:21", "true_code_clean": "public function handle(): int\n {\n if (! $this->option('force') && ! $this->components->confirm('Do you wish to publish the Rector configuration file? This will override the existing [rector.php] file.', true)) {\n return 0;\n }\n $stub_path = __DIR__.'/../../stubs/rector.stub';\n $destination_path = base_path('rector.php');\n if (! File::exists($stub_path)) {\n $this->components->error('Rector configuration stub file not found.');\n return 1;\n }\n if (File::exists($destination_path) && $this->option('backup')) {\n File::copy($destination_path, $destination_path.'.backup');\n $this->components->info('Backup created at: '.$destination_path.'.backup');\n }\n $this->components->info('Publishing Rector configuration file...');\n if (! File::copy($stub_path, $destination_path)) {\n $this->components->error('Failed to publish the Rector configuration file.');\n return 1;\n }\n $this->components->info('Rector configuration file published successfully at: '.$destination_path);\n return 0;\n }", "predict_code_clean": "public function handle(): int\n{\n $rectorConfigPath = base_path('rector.php');\n if (File::exists($rectorConfigPath) && ! $this->option('force')) {\n if (! $this->confirm('The rector.php file already exists. Do you want to overwrite it?')) {\n $this->info('Operation cancelled.');\n return self::FAILURE;\n }\n }\n if ($this->option('backup') && File::exists($rectorConfigPath)) {\n File::copy($rectorConfigPath, $rectorConfigPath.'.backup');\n $this->info('Created backup at '.$rectorConfigPath.'.backup');\n }\n File::copy(\n __DIR__.'/../../../stubs/rector.php.stub',\n $rectorConfigPath\n );\n $this->info('Rector configuration file published successfully.');\n return self::SUCCESS;\n}"}} {"repo_name": "essentials", "file_name": "/essentials/src/Commands/EssentialsRectorCommand.php", "inference_info": {"prefix_code": "option('force') && ! $this->components->confirm('Do you wish to publish the Rector configuration file? This will override the existing [rector.php] file.', true)) {\n return 0;\n }\n $stub_path = __DIR__.'/../../stubs/rector.stub';\n $destination_path = base_path('rector.php');\n if (! File::exists($stub_path)) {\n $this->components->error('Rector configuration stub file not found.');\n return 1;\n }\n if (File::exists($destination_path) && $this->option('backup')) {\n File::copy($destination_path, $destination_path.'.backup');\n $this->components->info('Backup created at: '.$destination_path.'.backup');\n }\n $this->components->info('Publishing Rector configuration file...');\n if (! File::copy($stub_path, $destination_path)) {\n $this->components->error('Failed to publish the Rector configuration file.');\n return 1;\n }\n $this->components->info('Rector configuration file published successfully at: '.$destination_path);\n return 0;\n }", "code_description": null, "fill_type": "FUNCTION_TYPE", "language_type": "php", "sub_task_type": null}, "context_code": [["/essentials/src/Commands/EssentialsPintCommand.php", "option('force') && ! $this->components->confirm('Do you wish to publish the Pint configuration file? This will override the existing [pint.json] file.', true)) {\n return 0;\n }\n\n $stub_path = __DIR__.'/../../stubs/pint.stub';\n $destination_path = base_path('pint.json');\n\n if (! File::exists($stub_path)) {\n $this->components->error('Pint configuration stub file not found.');\n\n return 1;\n }\n\n if (File::exists($destination_path) && $this->option('backup')) {\n File::copy($destination_path, $destination_path.'.backup');\n $this->components->info('Backup created at: '.$destination_path.'.backup');\n }\n\n $this->components->info('Publishing Pint configuration file...');\n\n if (! File::copy($stub_path, $destination_path)) {\n $this->components->error('Failed to publish the Pint configuration file.');\n\n return 1;\n }\n\n $this->components->info('Pint configuration file published successfully at: '.$destination_path);\n\n return 0;\n }\n}\n"], ["/essentials/src/Commands/MakeActionCommand.php", "alreadyExists($this->getNameInput())) {\n $this->error($this->type.' already exists!');\n\n return 1;\n }\n\n return parent::handle();\n }\n\n /**\n * Get the name input.\n */\n protected function getNameInput(): string\n {\n /** @var string $name */\n $name = $this->argument('name');\n\n return Str::of(mb_trim($name))\n ->replaceEnd('.php', '')\n ->replaceEnd('Action', '')\n ->append('Action')\n ->toString();\n }\n\n /**\n * Get the stub file for the generator.\n */\n protected function getStub(): string\n {\n return $this->resolveStubPath('/stubs/action.stub');\n }\n\n /**\n * Get the default namespace for the class.\n */\n protected function getDefaultNamespace($rootNamespace): string\n {\n return $rootNamespace.'\\Actions';\n }\n\n /**\n * Get the destination class path.\n */\n protected function getPath($name): string\n {\n $name = Str::replaceFirst($this->rootNamespace(), '', $name);\n\n // Use the app_path helper to get the correct path\n return app_path(str_replace('\\\\', '/', $name).'.php');\n }\n\n /**\n * Resolve the fully-qualified path to the stub.\n */\n private function resolveStubPath(string $stub): string\n {\n $basePath = $this->laravel->basePath(mb_trim($stub, '/'));\n\n return file_exists($basePath)\n ? $basePath\n : __DIR__.'/../../'.$stub;\n }\n}\n"], ["/essentials/src/EssentialsServiceProvider.php", ">\n */\n private array $configurables = [\n Configurables\\AggressivePrefetching::class,\n Configurables\\AutomaticallyEagerLoadRelationships::class,\n Configurables\\FakeSleep::class,\n Configurables\\ForceScheme::class,\n Configurables\\ImmutableDates::class,\n Configurables\\PreventStrayRequests::class,\n Configurables\\ProhibitDestructiveCommands::class,\n Configurables\\SetDefaultPassword::class,\n Configurables\\ShouldBeStrict::class,\n Configurables\\Unguard::class,\n ];\n\n /**\n * The list of commands.\n *\n * @var list>\n */\n private array $commandsList = [\n Commands\\EssentialsRectorCommand::class,\n Commands\\EssentialsPintCommand::class,\n Commands\\MakeActionCommand::class,\n ];\n\n /**\n * Bootstrap the application services.\n */\n public function boot(): void\n {\n collect($this->configurables)\n ->map(fn (string $configurable) => $this->app->make($configurable))\n ->filter(fn (Configurable $configurable): bool => $configurable->enabled())\n ->each(fn (Configurable $configurable) => $configurable->configure());\n\n if ($this->app->runningInConsole()) {\n $this->commands($this->commandsList);\n\n $this->publishes([\n __DIR__.'/../stubs' => $this->app->basePath('stubs'),\n ], 'essentials-stubs');\n\n $this->publishes([\n __DIR__.'/../config/essentials.php' => config_path('essentials.php'),\n ]);\n }\n }\n}\n"], ["/essentials/src/Configurables/AutomaticallyEagerLoadRelationships.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n if (! method_exists($this->modelClass, 'automaticallyEagerLoadRelationships')) {\n return;\n }\n\n Model::automaticallyEagerLoadRelationships();\n }\n}\n"], ["/essentials/rector.php", "withPaths([\n __DIR__.'/src',\n __DIR__.'/tests',\n ])\n ->withSkip([\n AddOverrideAttributeToOverriddenMethodsRector::class,\n ])\n ->withPreparedSets(\n deadCode: true,\n codeQuality: true,\n typeDeclarations: true,\n privatization: true,\n earlyReturn: true,\n strictBooleans: true,\n )\n ->withPhpSets();\n"], ["/essentials/src/Configurables/PreventStrayRequests.php", "boolean(sprintf('essentials.%s', self::class), true);\n $testing = app()->runningUnitTests();\n\n return $enabled && $testing;\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Http::preventStrayRequests();\n }\n}\n"], ["/essentials/src/Configurables/FakeSleep.php", "boolean(sprintf('essentials.%s', self::class), true);\n $testing = app()->runningUnitTests();\n\n return $enabled && $testing;\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Sleep::fake();\n }\n}\n"], ["/essentials/src/Configurables/ProhibitDestructiveCommands.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n DB::prohibitDestructiveCommands(\n app()->isProduction(),\n );\n }\n}\n"], ["/essentials/src/Configurables/ForceScheme.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n URL::forceHttps();\n }\n}\n"], ["/essentials/src/Configurables/AggressivePrefetching.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Vite::useAggressivePrefetching();\n }\n}\n"], ["/essentials/src/Configurables/ImmutableDates.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Date::use(CarbonImmutable::class);\n }\n}\n"], ["/essentials/src/Configurables/SetDefaultPassword.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * {@inheritDoc}\n */\n public function configure(): void\n {\n Password::defaults(fn (): ?Password => app()->isProduction() ? Password::min(12)->max(255)->uncompromised() : null);\n }\n}\n"], ["/essentials/src/Configurables/ShouldBeStrict.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Model::shouldBeStrict();\n }\n}\n"], ["/essentials/src/Configurables/Unguard.php", "boolean(sprintf('essentials.%s', self::class), false);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Model::unguard();\n }\n}\n"], ["/essentials/src/Contracts/Configurable.php", "option('force')) {\n if (! $this->confirm('The rector.php file already exists. Do you want to overwrite it?')) {\n $this->error('Operation cancelled.');\n return 1;\n }\n }\n\n if ($this->option('backup') && File::exists($rectorConfigPath)) {\n File::copy($rectorConfigPath, $rectorConfigPath.'.backup');\n $this->info('Created backup at '.$rectorConfigPath.'.backup');\n }\n\n File::copy(__DIR__.'/../../stubs/rector.php', $rectorConfigPath);\n\n $this->info('Rector configuration file published successfully.');\n\n return 0;\n}\n[TASK_END]\n```", "inference_time": "2025-08-20 21-26-23"}, "editdistance_info": {"edit_distance": 23.0469, "calculate_time": "2025-08-20 21:26:23", "true_code_clean": "public function handle(): int\n {\n if (! $this->option('force') && ! $this->components->confirm('Do you wish to publish the Rector configuration file? This will override the existing [rector.php] file.', true)) {\n return 0;\n }\n $stub_path = __DIR__.'/../../stubs/rector.stub';\n $destination_path = base_path('rector.php');\n if (! File::exists($stub_path)) {\n $this->components->error('Rector configuration stub file not found.');\n return 1;\n }\n if (File::exists($destination_path) && $this->option('backup')) {\n File::copy($destination_path, $destination_path.'.backup');\n $this->components->info('Backup created at: '.$destination_path.'.backup');\n }\n $this->components->info('Publishing Rector configuration file...');\n if (! File::copy($stub_path, $destination_path)) {\n $this->components->error('Failed to publish the Rector configuration file.');\n return 1;\n }\n $this->components->info('Rector configuration file published successfully at: '.$destination_path);\n return 0;\n }", "predict_code_clean": "public function handle(): int\n{\n $rectorConfigPath = base_path('rector.php');\n if (File::exists($rectorConfigPath) && ! $this->option('force')) {\n if (! $this->confirm('The rector.php file already exists. Do you want to overwrite it?')) {\n $this->error('Operation cancelled.');\n return 1;\n }\n }\n if ($this->option('backup') && File::exists($rectorConfigPath)) {\n File::copy($rectorConfigPath, $rectorConfigPath.'.backup');\n $this->info('Created backup at '.$rectorConfigPath.'.backup');\n }\n File::copy(__DIR__.'/../../stubs/rector.php', $rectorConfigPath);\n $this->info('Rector configuration file published successfully.');\n return 0;\n}"}} {"repo_name": "essentials", "file_name": "/essentials/src/Commands/EssentialsPintCommand.php", "inference_info": {"prefix_code": "option('force') && ! $this->components->confirm('Do you wish to publish the Pint configuration file? This will override the existing [pint.json] file.', true)) {\n return 0;\n }\n $stub_path = __DIR__.'/../../stubs/pint.stub';\n $destination_path = base_path('pint.json');\n if (! File::exists($stub_path)) {\n $this->components->error('Pint configuration stub file not found.');\n return 1;\n }\n if (File::exists($destination_path) && $this->option('backup')) {\n File::copy($destination_path, $destination_path.'.backup');\n $this->components->info('Backup created at: '.$destination_path.'.backup');\n }\n $this->components->info('Publishing Pint configuration file...');\n if (! File::copy($stub_path, $destination_path)) {\n $this->components->error('Failed to publish the Pint configuration file.');\n return 1;\n }\n $this->components->info('Pint configuration file published successfully at: '.$destination_path);\n return 0;\n }", "code_description": null, "fill_type": "FUNCTION_TYPE", "language_type": "php", "sub_task_type": null}, "context_code": [["/essentials/src/Commands/EssentialsRectorCommand.php", "option('force') && ! $this->components->confirm('Do you wish to publish the Rector configuration file? This will override the existing [rector.php] file.', true)) {\n return 0;\n }\n\n $stub_path = __DIR__.'/../../stubs/rector.stub';\n $destination_path = base_path('rector.php');\n\n if (! File::exists($stub_path)) {\n $this->components->error('Rector configuration stub file not found.');\n\n return 1;\n }\n\n if (File::exists($destination_path) && $this->option('backup')) {\n File::copy($destination_path, $destination_path.'.backup');\n $this->components->info('Backup created at: '.$destination_path.'.backup');\n }\n\n $this->components->info('Publishing Rector configuration file...');\n\n if (! File::copy($stub_path, $destination_path)) {\n $this->components->error('Failed to publish the Rector configuration file.');\n\n return 1;\n }\n\n $this->components->info('Rector configuration file published successfully at: '.$destination_path);\n\n return 0;\n }\n}\n"], ["/essentials/src/Commands/MakeActionCommand.php", "alreadyExists($this->getNameInput())) {\n $this->error($this->type.' already exists!');\n\n return 1;\n }\n\n return parent::handle();\n }\n\n /**\n * Get the name input.\n */\n protected function getNameInput(): string\n {\n /** @var string $name */\n $name = $this->argument('name');\n\n return Str::of(mb_trim($name))\n ->replaceEnd('.php', '')\n ->replaceEnd('Action', '')\n ->append('Action')\n ->toString();\n }\n\n /**\n * Get the stub file for the generator.\n */\n protected function getStub(): string\n {\n return $this->resolveStubPath('/stubs/action.stub');\n }\n\n /**\n * Get the default namespace for the class.\n */\n protected function getDefaultNamespace($rootNamespace): string\n {\n return $rootNamespace.'\\Actions';\n }\n\n /**\n * Get the destination class path.\n */\n protected function getPath($name): string\n {\n $name = Str::replaceFirst($this->rootNamespace(), '', $name);\n\n // Use the app_path helper to get the correct path\n return app_path(str_replace('\\\\', '/', $name).'.php');\n }\n\n /**\n * Resolve the fully-qualified path to the stub.\n */\n private function resolveStubPath(string $stub): string\n {\n $basePath = $this->laravel->basePath(mb_trim($stub, '/'));\n\n return file_exists($basePath)\n ? $basePath\n : __DIR__.'/../../'.$stub;\n }\n}\n"], ["/essentials/src/EssentialsServiceProvider.php", ">\n */\n private array $configurables = [\n Configurables\\AggressivePrefetching::class,\n Configurables\\AutomaticallyEagerLoadRelationships::class,\n Configurables\\FakeSleep::class,\n Configurables\\ForceScheme::class,\n Configurables\\ImmutableDates::class,\n Configurables\\PreventStrayRequests::class,\n Configurables\\ProhibitDestructiveCommands::class,\n Configurables\\SetDefaultPassword::class,\n Configurables\\ShouldBeStrict::class,\n Configurables\\Unguard::class,\n ];\n\n /**\n * The list of commands.\n *\n * @var list>\n */\n private array $commandsList = [\n Commands\\EssentialsRectorCommand::class,\n Commands\\EssentialsPintCommand::class,\n Commands\\MakeActionCommand::class,\n ];\n\n /**\n * Bootstrap the application services.\n */\n public function boot(): void\n {\n collect($this->configurables)\n ->map(fn (string $configurable) => $this->app->make($configurable))\n ->filter(fn (Configurable $configurable): bool => $configurable->enabled())\n ->each(fn (Configurable $configurable) => $configurable->configure());\n\n if ($this->app->runningInConsole()) {\n $this->commands($this->commandsList);\n\n $this->publishes([\n __DIR__.'/../stubs' => $this->app->basePath('stubs'),\n ], 'essentials-stubs');\n\n $this->publishes([\n __DIR__.'/../config/essentials.php' => config_path('essentials.php'),\n ]);\n }\n }\n}\n"], ["/essentials/src/Configurables/AutomaticallyEagerLoadRelationships.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n if (! method_exists($this->modelClass, 'automaticallyEagerLoadRelationships')) {\n return;\n }\n\n Model::automaticallyEagerLoadRelationships();\n }\n}\n"], ["/essentials/src/Configurables/PreventStrayRequests.php", "boolean(sprintf('essentials.%s', self::class), true);\n $testing = app()->runningUnitTests();\n\n return $enabled && $testing;\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Http::preventStrayRequests();\n }\n}\n"], ["/essentials/src/Configurables/FakeSleep.php", "boolean(sprintf('essentials.%s', self::class), true);\n $testing = app()->runningUnitTests();\n\n return $enabled && $testing;\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Sleep::fake();\n }\n}\n"], ["/essentials/src/Configurables/ProhibitDestructiveCommands.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n DB::prohibitDestructiveCommands(\n app()->isProduction(),\n );\n }\n}\n"], ["/essentials/src/Configurables/ForceScheme.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n URL::forceHttps();\n }\n}\n"], ["/essentials/src/Configurables/AggressivePrefetching.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Vite::useAggressivePrefetching();\n }\n}\n"], ["/essentials/src/Configurables/ImmutableDates.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Date::use(CarbonImmutable::class);\n }\n}\n"], ["/essentials/src/Configurables/SetDefaultPassword.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * {@inheritDoc}\n */\n public function configure(): void\n {\n Password::defaults(fn (): ?Password => app()->isProduction() ? Password::min(12)->max(255)->uncompromised() : null);\n }\n}\n"], ["/essentials/src/Configurables/ShouldBeStrict.php", "boolean(sprintf('essentials.%s', self::class), true);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Model::shouldBeStrict();\n }\n}\n"], ["/essentials/src/Configurables/Unguard.php", "boolean(sprintf('essentials.%s', self::class), false);\n }\n\n /**\n * Run the configurable.\n */\n public function configure(): void\n {\n Model::unguard();\n }\n}\n"], ["/essentials/rector.php", "withPaths([\n __DIR__.'/src',\n __DIR__.'/tests',\n ])\n ->withSkip([\n AddOverrideAttributeToOverriddenMethodsRector::class,\n ])\n ->withPreparedSets(\n deadCode: true,\n codeQuality: true,\n typeDeclarations: true,\n privatization: true,\n earlyReturn: true,\n strictBooleans: true,\n )\n ->withPhpSets();\n"], ["/essentials/src/Contracts/Configurable.php", "option('force') && !$this->confirm('The pint.json file already exists. Do you want to overwrite it?', false)) {\n $this->error('Operation cancelled.');\n return 1;\n }\n\n if ($this->option('backup')) {\n $backupPath = $destination.'.bak';\n File::move($destination, $backupPath);\n $this->info(\"Existing pint.json was backed up to {$backupPath}\");\n }\n }\n\n File::copy($source, $destination);\n\n $this->info('Pint configuration file published successfully.');\n\n return 0;\n}\n[TASK_END]\n```", "inference_time": "2025-08-20 21-26-31"}, "editdistance_info": {"edit_distance": 25.8824, "calculate_time": "2025-08-20 21:26:31", "true_code_clean": "public function handle(): int\n {\n if (! $this->option('force') && ! $this->components->confirm('Do you wish to publish the Pint configuration file? This will override the existing [pint.json] file.', true)) {\n return 0;\n }\n $stub_path = __DIR__.'/../../stubs/pint.stub';\n $destination_path = base_path('pint.json');\n if (! File::exists($stub_path)) {\n $this->components->error('Pint configuration stub file not found.');\n return 1;\n }\n if (File::exists($destination_path) && $this->option('backup')) {\n File::copy($destination_path, $destination_path.'.backup');\n $this->components->info('Backup created at: '.$destination_path.'.backup');\n }\n $this->components->info('Publishing Pint configuration file...');\n if (! File::copy($stub_path, $destination_path)) {\n $this->components->error('Failed to publish the Pint configuration file.');\n return 1;\n }\n $this->components->info('Pint configuration file published successfully at: '.$destination_path);\n return 0;\n }", "predict_code_clean": "public function handle(): int\n{\n $source = __DIR__.'/../../stubs/pint.json';\n $destination = base_path('pint.json');\n if (File::exists($destination)) {\n if (!$this->option('force') && !$this->confirm('The pint.json file already exists. Do you want to overwrite it?', false)) {\n $this->error('Operation cancelled.');\n return 1;\n }\n if ($this->option('backup')) {\n $backupPath = $destination.'.bak';\n File::move($destination, $backupPath);\n $this->info(\"Existing pint.json was backed up to {$backupPath}\");\n }\n }\n File::copy($source, $destination);\n $this->info('Pint configuration file published successfully.');\n return 0;\n}"}}