1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-12-11 17:00:00 +01:00
MadelineProto/tools/phpdoc.php

129 lines
4.1 KiB
PHP
Raw Normal View History

2022-12-29 20:40:06 +01:00
<?php declare(strict_types=1);
2020-10-13 21:54:25 +02:00
2023-07-14 16:44:10 +02:00
use danog\MadelineProto\AbstractAPI;
2020-10-13 21:54:25 +02:00
use danog\MadelineProto\AbstractAPIFactory;
use danog\MadelineProto\AnnotationsBuilder;
use danog\MadelineProto\APIFactory;
use danog\MadelineProto\APIWrapper;
use danog\MadelineProto\Async\AsyncConstruct;
use danog\MadelineProto\Bug74586Exception;
use danog\MadelineProto\Connection;
use danog\MadelineProto\DataCenter;
use danog\MadelineProto\DataCenterConnection;
2022-05-01 20:17:16 +02:00
use danog\MadelineProto\Doc\MethodDoc;
use danog\MadelineProto\Doc\NamespaceDoc;
2020-10-13 21:54:25 +02:00
use danog\MadelineProto\DocsBuilder;
use danog\MadelineProto\DoHConnector;
use danog\MadelineProto\GarbageCollector;
2023-07-14 16:44:10 +02:00
use danog\MadelineProto\InternalDoc;
2020-10-13 21:54:25 +02:00
use danog\MadelineProto\Lang;
use danog\MadelineProto\LightState;
use danog\MadelineProto\Magic;
use danog\MadelineProto\MTProtoTools\Crypt;
use danog\MadelineProto\MTProtoTools\MinDatabase;
use danog\MadelineProto\MTProtoTools\PasswordCalculator;
use danog\MadelineProto\MTProtoTools\ReferenceDatabase;
use danog\MadelineProto\MTProtoTools\UpdatesState;
use danog\MadelineProto\NothingInTheSocketException;
use danog\MadelineProto\RSA;
use danog\MadelineProto\Serialization;
use danog\MadelineProto\SessionPaths;
use danog\MadelineProto\SettingsAbstract;
use danog\MadelineProto\SettingsEmpty;
use danog\MadelineProto\Snitch;
use danog\MadelineProto\TL\TL;
use danog\MadelineProto\TL\TLCallback;
use danog\MadelineProto\TL\TLConstructors;
use danog\MadelineProto\TL\TLMethods;
use danog\MadelineProto\TON\ADNLConnection;
use danog\MadelineProto\TON\APIFactory as TONAPIFactory;
use danog\MadelineProto\TON\InternalDoc as TONInternalDoc;
use danog\MadelineProto\TON\Lite;
2020-10-15 19:07:37 +02:00
use danog\PhpDoc\PhpDocBuilder;
2020-10-13 21:54:25 +02:00
require 'vendor/autoload.php';
$ignore = [ // Disallow list
2023-07-14 16:44:10 +02:00
AbstractAPI::class,
InternalDoc::class,
2020-10-13 21:54:25 +02:00
AnnotationsBuilder::class,
APIFactory::class,
APIWrapper::class,
AbstractAPIFactory::class,
Bug74586Exception::class,
Connection::class,
ContextConnector::class,
DataCenter::class,
DataCenterConnection::class,
DoHConnector::class,
DocsBuilder::class,
2022-05-01 20:17:16 +02:00
MethodDoc::class,
NamespaceDoc::class,
2020-10-13 21:54:25 +02:00
Lang::class,
LightState::class,
Magic::class,
PhpDocBuilder::class,
RSA::class,
Serialization::class,
SessionPaths::class,
SettingsEmpty::class,
SettingsAbstract::class,
Snitch::class,
AsyncConstruct::class,
Crypt::class,
NothingInTheSocketException::class,
GarbageCollector::class,
MinDatabase::class,
PasswordCalculator::class,
ReferenceDatabase::class,
UpdatesState::class,
TL::class,
TLConstructors::class,
TLMethods::class,
TLCallback::class,
ADNLConnection::class,
TONAPIFactory::class,
TONInternalDoc::class,
Lite::class,
\ArrayIterator::class,
];
2023-11-11 16:55:29 +01:00
$filter = static function (string $class) use ($ignore): bool {
if (in_array($class, $ignore, true)) {
2020-10-13 21:54:25 +02:00
return false;
}
2022-12-08 20:16:40 +01:00
if (str_starts_with($class, 'danog\\MadelineProto\\Ipc')
|| str_starts_with($class, 'danog\\MadelineProto\\Loop\\Update')
|| str_starts_with($class, 'danog\\MadelineProto\\Loop\\Connection')
|| str_starts_with($class, 'danog\\MadelineProto\\MTProto\\')
2023-07-14 16:44:10 +02:00
|| str_starts_with($class, 'danog\\MadelineProto\\Namespace\\')
2022-12-08 20:16:40 +01:00
|| str_starts_with($class, 'danog\\MadelineProto\\MTProtoSession\\')
|| str_starts_with($class, 'danog\\MadelineProto\\PhpDoc\\')
|| str_starts_with($class, 'danog\\MadelineProto\\Stream\\')
|| str_starts_with($class, 'danog\\MadelineProto\\Db\\NullCache')) {
2020-10-13 21:54:25 +02:00
return false;
}
$class = new ReflectionClass($class);
return !$class->isTrait();
};
2023-07-14 16:44:10 +02:00
shell_exec("rm -rf ".__DIR__.'/../docs/docs/PHP/');
2020-10-13 21:54:25 +02:00
PhpDocBuilder::fromNamespace()
->setFilter($filter)
->setOutput(__DIR__.'/../docs/docs/PHP/')
2020-10-17 12:47:05 +02:00
->setImage("https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png")
2022-05-01 20:17:16 +02:00
->addIndexFrontMatter('title', 'MadelineProto API')
->addIndexFrontMatter('description', 'MadelineProto PHP API reference')
->addIndexFrontMatter('has_children', 'true')
->addIndexFrontMatter('has_toc', 'false')
->addIndexFrontMatter('nav_order', '2')
->addFrontMatter('parent', 'MadelineProto API')
2020-10-13 21:54:25 +02:00
->run();