mirror of
https://github.com/Sysbot-org/tgscraper.git
synced 2025-01-28 03:27:43 +01:00
Converted API from Class to Trait
This commit is contained in:
parent
d406940453
commit
032684b93a
@ -177,23 +177,20 @@ class StubCreator
|
|||||||
$file = new PhpFile;
|
$file = new PhpFile;
|
||||||
$file->addComment('@noinspection PhpUnused');
|
$file->addComment('@noinspection PhpUnused');
|
||||||
$file->addComment('@noinspection PhpUnusedParameterInspection');
|
$file->addComment('@noinspection PhpUnusedParameterInspection');
|
||||||
$file->addComment('@noinspection PhpIncompatibleReturnTypeInspection');
|
|
||||||
$file->addComment('@noinspection PhpVoidFunctionResultUsedInspection');
|
|
||||||
$phpNamespace = $file->addNamespace($this->namespace);
|
$phpNamespace = $file->addNamespace($this->namespace);
|
||||||
$apiClass = $phpNamespace->addClass('API')
|
$apiClass = $phpNamespace->addClass('API')
|
||||||
->setType('class');
|
->setTrait();
|
||||||
$apiClass->addMethod('__construct')
|
$apiClass->addMethod('__construct')
|
||||||
->setPublic()
|
->setPublic()
|
||||||
->addPromotedParameter('client')
|
->setAbstract();
|
||||||
->setType('\GuzzleHttp\Client')
|
|
||||||
->setPrivate();
|
|
||||||
$sendRequest = $apiClass->addMethod('sendRequest')
|
$sendRequest = $apiClass->addMethod('sendRequest')
|
||||||
->setPublic();
|
->setPublic()
|
||||||
|
->setAbstract()
|
||||||
|
->setReturnType(Type::MIXED);
|
||||||
$sendRequest->addParameter('method')
|
$sendRequest->addParameter('method')
|
||||||
->setType(Type::STRING);
|
->setType(Type::STRING);
|
||||||
$sendRequest->addParameter('args')
|
$sendRequest->addParameter('args')
|
||||||
->setType(Type::ARRAY);
|
->setType(Type::ARRAY);
|
||||||
$sendRequest->addBody('//TODO: add your logic here');
|
|
||||||
foreach ($this->scheme['methods'] as $method) {
|
foreach ($this->scheme['methods'] as $method) {
|
||||||
$function = $apiClass->addMethod($method['name'])
|
$function = $apiClass->addMethod($method['name'])
|
||||||
->setPublic()
|
->setPublic()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user