public function toSpec(\DateInterval $interval = null)
    {
        if ((null === $interval) && isset($this)) {
            $interval = $this;
        }

        $string = 'P';

        foreach (self::$date as $property => $suffix) {
            if ($interval->{$property}) {
                $string .= $interval->{$property} . $suffix;
            }
        }

        if ($interval->h || $interval->i || $interval->s) {
            $string .= 'T';

            foreach (self::$time as $property => $suffix) {
                if ($interval->{$property}) {
                    $string .= $interval->{$property} . $suffix;
                }
            }
        }

        return $string;
    }