printError("Wrong type $type");
return '';
default:
if (substr($type, 0, 6) === 'vector') {
if ($type[6] !== '<' || $type[strlen($type) - 1] !== '>') {
$this->printError("Wrong vector subtype in $type");
return '';
}
return $this->getTypeName(substr($type, 7, -1)).'[]';
}
if (preg_match('/[^A-Za-z0-9.]/', $type)) {
$this->printError("Wrong type $type");
return '';
}
return $this->getClassName($type);
}
}
protected function getBaseClassName($is_function)
{
return $is_function ? 'Function' : 'Object';
}
protected function needRemoveLine($line)
{
return strpos(trim($line), '/**') === 0 || strpos(trim($line), '*') === 0 ||
($this->nullable_type && strpos($line, $this->nullable_type) > 0);
}
protected function needSkipLine($line)
{
$line = trim($line);
return strpos($line, 'public') !== 0 && !($this->nullable_type && $line == 'import java.util.Arrays;') &&
!$this->isHeaderLine($line);
}
protected function isHeaderLine($line)
{
return trim($line) === '@Override';
}
protected function extractClassName($line)
{
if (strpos($line, 'public static class ') > 0) {
return explode(' ', trim($line))[3];
}
return '';
}
protected function fixLine($line)
{
if (strpos($line, 'CONSTRUCTOR = ') > 0) {
return substr($line, 0, strpos($line, '='));
}
return $this->nullable_annotation ? str_replace($this->nullable_annotation.' ', '', $line) : $line;
}
protected function addGlobalDocumentation()
{
$this->addDocumentation('public class TdApi {', <<