| Total Complexity | 7 |
| Total Lines | 71 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class AddProxy extends TdFunction |
||
| 15 | { |
||
| 16 | public const TYPE_NAME = 'addProxy'; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Proxy server IP address. |
||
| 20 | */ |
||
| 21 | protected string $server; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Proxy server port. |
||
| 25 | */ |
||
| 26 | protected int $port; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * True, if the proxy should be enabled. |
||
| 30 | */ |
||
| 31 | protected bool $enable; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Proxy type. |
||
| 35 | */ |
||
| 36 | protected ProxyType $type; |
||
| 37 | |||
| 38 | public function __construct(string $server, int $port, bool $enable, ProxyType $type) |
||
| 44 | } |
||
| 45 | |||
| 46 | public static function fromArray(array $array): AddProxy |
||
| 47 | { |
||
| 48 | return new static( |
||
| 49 | $array['server'], |
||
| 50 | $array['port'], |
||
| 51 | $array['enable'], |
||
| 52 | TdSchemaRegistry::fromArray($array['type']), |
||
| 53 | ); |
||
| 54 | } |
||
| 55 | |||
| 56 | public function typeSerialize(): array |
||
| 64 | ]; |
||
| 65 | } |
||
| 66 | |||
| 67 | public function getServer(): string |
||
| 70 | } |
||
| 71 | |||
| 72 | public function getPort(): int |
||
| 73 | { |
||
| 74 | return $this->port; |
||
| 75 | } |
||
| 76 | |||
| 77 | public function getEnable(): bool |
||
| 80 | } |
||
| 81 | |||
| 82 | public function getType(): ProxyType |
||
| 87 |