private static function getLegacySpec(array $parts)
    {
        $spec = "P";
        $spec .= $parts['y'] !== "" ? "{$parts['y']}Y" : "";
        $spec .= $parts['m'] !== "" ? "{$parts['m']}M" : "";
        $spec .= $parts['d'] !== "" ? "{$parts['d']}D" : "";
        if ($parts['h'] . $parts['i'] . $parts['s'] !== "") {
            $spec .= "T";
            $spec .= $parts['h'] !== "" ? "{$parts['h']}H" : "";
            $spec .= $parts['i'] !== "" ? "{$parts['i']}M" : "";
            $spec .= $parts['s'] !== "" ? "{$parts['s']}S" : "";
        }
        if ($spec === "P") {
            $spec = "";
        }

        return $spec;
    }
private static function getLegacySpec(array $parts)
    {
        $spec = "P";
        $spec .= $parts['y'] !== "" ? "{$parts['y']}Y" : "";
        $spec .= $parts['m'] !== "" ? "{$parts['m']}M" : "";
        $spec .= $parts['d'] !== "" ? "{$parts['d']}D" : "";
        if ($parts['h'] . $parts['i'] . $parts['s'] !== "") {
            $spec .= "T";
            $spec .= $parts['h'] !== "" ? "{$parts['h']}H" : "";
            $spec .= $parts['i'] !== "" ? "{$parts['i']}M" : "";
            $spec .= $parts['s'] !== "" ? "{$parts['s']}S" : "";
        }
        if ($spec === "P") {
            $spec = "";
        }

        return $spec;
    }
private static function getLegacySpec ( array $ parts ) { $ spec = "P" ; $ spec .= $ parts [ 'y' ] !== "" ? "{$parts['y']}Y" : "" ; $ spec .= $ parts [ 'm' ] !== "" ? "{$parts['m']}M" : "" ; $ spec .= $ parts [ 'd' ] !== "" ? "{$parts['d']}D" : "" ; if ( $ parts [ 'h' ] . $ parts [ 'i' ] . $ parts [ 's' ] !== "" ) { $ spec .= "T" ; $ spec .= $ parts [ 'h' ] !== "" ? "{$parts['h']}H" : "" ; $ spec .= $ parts [ 'i' ] !== "" ? "{$parts['i']}M" : "" ; $ spec .= $ parts [ 's' ] !== "" ? "{$parts['s']}S" : "" ; } if ( $ spec === "P" ) { $ spec = "" ; } return $ spec ; }
Build valid DateInterval format
@param array $parts
@return string
Build valid DateInterval format