fork download
  1. <?php
  2.  
  3. class アニマルガール
  4. {
  5.  
  6. protected $stack = [];
  7.  
  8. private final function __construct()
  9. {}
  10.  
  11. public static function サンドスター()
  12. {
  13. $class_path = get_called_class();
  14. return new $class_path();
  15. }
  16.  
  17. public static function __callStatic($method, $arguments)
  18. {
  19. return ($instance ?? $instance = static::サンドスター())->$method();
  20. }
  21.  
  22. public function __call($method, $arguments)
  23. {
  24. if (in_array($method, ['わーい', 'すごーい', 'たのしー'], true)) {
  25. $this->stack[] = $method;
  26. } else {
  27. $this->stack[] = sprintf('君は%sがとくいなフレンズなんだね!!', $method);
  28. echo implode(\PHP_EOL, $this->stack), \PHP_EOL;
  29. }
  30. return $this;
  31. }
  32. }
  33.  
  34. アニマルガール::わーい()->すごーい()->たのしー()->クソリプ();
  35.  
Success #stdin #stdout 0.02s 82880KB
stdin
Standard input is empty
stdout
わーい
すごーい
たのしー
君はクソリプがとくいなフレンズなんだね!!