added apiName
This commit is contained in:
@ -21,10 +21,11 @@ class APIlite
|
||||
private string $endpoint = '';
|
||||
private $methods = array();
|
||||
|
||||
public function __construct(?string $format = null, ?string $endpoint = null)
|
||||
public function __construct(?string $format = null, ?string $endpoint = null, ?string $apiName = null)
|
||||
{
|
||||
register_shutdown_function(array($this, '_shutdownHandler'));
|
||||
$this->endpoint = $endpoint ?? $this->getCurrentUrl();
|
||||
$this->apiName = $apiName ?? '';
|
||||
$this->analyzeClass();
|
||||
if (isset($_REQUEST['action'])) {
|
||||
$this->doAction($_REQUEST['action']);
|
||||
@ -67,7 +68,9 @@ class APIlite
|
||||
private function analyzeClass(): bool
|
||||
{
|
||||
$refClass = new \ReflectionClass($this);
|
||||
if (strlen($this->apiName) <= 0) {
|
||||
$this->apiName = $refClass->getShortName();
|
||||
}
|
||||
$this->methods = array();
|
||||
foreach ($refClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $ref_method) {
|
||||
$method_name = $ref_method->getName();
|
||||
|
||||
Reference in New Issue
Block a user