Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
8 / 8
CRAP
100.00% covered (success)
100.00%
15 / 15
Conversion
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
8 / 8
8
100.00% covered (success)
100.00%
15 / 15
 __construct
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
5 / 5
 getFrom
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 getTo
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setTo
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getUnixTime
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setUnixTime
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getUnixMicroTime
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setUnixMicroTime
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
<?php
namespace Popy\Calendar\Converter;
use DateTimeInterface;
use Popy\Calendar\ValueObject\DateRepresentationInterface;
class Conversion
{
    /**
     * Date to convert.
     *
     * @var DateRepresentationInterface
     */
    protected $from;
    /**
     * Converted date (being built). Holds the date being built during a
     * conversion from unix time, and an eventually completed copy of the
     * source date.
     *
     * @var DateRepresentationInterface|null
     */
    protected $to;
    /**
     * Remaining/Accumulated unix time during conversion from/to timestamp.
     *
     * @var integer|null
     */
    protected $unixTime;
    /**
     * Remaining/Accumulated unix microtime during conversion from/to timestamp.
     *
     * @var integer|null
     */
    protected $unixMicroTime;
    /**
     * Class constructor.
     *
     * @param DateRepresentationInterface      $from
     * @param DateRepresentationInterface|null $to
     */
    public function __construct(DateRepresentationInterface $from, DateRepresentationInterface $to = null)
    {
        $this->from = $from;
        $this->to = $to;
        $this->unixTime = $from->getUnixTime();
        $this->unixMicroTime = $from->getUnixMicroTime();
    }
    /**
     * Gets the Date to convert.
     *
     * @return DateRepresentationInterface
     */
    public function getFrom()
    {
        return $this->from;
    }
    /**
     * Gets the Converted date.
     *
     * @return DateRepresentationInterface|null
     */
    public function getTo()
    {
        return $this->to;
    }
    /**
     * Sets the Converted date.
     *
     * @param DateRepresentationInterface $to the to
     *
     * @return self|null
     */
    public function setTo(DateRepresentationInterface $to)
    {
        $this->to = $to;
        return $this;
    }
    /**
     * Gets unix time.
     *
     * @return integer
     */
    public function getUnixTime()
    {
        return $this->unixTime;
    }
    /**
     * Sets unix time.
     *
     * @param integer $unixTime the unix time
     *
     * @return self
     */
    public function setUnixTime($unixTime)
    {
        $this->unixTime = $unixTime;
        return $this;
    }
    /**
     * Gets unix micro time.
     *
     * @return integer|null
     */
    public function getUnixMicroTime()
    {
        return $this->unixMicroTime;
    }
    /**
     * Sets unix micro time.
     *
     * @param integer $unixMicroTime the unix microtime
     *
     * @return self
     */
    public function setUnixMicroTime($unixMicroTime)
    {
        $this->unixMicroTime = $unixMicroTime;
        return $this;
    }
}