pocketmine\utils\Terminal::init PHP Метод

init() публичный статический Метод

public static init ( )
    public static function init()
    {
        if (!self::hasFormattingCodes()) {
            return;
        }
        switch (Utils::getOS()) {
            case "linux":
            case "mac":
            case "bsd":
                self::getEscapeCodes();
                return;
            case "win":
            case "android":
                self::getFallbackEscapeCodes();
                return;
        }
        //TODO: iOS
    }

Usage Example

Пример #1
0
 public function run()
 {
     foreach ($this->loadPaths as $name => $path) {
         if (!class_exists($name, false) and !interface_exists($name, false)) {
             require $path;
         }
     }
     $this->loader->register(true);
     Terminal::init();
     $server = new \Wrench\Server('ws://' . $this->host . ':' . $this->port, array("logger" => function ($msg, $pri) {
     }));
     $server->registerApplication("app", new PDCApp($this, $this->password));
     $server->addListener(\Wrench\Server::EVENT_SOCKET_CONNECT, function ($data, $other) {
         $header = $other->getSocket()->receive();
         if ($this->isHTTP($header)) {
             $other->getSocket()->send("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n" . $this->data);
             $other->close(200);
         } else {
             $other->onData($header);
         }
     });
     $server->run();
 }
All Usage Examples Of pocketmine\utils\Terminal::init