<?php


namespace App\Libs\Push\HuaWei\Admin\Msg\WebPush;


class WebPushHeaders
{
    private $ttl;

    private $topic;

    private $urgency;

    private $fields;

    public function __construct()
    {
        $this->fields = array();
    }

    public function ttl($value)
    {
        $this->ttl = $value;
    }

    public function topic($value)
    {
        $this->topic = $value;
    }

    public function urgency($value)
    {
        $this->urgency = $value;
    }

    public function getFields()
    {
        return $this->fields;
    }

    public function buildFields()
    {
        $keys = array(
            'ttl',
            'topic',
            'urgency'
        );
        foreach ($keys as $key) {
            if (isset($this->$key)) {
                $this->fields[$key] = $this->$key;
            }
        }
    }
}