jccp_a/laravel/app/Services/Tg/Hook/Mod/Tool.php
hellcat ac91e1fbe4 1
2025-11-12 17:57:30 +08:00

77 lines
1.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Services\Tg\Hook\Mod;
//use App\Models\Box as ModelShip;
//use App\Services\TomTool\Http;
//use App\Models\BoxGithubTag as GithubTag;
class Tool extends Base {
public function Ref($aParam)
{
$sClassName = $aParam["aArg"][1] ?? false;
$sLike = $aParam["aArg"][2] ?? false;
if (!$sClassName) {
return "需要arg[1],类名。";
}
$sClassName = ucfirst($sClassName);
$sClassPath = "App\\Services\\TG\\Hook\\Mod\\".$sClassName;
$oRef = new \ReflectionClass($sClassPath);
$oMetHods = $oRef->getMethods();
$str = "";
foreach ($oMetHods as $oMetHodsRow) {
if ($oMetHodsRow->class == $sClassPath) {
// 有like时只提取like到的无like时得到所有
if ($sLike) {
$string = "Hello, world!";
$character = "o";
if (stripos($oMetHodsRow->name, $sLike) !== false) {
$str .= "\n\n";
$str .= $oMetHodsRow->name;
}
} else {
$str .= "\n\n";
$str .= $oMetHodsRow->name;
}
}
}
return $str;
}
public function refLike($aParam)
{
$sClassName = $aParam["aArg"][1] ?? false;
$sLike = $aParam["aArg"][2] ?? false;
if (!$sClassName) {
return "需要arg[1],类名。";
}
if (!$sLike) {
return "需要arg[2]like。";
}
return $this->Ref($aParam);
}
// public function ref()
// {
// $oRef = new \ReflectionClass($this);
// $oMetHods = $oRef->getMethods();
//
// tomd($oMetHods, 1);
// }
}