BitbarPlugins\Travel\TravelTimePlugin::renderBitbar PHP Method

renderBitbar() private method

render with Bitbar metadata
private renderBitbar ( ) : string
return string
    private function renderBitbar()
    {
        $return = "";
        if ($this->errors) {
            $return .= self::ICON_WARNING . " Error|color=" . self::COLOR_RED . "\n";
            $return .= "---\n";
            $return .= implode("|color=" . self::COLOR_RED . "\n", $this->errors) . "\n";
            $return .= "---\n";
            $return .= "Refresh | refresh=true \n";
            return $return;
        }
        $durationColor = self::COLOR_BLACK;
        if ($this->delay > self::FIVE_MINUTES_IN_SECONDS) {
            $durationColor = self::COLOR_ORANGE;
        }
        if ($this->delay > self::FIFTEEN_MINUTES_IN_SECONDS) {
            $durationColor = self::COLOR_RED;
        }
        $return .= self::ICON_PIN . " {$this->durationInTraffic['text']}|color={$durationColor}\n";
        $return .= "---\n";
        if ($this->warnings) {
            foreach ($this->warnings as $warning) {
                $return .= self::ICON_WARNING . " {$warning}\n";
            }
            $return .= "---\n";
        }
        $return .= "{$this->durationInTraffic['text']} ({$this->distance['text']})|color={$durationColor}\n";
        if ($this->delay > self::ONE_MINUTES_IN_SECONDS) {
            $return .= "{$this->duration['text']} without traffic\n";
        }
        $return .= "---\n";
        $return .= "Directions\n";
        $return .= self::ICON_CIRCLE . " {$this->originAddress} | color=" . self::COLOR_BLACK . "\n";
        $return .= self::ICON_FLAG . " {$this->destinationAddress} | color=" . self::COLOR_BLACK . "\n";
        $return .= "---\n";
        $return .= "Geolocation\n";
        $return .= "Latitude: {$this->latitude} | color=" . self::COLOR_BLACK . "\n";
        $return .= "Longitude: {$this->longitude} | color=" . self::COLOR_BLACK . "\n";
        $return .= "Accuracy: {$this->accuracy}m | color=" . self::COLOR_BLACK . "\n";
        $return .= "---\n";
        if ($this->googleMapsLink) {
            $return .= "View on Google maps|href={$this->googleMapsLink}\n";
        }
        $return .= "Refresh | refresh=true \n";
        return $return;
    }