1
0
mirror of https://github.com/rlanvin/php-rrule.git synced 2025-04-07 22:53:48 +02:00

Change values of FREQ when get the RFC string to match the convention

This commit is contained in:
Antoine Chabert 2016-08-17 17:14:35 +02:00
parent 989ddb9d9d
commit 8fbc51e499

View File

@ -528,7 +528,7 @@ class RRule implements RRuleInterface
* Magic string converter.
*
* @see RRule::rfcString()
* @return a rfc string
* @return string a rfc string
*/
public function __toString()
{
@ -603,6 +603,12 @@ class RRule implements RRuleInterface
}
continue;
}
if ( $key === 'FREQ' && $value && !array_key_exists($value, static::$frequencies) ) {
$frequencyKey = array_search($value, static::$frequencies);
if ($frequencyKey !== false) {
$value = $frequencyKey;
}
}
if ( $value ) {
if ( is_array($value) ) {
$value = implode(',',$value);