Skip to content

Commit 77ca5fb

Browse files
committed
クラスとメソッドを自動取得
1 parent 02d6930 commit 77ca5fb

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ $api = SecureCoinAPI::getInstance();
2828

2929
お金を追加
3030

31-
https://github.com/SpaceServerDev/SecureCoinAPI/blob/55ac74ce820969bcd1dea0ab73b24ae9501bf332/src/space/yurisi/SecureCoinAPI/command/addcoinCommand.php#L43-L51
31+
https://github.com/SpaceServerDev/SecureCoinAPI/blob/55ac74ce820969bcd1dea0ab73b24ae9501bf332/src/space/yurisi/SecureCoinAPI/command/addcoinCommand.php#L43-L49
3232
```php
3333
use space\yurisi\SecureCoinAPI\SecureCoinAPI;
3434
use space\yurisi\SecureCoinAPI\History
@@ -38,8 +38,6 @@ $history = new History(
3838
null,
3939
"増やすお金",
4040
"プラグイン名",
41-
"クラス名",
42-
"メソッド名",
4341
"詳細(省略可)"
4442
)
4543
$api->addMoney($history);

src/space/yurisi/SecureCoinAPI/History.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@
55

66
class History {
77

8+
private string $class_name;
9+
private string $method_name;
10+
811
public function __construct(
912
private string $received_player,
1013
private ?string $sent_player,
1114
private int $amount,
1215
private string $plugin_name,
13-
private string $class_name,
14-
private string $method_name,
1516
private string $description = "",
1617
) {
18+
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
19+
$this->class_name = $backtrace[1]['class'];
20+
$this->method_name = $backtrace[1]['function'];
1721
}
1822

1923
public function getPlugin(): string {

src/space/yurisi/SecureCoinAPI/command/addcoinCommand.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ public function execute(CommandSender $sender, string $commandLabel, array $args
4646
null,
4747
$amount,
4848
$this->main->getName(),
49-
'addcoinCommand',
50-
'execute',
5149
'指定したプレイヤーにお金を追加するコマンド'
5250
));
5351

0 commit comments

Comments
 (0)