TestCaseMan.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. use App\Tools\CaseMan;
  5. use App\Models\UserDict;
  6. class TestCaseMan extends Command
  7. {
  8. /**
  9. * The name and signature of the console command.
  10. *
  11. * @var string
  12. */
  13. protected $signature = 'test:case {word}';
  14. /**
  15. * The console command description.
  16. *
  17. * @var string
  18. */
  19. protected $description = 'Command description';
  20. /**
  21. * Create a new command instance.
  22. *
  23. * @return void
  24. */
  25. public function __construct()
  26. {
  27. parent::__construct();
  28. }
  29. /**
  30. * Execute the console command.
  31. *
  32. * @return int
  33. */
  34. public function handle()
  35. {
  36. $caseman = new CaseMan();
  37. $parents = $caseman->WordToBase($this->argument('word'),1);
  38. # code...
  39. foreach ($parents as $base => $rows) {
  40. # code...
  41. if(count($rows)==0){
  42. $this->error("base={$base}-(".count($rows).")");
  43. }else{
  44. $this->warn("base={$base}-(".count($rows).")");
  45. }
  46. foreach ($rows as $value) {
  47. # code...
  48. $this->info($value['word'].'-'.$value['type'].'-'.$value['grammar'].'-'.$base);
  49. }
  50. }
  51. return 0;
  52. }
  53. }