]> git.localhorst.tv Git - alttp.git/blob - app/Console/Commands/BeatDiffCommand.php
add emote stats command
[alttp.git] / app / Console / Commands / BeatDiffCommand.php
1 <?php
2
3 namespace App\Console\Commands;
4
5 use App\Beat\Encoder;
6 use Illuminate\Console\Command;
7
8 class BeatDiffCommand extends Command
9 {
10         /**
11          * The name and signature of the console command.
12          *
13          * @var string
14          */
15         protected $signature = 'beat:diff {source} {target} {patch}';
16
17         /**
18          * The console command description.
19          *
20          * @var string
21          */
22         protected $description = 'Create BPS patch';
23
24         /**
25          * Execute the console command.
26          *
27          * @return int
28          */
29         public function handle()
30         {
31                 $source = file_get_contents($this->argument('source'));
32                 $target = file_get_contents($this->argument('target'));
33                 $encoder = new Encoder($source);
34                 $patch = $encoder->createPatch($target);
35                 file_put_contents($this->argument('patch'), $patch);
36                 return 0;
37         }
38 }