m2geval / php /essentials_function_bench.jsonl
Tswatery's picture
Add files using upload-large-folder tool
208f95c verified
{"repo_name": "essentials", "file_name": "/essentials/src/Commands/EssentialsPintCommand.php", "inference_info": {"prefix_code": "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Commands;\n\nuse Illuminate\\Console\\Command;\nuse Illuminate\\Support\\Facades\\File;\n\nfinal class EssentialsPintCommand extends Command\n{\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected $signature = 'essentials:pint\n {--force : Force the operation to run without confirmation}\n {--backup : Create a backup of existing pint.json}';\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected $description = 'This command will publish an opinionated Pint configuration file for your project.';\n\n /**\n * Execute the console command.\n */\n ", "suffix_code": "\n}\n", "middle_code": "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 }", "code_description": null, "fill_type": "FUNCTION_TYPE", "language_type": "php", "sub_task_type": null}, "context_code": [["/essentials/src/Commands/EssentialsRectorCommand.php", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Commands;\n\nuse Illuminate\\Console\\Command;\nuse Illuminate\\Support\\Facades\\File;\n\nfinal class EssentialsRectorCommand extends Command\n{\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected $signature = 'essentials:rector\n {--force : Force the operation to run without confirmation}\n {--backup : Create a backup of existing rector.php}';\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected $description = 'This command will publish an opinionated Rector configuration file for your project.';\n\n /**\n * Execute the console command.\n */\n 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\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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Commands;\n\nuse Illuminate\\Console\\GeneratorCommand;\nuse Illuminate\\Support\\Str;\n\nfinal class MakeActionCommand extends GeneratorCommand\n{\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected $name = 'make:action';\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected $description = 'Create a new action class';\n\n /**\n * The type of class being generated.\n *\n * @var string\n */\n protected $type = 'Action';\n\n /**\n * Execute the console command.\n *\n * @return bool|int|null\n */\n public function handle()\n {\n // First check if the class already exists\n if ($this->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials;\n\nuse Illuminate\\Console\\Command;\nuse Illuminate\\Support\\ServiceProvider as BaseServiceProvider;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\n/**\n * @internal\n */\nfinal class EssentialsServiceProvider extends BaseServiceProvider\n{\n /**\n * The list of configurables.\n *\n * @var list<class-string<Configurable>>\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<class-string<Command>>\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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Database\\Eloquent\\Model;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class AutomaticallyEagerLoadRelationships implements Configurable\n{\n public function __construct(\n private string $modelClass = Model::class\n ) {}\n\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Support\\Facades\\Http;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class PreventStrayRequests implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n $enabled = config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Support\\Sleep;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class FakeSleep implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n $enabled = config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Support\\Facades\\DB;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class ProhibitDestructiveCommands implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Support\\Facades\\URL;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class ForceScheme implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Support\\Facades\\Vite;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class AggressivePrefetching implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Carbon\\CarbonImmutable;\nuse Illuminate\\Support\\Facades\\Date;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class ImmutableDates implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Validation\\Rules\\Password;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal class SetDefaultPassword implements Configurable\n{\n /**\n * {@inheritDoc}\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Database\\Eloquent\\Model;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class ShouldBeStrict implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Database\\Eloquent\\Model;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class Unguard implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nuse Rector\\Config\\RectorConfig;\nuse Rector\\Php83\\Rector\\ClassMethod\\AddOverrideAttributeToOverriddenMethodsRector;\n\nreturn RectorConfig::configure()\n ->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Contracts;\n\n/**\n * @internal\n */\ninterface Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool;\n\n /**\n * Run the configurable.\n */\n public function configure(): void;\n}\n"]], "task_instance_info": {"created_time": "2025-08-20 21:26:00", "created_task_model": "DeepSeek-R1", "function_skeleton": "public function handle () : int {}", "code_description": "This code segment functions to: Handle user confirmation for file operations, verify required stub file availability, create backups of existing configuration files when specified, transfer configuration data from a stub to a target destination, and provide operational status feedback through console output."}, "inference_content": {"inference_model": "DeepSeek-R1", "inference_result": "```php\n[TASK_BEGIN]\npublic function handle(): int\n{\n $configPath = base_path('pint.json');\n\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\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": "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Commands;\n\nuse Illuminate\\Console\\Command;\nuse Illuminate\\Support\\Facades\\File;\n\nfinal class EssentialsRectorCommand extends Command\n{\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected $signature = 'essentials:rector\n {--force : Force the operation to run without confirmation}\n {--backup : Create a backup of existing rector.php}';\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected $description = 'This command will publish an opinionated Rector configuration file for your project.';\n\n /**\n * Execute the console command.\n */\n ", "suffix_code": "\n}\n", "middle_code": "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 }", "code_description": null, "fill_type": "FUNCTION_TYPE", "language_type": "php", "sub_task_type": null}, "context_code": [["/essentials/src/Commands/EssentialsPintCommand.php", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Commands;\n\nuse Illuminate\\Console\\Command;\nuse Illuminate\\Support\\Facades\\File;\n\nfinal class EssentialsPintCommand extends Command\n{\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected $signature = 'essentials:pint\n {--force : Force the operation to run without confirmation}\n {--backup : Create a backup of existing pint.json}';\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected $description = 'This command will publish an opinionated Pint configuration file for your project.';\n\n /**\n * Execute the console command.\n */\n 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\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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Commands;\n\nuse Illuminate\\Console\\GeneratorCommand;\nuse Illuminate\\Support\\Str;\n\nfinal class MakeActionCommand extends GeneratorCommand\n{\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected $name = 'make:action';\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected $description = 'Create a new action class';\n\n /**\n * The type of class being generated.\n *\n * @var string\n */\n protected $type = 'Action';\n\n /**\n * Execute the console command.\n *\n * @return bool|int|null\n */\n public function handle()\n {\n // First check if the class already exists\n if ($this->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials;\n\nuse Illuminate\\Console\\Command;\nuse Illuminate\\Support\\ServiceProvider as BaseServiceProvider;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\n/**\n * @internal\n */\nfinal class EssentialsServiceProvider extends BaseServiceProvider\n{\n /**\n * The list of configurables.\n *\n * @var list<class-string<Configurable>>\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<class-string<Command>>\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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Database\\Eloquent\\Model;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class AutomaticallyEagerLoadRelationships implements Configurable\n{\n public function __construct(\n private string $modelClass = Model::class\n ) {}\n\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nuse Rector\\Config\\RectorConfig;\nuse Rector\\Php83\\Rector\\ClassMethod\\AddOverrideAttributeToOverriddenMethodsRector;\n\nreturn RectorConfig::configure()\n ->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Support\\Facades\\Http;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class PreventStrayRequests implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n $enabled = config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Support\\Sleep;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class FakeSleep implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n $enabled = config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Support\\Facades\\DB;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class ProhibitDestructiveCommands implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Support\\Facades\\URL;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class ForceScheme implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Support\\Facades\\Vite;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class AggressivePrefetching implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Carbon\\CarbonImmutable;\nuse Illuminate\\Support\\Facades\\Date;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class ImmutableDates implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Validation\\Rules\\Password;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal class SetDefaultPassword implements Configurable\n{\n /**\n * {@inheritDoc}\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Database\\Eloquent\\Model;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class ShouldBeStrict implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Database\\Eloquent\\Model;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class Unguard implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Contracts;\n\n/**\n * @internal\n */\ninterface Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool;\n\n /**\n * Run the configurable.\n */\n public function configure(): void;\n}\n"]], "task_instance_info": {"created_time": "2025-08-20 21:26:00", "created_task_model": "DeepSeek-R1", "function_skeleton": "public function handle () : int {}", "code_description": "This code segment functions to: Handle user confirmation for file operations, verify required resource availability, conditionally preserve existing configurations through backup creation, and execute controlled resource duplication with success/failure status reporting."}, "inference_content": {"inference_model": "DeepSeek-R1", "inference_result": "```php\n[TASK_BEGIN]\npublic function handle(): int\n{\n $rectorConfigPath = base_path('rector.php');\n\n // Check if config exists and needs confirmation\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\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": "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Commands;\n\nuse Illuminate\\Console\\Command;\nuse Illuminate\\Support\\Facades\\File;\n\nfinal class EssentialsRectorCommand extends Command\n{\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected $signature = 'essentials:rector\n {--force : Force the operation to run without confirmation}\n {--backup : Create a backup of existing rector.php}';\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected $description = 'This command will publish an opinionated Rector configuration file for your project.';\n\n /**\n * Execute the console command.\n */\n ", "suffix_code": "\n}\n", "middle_code": "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 }", "code_description": null, "fill_type": "FUNCTION_TYPE", "language_type": "php", "sub_task_type": null}, "context_code": [["/essentials/src/Commands/EssentialsPintCommand.php", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Commands;\n\nuse Illuminate\\Console\\Command;\nuse Illuminate\\Support\\Facades\\File;\n\nfinal class EssentialsPintCommand extends Command\n{\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected $signature = 'essentials:pint\n {--force : Force the operation to run without confirmation}\n {--backup : Create a backup of existing pint.json}';\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected $description = 'This command will publish an opinionated Pint configuration file for your project.';\n\n /**\n * Execute the console command.\n */\n 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\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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Commands;\n\nuse Illuminate\\Console\\GeneratorCommand;\nuse Illuminate\\Support\\Str;\n\nfinal class MakeActionCommand extends GeneratorCommand\n{\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected $name = 'make:action';\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected $description = 'Create a new action class';\n\n /**\n * The type of class being generated.\n *\n * @var string\n */\n protected $type = 'Action';\n\n /**\n * Execute the console command.\n *\n * @return bool|int|null\n */\n public function handle()\n {\n // First check if the class already exists\n if ($this->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials;\n\nuse Illuminate\\Console\\Command;\nuse Illuminate\\Support\\ServiceProvider as BaseServiceProvider;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\n/**\n * @internal\n */\nfinal class EssentialsServiceProvider extends BaseServiceProvider\n{\n /**\n * The list of configurables.\n *\n * @var list<class-string<Configurable>>\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<class-string<Command>>\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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Database\\Eloquent\\Model;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class AutomaticallyEagerLoadRelationships implements Configurable\n{\n public function __construct(\n private string $modelClass = Model::class\n ) {}\n\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nuse Rector\\Config\\RectorConfig;\nuse Rector\\Php83\\Rector\\ClassMethod\\AddOverrideAttributeToOverriddenMethodsRector;\n\nreturn RectorConfig::configure()\n ->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Support\\Facades\\Http;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class PreventStrayRequests implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n $enabled = config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Support\\Sleep;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class FakeSleep implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n $enabled = config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Support\\Facades\\DB;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class ProhibitDestructiveCommands implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Support\\Facades\\URL;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class ForceScheme implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Support\\Facades\\Vite;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class AggressivePrefetching implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Carbon\\CarbonImmutable;\nuse Illuminate\\Support\\Facades\\Date;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class ImmutableDates implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Validation\\Rules\\Password;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal class SetDefaultPassword implements Configurable\n{\n /**\n * {@inheritDoc}\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Database\\Eloquent\\Model;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class ShouldBeStrict implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Database\\Eloquent\\Model;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class Unguard implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Contracts;\n\n/**\n * @internal\n */\ninterface Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool;\n\n /**\n * Run the configurable.\n */\n public function configure(): void;\n}\n"]], "task_instance_info": {"created_time": "2025-08-20 21:26:00", "created_task_model": "DeepSeek-R1", "function_skeleton": "public function handle () : int {}", "code_description": "This code segment functions to: Handle user confirmation for file operations, verify source file availability, create backup copies when specified, and manage the deployment of configuration files while providing status feedback through console output."}, "inference_content": {"inference_model": "DeepSeek-R1", "inference_result": "```php\n[TASK_BEGIN]\npublic function handle(): int\n{\n $rectorConfigPath = base_path('rector.php');\n\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\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": "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Commands;\n\nuse Illuminate\\Console\\Command;\nuse Illuminate\\Support\\Facades\\File;\n\nfinal class EssentialsPintCommand extends Command\n{\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected $signature = 'essentials:pint\n {--force : Force the operation to run without confirmation}\n {--backup : Create a backup of existing pint.json}';\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected $description = 'This command will publish an opinionated Pint configuration file for your project.';\n\n /**\n * Execute the console command.\n */\n ", "suffix_code": "\n}\n", "middle_code": "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 }", "code_description": null, "fill_type": "FUNCTION_TYPE", "language_type": "php", "sub_task_type": null}, "context_code": [["/essentials/src/Commands/EssentialsRectorCommand.php", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Commands;\n\nuse Illuminate\\Console\\Command;\nuse Illuminate\\Support\\Facades\\File;\n\nfinal class EssentialsRectorCommand extends Command\n{\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected $signature = 'essentials:rector\n {--force : Force the operation to run without confirmation}\n {--backup : Create a backup of existing rector.php}';\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected $description = 'This command will publish an opinionated Rector configuration file for your project.';\n\n /**\n * Execute the console command.\n */\n 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\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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Commands;\n\nuse Illuminate\\Console\\GeneratorCommand;\nuse Illuminate\\Support\\Str;\n\nfinal class MakeActionCommand extends GeneratorCommand\n{\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected $name = 'make:action';\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected $description = 'Create a new action class';\n\n /**\n * The type of class being generated.\n *\n * @var string\n */\n protected $type = 'Action';\n\n /**\n * Execute the console command.\n *\n * @return bool|int|null\n */\n public function handle()\n {\n // First check if the class already exists\n if ($this->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials;\n\nuse Illuminate\\Console\\Command;\nuse Illuminate\\Support\\ServiceProvider as BaseServiceProvider;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\n/**\n * @internal\n */\nfinal class EssentialsServiceProvider extends BaseServiceProvider\n{\n /**\n * The list of configurables.\n *\n * @var list<class-string<Configurable>>\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<class-string<Command>>\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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Database\\Eloquent\\Model;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class AutomaticallyEagerLoadRelationships implements Configurable\n{\n public function __construct(\n private string $modelClass = Model::class\n ) {}\n\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Support\\Facades\\Http;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class PreventStrayRequests implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n $enabled = config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Support\\Sleep;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class FakeSleep implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n $enabled = config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Support\\Facades\\DB;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class ProhibitDestructiveCommands implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Support\\Facades\\URL;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class ForceScheme implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Support\\Facades\\Vite;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class AggressivePrefetching implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Carbon\\CarbonImmutable;\nuse Illuminate\\Support\\Facades\\Date;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class ImmutableDates implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Validation\\Rules\\Password;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal class SetDefaultPassword implements Configurable\n{\n /**\n * {@inheritDoc}\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Database\\Eloquent\\Model;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class ShouldBeStrict implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Configurables;\n\nuse Illuminate\\Database\\Eloquent\\Model;\nuse NunoMaduro\\Essentials\\Contracts\\Configurable;\n\nfinal readonly class Unguard implements Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool\n {\n return config()->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", "<?php\n\ndeclare(strict_types=1);\n\nuse Rector\\Config\\RectorConfig;\nuse Rector\\Php83\\Rector\\ClassMethod\\AddOverrideAttributeToOverriddenMethodsRector;\n\nreturn RectorConfig::configure()\n ->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", "<?php\n\ndeclare(strict_types=1);\n\nnamespace NunoMaduro\\Essentials\\Contracts;\n\n/**\n * @internal\n */\ninterface Configurable\n{\n /**\n * Whether the configurable is enabled or not.\n */\n public function enabled(): bool;\n\n /**\n * Run the configurable.\n */\n public function configure(): void;\n}\n"]], "task_instance_info": {"created_time": "2025-08-20 21:26:00", "created_task_model": "DeepSeek-R1", "function_skeleton": "public function handle () : int {}", "code_description": "This code segment functions to: Manage user confirmation and file operations for publishing a configuration file, including conditional backup creation and error handling for file existence and copy operations."}, "inference_content": {"inference_model": "DeepSeek-R1", "inference_result": "```php\n[TASK_BEGIN]\npublic function handle(): int\n{\n $source = __DIR__.'/../../stubs/pint.json';\n $destination = base_path('pint.json');\n\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\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}"}}