<?php

namespace CookieSession\Storage\Serialization;

use Symfony\Component\HttpFoundation\Cookie;

class Record
{
    protected $name;
    protected $value;

    public function __construct($name, $value)
    {
        $this->name = $name;
        $this->value = $value;
    }


    /**
     * @return mixed
     */
    public function getName()
    {
        return $this->name;
    }


    /**
     * @return mixed
     */
    public function getValue()
    {
        return $this->value;
    }


    /**
     * @param \DateTime $expire
     * @param string    $domain
     * @param bool|true $secure
     * @param bool|true $httpOnly
     *
     * @return Cookie
     */
    public function toCookie(\DateTime $expire, $domain = '', $secure = true, $httpOnly = true)
    {
        return new Cookie($this->getName(), $this->getValue(), $expire, '/', $domain, $secure, $httpOnly);
    }
}