From 40ad567e652f0821724f8fd79c633326547de3c4 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Fri, 18 Aug 2017 16:11:04 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/danog/MadelineProto/DocsBuilder.php | 13 +++++++++++-- .../MadelineProto/DocsBuilder/Constructors.php | 3 ++- src/danog/MadelineProto/DocsBuilder/Methods.php | 7 +++---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/danog/MadelineProto/DocsBuilder.php b/src/danog/MadelineProto/DocsBuilder.php index 6145369f..e152e4aa 100644 --- a/src/danog/MadelineProto/DocsBuilder.php +++ b/src/danog/MadelineProto/DocsBuilder.php @@ -40,8 +40,17 @@ class DocsBuilder public $types = []; public $any = '*'; - public function end($what) { return end($what); } - public function escape($hwat) { return str_replace('_', '\_', $hwat); } + + public function end($what) + { + return end($what); + } + + public function escape($hwat) + { + return str_replace('_', '\_', $hwat); + } + public function mk_docs() { \danog\MadelineProto\Logger::log(['Generating documentation index...'], \danog\MadelineProto\Logger::NOTICE); diff --git a/src/danog/MadelineProto/DocsBuilder/Constructors.php b/src/danog/MadelineProto/DocsBuilder/Constructors.php index 7d240ae7..e5862a3b 100644 --- a/src/danog/MadelineProto/DocsBuilder/Constructors.php +++ b/src/danog/MadelineProto/DocsBuilder/Constructors.php @@ -14,7 +14,8 @@ namespace danog\MadelineProto\DocsBuilder; trait Constructors { - public function mk_constructors() { + public function mk_constructors() + { foreach (glob('constructors/'.$this->any) as $unlink) { unlink($unlink); } diff --git a/src/danog/MadelineProto/DocsBuilder/Methods.php b/src/danog/MadelineProto/DocsBuilder/Methods.php index f10ddb49..343d4265 100644 --- a/src/danog/MadelineProto/DocsBuilder/Methods.php +++ b/src/danog/MadelineProto/DocsBuilder/Methods.php @@ -14,8 +14,8 @@ namespace danog\MadelineProto\DocsBuilder; trait Methods { - public function mk_methods() { - + public function mk_methods() + { foreach (glob($this->settings['output_dir'].'methods/'.$this->any) as $unlink) { unlink($this->settings['output_dir'].$unlink); } @@ -56,7 +56,7 @@ trait Methods $type_or_subtype = isset($param['subtype']) ? 'subtype' : 'type'; $type_or_bare_type = (ctype_upper($this->end(explode('.', $param[$type_or_subtype]))[0]) || in_array($param[$type_or_subtype], ['!X', 'X', 'bytes', 'true', 'false', 'double', 'string', 'Bool', 'int', 'long', 'int128', 'int256', 'int512'])) ? 'types' : 'constructors'; $param[$type_or_subtype] = str_replace(['.', 'true', 'false'], ['_', 'Bool', 'Bool'], $param[$type_or_subtype]); - + $param[$type_or_subtype] = '['.$this->escape($param[$type_or_subtype]).'](../'.$type_or_bare_type.'/'.$param[$type_or_subtype].'.md)'; $params .= "'".$param['name']."' => ".(isset($param['subtype']) ? '\['.$param[$type_or_subtype].'\]' : $param[$type_or_subtype]).', '; @@ -291,6 +291,5 @@ description: List of methods '.implode('', $this->docs_methods)); - } }