Rename
This commit is contained in:
parent
2720c50ca0
commit
c16e174db2
@ -1 +1 @@
|
|||||||
Subproject commit 1f3cae095fb9d4cfc48a178f246d80ac81eea108
|
Subproject commit 499f1d8ec8f7f2f554d0b347bd06c26404a2e402
|
@ -1 +1 @@
|
|||||||
Subproject commit a13d70b29c10d39a0f46caf86c1c560ffe26f254
|
Subproject commit a8e5d660b61d231960705c33a951a78ce11e27de
|
@ -88,7 +88,7 @@ class API extends InternalDoc
|
|||||||
} catch (\danog\MadelineProto\Bug74586Exception $e) {
|
} catch (\danog\MadelineProto\Bug74586Exception $e) {
|
||||||
\class_exists('\\Volatile');
|
\class_exists('\\Volatile');
|
||||||
$tounserialize = \str_replace('O:26:"danog\\MadelineProto\\Button":', 'O:35:"danog\\MadelineProto\\TL\\Types\\Button":', $tounserialize);
|
$tounserialize = \str_replace('O:26:"danog\\MadelineProto\\Button":', 'O:35:"danog\\MadelineProto\\TL\\Types\\Button":', $tounserialize);
|
||||||
foreach (['RSA', 'TL\\TLMethod', 'TL\\TLConstructor', 'MTProto', 'API', 'DataCenter', 'Connection', 'TL\\Types\\Button', 'TL\\Types\\Bytes', 'APIFactory'] as $class) {
|
foreach (['RSA', 'TL\\TLMethods', 'TL\\TLConstructors', 'MTProto', 'API', 'DataCenter', 'Connection', 'TL\\Types\\Button', 'TL\\Types\\Bytes', 'APIFactory'] as $class) {
|
||||||
\class_exists('\\danog\\MadelineProto\\'.$class);
|
\class_exists('\\danog\\MadelineProto\\'.$class);
|
||||||
}
|
}
|
||||||
$unserialized = \danog\Serialization::unserialize($tounserialize);
|
$unserialized = \danog\Serialization::unserialize($tounserialize);
|
||||||
@ -100,7 +100,7 @@ class API extends InternalDoc
|
|||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
\class_exists('\\Volatile');
|
\class_exists('\\Volatile');
|
||||||
foreach (['RSA', 'TL\\TLMethod', 'TL\\TLConstructor', 'MTProto', 'API', 'DataCenter', 'Connection', 'TL\\Types\\Button', 'TL\\Types\\Bytes', 'APIFactory'] as $class) {
|
foreach (['RSA', 'TL\\TLMethods', 'TL\\TLConstructors', 'MTProto', 'API', 'DataCenter', 'Connection', 'TL\\Types\\Button', 'TL\\Types\\Bytes', 'APIFactory'] as $class) {
|
||||||
\class_exists('\\danog\\MadelineProto\\'.$class);
|
\class_exists('\\danog\\MadelineProto\\'.$class);
|
||||||
}
|
}
|
||||||
$changed = false;
|
$changed = false;
|
||||||
|
@ -35,13 +35,13 @@ class TL
|
|||||||
/**
|
/**
|
||||||
* Constructors.
|
* Constructors.
|
||||||
*
|
*
|
||||||
* @var TLConstructor
|
* @var TLConstructors
|
||||||
*/
|
*/
|
||||||
private $constructors;
|
private $constructors;
|
||||||
/**
|
/**
|
||||||
* Methods.
|
* Methods.
|
||||||
*
|
*
|
||||||
* @var TLMethod
|
* @var TLMethods
|
||||||
*/
|
*/
|
||||||
private $methods;
|
private $methods;
|
||||||
/**
|
/**
|
||||||
@ -53,7 +53,7 @@ class TL
|
|||||||
/**
|
/**
|
||||||
* TD Methods.
|
* TD Methods.
|
||||||
*
|
*
|
||||||
* @var TLMethod
|
* @var TLMethods
|
||||||
*/
|
*/
|
||||||
private $td_methods;
|
private $td_methods;
|
||||||
/**
|
/**
|
||||||
@ -99,9 +99,9 @@ class TL
|
|||||||
*
|
*
|
||||||
* @param int $td Whether to get TD or normal methods
|
* @param int $td Whether to get TD or normal methods
|
||||||
*
|
*
|
||||||
* @return TLConstructor
|
* @return TLConstructors
|
||||||
*/
|
*/
|
||||||
public function getConstructors(bool $td = false): TLConstructor
|
public function getConstructors(bool $td = false): TLConstructors
|
||||||
{
|
{
|
||||||
return $td ? $this->td_constructors : $this->constructors;
|
return $td ? $this->td_constructors : $this->constructors;
|
||||||
}
|
}
|
||||||
@ -111,9 +111,9 @@ class TL
|
|||||||
*
|
*
|
||||||
* @param int $td Whether to get TD or normal methods
|
* @param int $td Whether to get TD or normal methods
|
||||||
*
|
*
|
||||||
* @return TLMethod
|
* @return TLMethods
|
||||||
*/
|
*/
|
||||||
public function getMethods(bool $td = false): TLMethod
|
public function getMethods(bool $td = false): TLMethods
|
||||||
{
|
{
|
||||||
return $td ? $this->td_methods : $this->methods;
|
return $td ? $this->td_methods : $this->methods;
|
||||||
}
|
}
|
||||||
@ -140,10 +140,10 @@ class TL
|
|||||||
{
|
{
|
||||||
$this->API->logger->logger(\danog\MadelineProto\Lang::$current_lang['TL_loading'], \danog\MadelineProto\Logger::VERBOSE);
|
$this->API->logger->logger(\danog\MadelineProto\Lang::$current_lang['TL_loading'], \danog\MadelineProto\Logger::VERBOSE);
|
||||||
$this->updateCallbacks($objects);
|
$this->updateCallbacks($objects);
|
||||||
$this->constructors = new TLConstructor();
|
$this->constructors = new TLConstructors();
|
||||||
$this->methods = new TLMethod();
|
$this->methods = new TLMethods();
|
||||||
$this->td_constructors = new TLConstructor();
|
$this->td_constructors = new TLConstructors();
|
||||||
$this->td_methods = new TLMethod();
|
$this->td_methods = new TLMethods();
|
||||||
$this->td_descriptions = ['types' => [], 'constructors' => [], 'methods' => []];
|
$this->td_descriptions = ['types' => [], 'constructors' => [], 'methods' => []];
|
||||||
foreach ($files as $scheme_type => $file) {
|
foreach ($files as $scheme_type => $file) {
|
||||||
$this->API->logger->logger(\sprintf(\danog\MadelineProto\Lang::$current_lang['file_parsing'], \basename($file)), \danog\MadelineProto\Logger::VERBOSE);
|
$this->API->logger->logger(\sprintf(\danog\MadelineProto\Lang::$current_lang['file_parsing'], \basename($file)), \danog\MadelineProto\Logger::VERBOSE);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TLConstructor module.
|
* TLConstructors module.
|
||||||
*
|
*
|
||||||
* This file is part of MadelineProto.
|
* This file is part of MadelineProto.
|
||||||
* MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
* MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
namespace danog\MadelineProto\TL;
|
namespace danog\MadelineProto\TL;
|
||||||
|
|
||||||
class TLConstructor
|
class TLConstructors
|
||||||
{
|
{
|
||||||
use \danog\Serializable;
|
use \danog\Serializable;
|
||||||
use \danog\MadelineProto\Tools;
|
use \danog\MadelineProto\Tools;
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TLMethod module.
|
* TLMethods module.
|
||||||
*
|
*
|
||||||
* This file is part of MadelineProto.
|
* This file is part of MadelineProto.
|
||||||
* MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
* MadelineProto is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
namespace danog\MadelineProto\TL;
|
namespace danog\MadelineProto\TL;
|
||||||
|
|
||||||
class TLMethod
|
class TLMethods
|
||||||
{
|
{
|
||||||
use \danog\Serializable;
|
use \danog\Serializable;
|
||||||
use \danog\MadelineProto\Tools;
|
use \danog\MadelineProto\Tools;
|
54
tools/static.php
Normal file
54
tools/static.php
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use danog\MadelineProto\Tools;
|
||||||
|
|
||||||
|
\chdir(__DIR__.'/../');
|
||||||
|
|
||||||
|
require 'vendor/autoload.php';
|
||||||
|
|
||||||
|
$class = new \ReflectionClass(Tools::class);
|
||||||
|
$methods = $class->getMethods(ReflectionMethod::IS_STATIC | ReflectionMethod::IS_PUBLIC);
|
||||||
|
|
||||||
|
function ssort($a, $b)
|
||||||
|
{
|
||||||
|
return \strlen($b->getName())-\strlen($a->getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
\usort($methods, 'ssort');
|
||||||
|
|
||||||
|
$find = [];
|
||||||
|
$replace = [];
|
||||||
|
$findDocs = [];
|
||||||
|
$replaceDocs = [];
|
||||||
|
foreach ($methods as $methodObj) {
|
||||||
|
$method = $methodObj->getName();
|
||||||
|
|
||||||
|
$find[] = "\$this->$method(";
|
||||||
|
$replace[] = "\\danog\\MadelineProto\\Tools::$method(";
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (new RegexIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator(\realpath('.'))), '/\.php$/') as $filename) {
|
||||||
|
$filename = (string) $filename;
|
||||||
|
$new = \str_replace($find, $replace, $old = \file_get_contents($filename));
|
||||||
|
do {
|
||||||
|
\file_put_contents($filename, $new);
|
||||||
|
$new = \str_replace($find, $replace, $old = \file_get_contents($filename));
|
||||||
|
} while ($old !== $new);
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
|
||||||
|
foreach (new RegexIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator(\realpath('docs'))), '/\.md$/') as $filename) {
|
||||||
|
$filename = (string) $filename;
|
||||||
|
$new = \str_replace($findDocs, $replaceDocs, $old = \file_get_contents($filename));
|
||||||
|
do {
|
||||||
|
\file_put_contents($filename, $new);
|
||||||
|
$new = \str_replace($findDocs, $replaceDocs, $old = \file_get_contents($filename));
|
||||||
|
} while ($old !== $new);
|
||||||
|
}
|
||||||
|
$filename = 'README.md';
|
||||||
|
|
||||||
|
$new = \str_replace($findDocs, $replaceDocs, $old = \file_get_contents($filename));
|
||||||
|
do {
|
||||||
|
\file_put_contents($filename, $new);
|
||||||
|
$new = \str_replace($findDocs, $replaceDocs, $old = \file_get_contents($filename));
|
||||||
|
} while ($old !== $new);
|
Loading…
Reference in New Issue
Block a user